jQuery(function ($) {
	/* You can safely use $ in this code block to reference jQuery */
	$(document).ready(function() {
	$('#email-form').inFieldLabels();
	$('#ftp-form').inFieldLabels();
	});
	
	$(document).ready(function() {
	$('.cv-input-upload').change(function() {
		
	$('.cv-field-no').removeClass('cv-field-no').addClass('cv-field-yes');
		
	});
	
	$('.port-input-upload').change(function() {
		
	$('.port-field-no').removeClass('port-field-no').addClass('port-field-yes');
		
	});
	
	});
	
	
	
$(document).ready(function() {
	$('.fadeThis').append('<span class="hover"></span>').each(function () {
	  var $span = $('> span.hover', this).css('opacity', 0);
	  $(this).hover(function () {
	    $span.stop().fadeTo(500, 1);
	  }, function () {
	    $span.stop().fadeTo(500, 0);
	  });
	});
});
$(document).ready(function() {
	$('.fadeThisthumb').append('<span class="hover"></span>').each(function () {
	  var $span = $('> span.hover', this).css('opacity', 0);
	  $(this).hover(function () {
	    $span.stop().fadeTo(500, 1);
	  }, function () {
	    $span.stop().fadeTo(500, 0);
	  });
	});
});
$(document).ready(function() {
	$('.fadeThisAbout').append('<span class="hover"></span>').each(function () {
	  var $span = $('> span.hover', this).css('opacity', 0);
	  $(this).hover(function () {
	    $span.stop().fadeTo(500, 1);
	  }, function () {
	    $span.stop().fadeTo(500, 0);
	  });
	});
});

$(document).ready(function($){
            $("#site-container").mousemove(function(e){
                var mouseX = e.pageX - $('#site-container' || '#invaders').offset().left;
                var mouseY = e.pageY - $('#site-container' || '#invaders').offset().top;
				var totalX = $('#site-container' || '#invaders').width();
				var totalY = $('#site-container' || '#invaders').height();
				var centerX = totalX / 2;
				var centerY = totalY / 2;
				var shiftX = centerX - mouseX;
				var shiftY = centerY - mouseY;
				
				var startX = ($('#site-container' || '#invaders').width() / 2) - ($('#touch-here').width() / 2);
				var startY = ($('#site-container' || '#invaders').height() / 2) - ($('#touch-here').height() / 2);
				
				$('#touch-here').css({ 'left': startX - (shiftX/1) + 'px' });
				$('#touch-here-close').css({ 'left': startX - (shiftX/1) + 'px' });
				$('#pointer2').css({ 'left': startX - (shiftX/1) + 'px' });
				
			
			
			});
});

$(document).ready(function() {

		$('#game').hide();
		$('#game').css({'display': 'none'});
		$('#touch-here-close').hide();
		
		$('.touch-here').click(function() { // When touch here button is clicked
			
			if ($("#game").is(":visible"))
        {
			$('#touch-here-close').hide("fast");
			
			$('#game').slideUp("normal",function () {
                        $(this).hide();
						$('#touch-here').slideDown("normal", function() {
							$(this).animate({"top": "-28px"}, 980, "easeOutSine");
							$('#game').css({'display': 'none'});
							
							//$('#touch-here').animate({"top": "-333px"}, 980, "easeOutSine");
						
                    	});
			
			});
			
		} else if ($("#game").is(":hidden")) {
			
			$('#game').css({'display': 'block'});			
			$('#game').slideDown("normal", function () {
                    	$("body").scrollTo(('#footer'), 1000, { easing: 'easeInQuad' });
						$('#touch-here-close').show('fast').animate({"top": "-333px"}, 980, "easeOutSine");
						$('#touch-here').slideUp("normal");
						
						return false;
						});
						return false;
          

		}
		return false;
		
		});
		
	
}); 

//MODAL BOX START

$(document).ready(function() {	

	//select all the a tag with name equal to modal
	$('a[id=modal]').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		
		//Get the A tag
		var id = $(this).attr('href');
	
		//Get the screen height and width
		//var maskHeight = $(document).height();
		//var maskWidth = $(document).width();
		var maskHeight = "100%";
		var maskWidth = "100%";
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').fadeIn(1000);	
		$('#mask').fadeTo("slow",1);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		//$(id).css('top',  winH/2-$(id).height()/2);
		//$(id).css('left', winW/2-$(id).width()/2);
		$(id).css('top',  '50px');
		$(id).css('margin-left', 'auto');
		$(id).css('margin-right', 'auto');
		$(id).css('position', 'relative');
		//$(id).css('width', '468px');
		//$(id).css('height', '561px');
	
		//transition effect
		$(id).fadeIn(2000);
	
	});
	
	//if close button is clicked
	$('.window .close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		
		$('#mask').fadeOut(1000);
		$('.window').fadeOut(1000);
	});		
	
	//if mask is clicked
	$('#mask').click(function () {
		$(this).fadeOut(1000);
		$('.window').fadeOut(1000);
	});			
	
});
// MODAL BOX END


});
