$(document).ready(function() {
	
//	$(".project a img").hide();
//	$(".slides div img").hide();
	
//	$(".project a img").bind("load", function () { $(this).fadeIn(300); });
//	$(".slides div img").bind("load", function () { $(this).fadeIn(300); });

	$("a.next, a.previous").hover(function(){
		$(".slideNav .total").toggleClass("active");
		return false; //Prevent the browser jump to the link anchor
	});
			
	$("#makeContact").submit(function() {
		if($('#makeContact #email').val() != "") {
			
			$('#makeContact').slideUp();
					$.ajax({
						data: $("#makeContact").serialize(),
						url: "	/includes/shipContact.php",
						type: "POST",
						success: volunteerResponse
					});
						
		} else {
			alert("Please enter your name and address");	
		}
	});

	// post-submit callback 
	function volunteerResponse(data, textStatus)  {
		var item = $('<p class="thanks">Well hello there, thanks for sending a message our way.  We\'ll get back to you shortly.</p>').hide();
		$('#feature').append(item);
		item.fadeIn(500);
	}
	
	
	// Track outbound links as events in Google Analytics
	$('a').click(function() {
	  var $a = $(this);
	  var href = $a.attr('href');
	
	  // see if the link is external
	  if ( (href.match(/^http/)) && (! href.match(document.domain)) ) {
	
		// if so, register an event
		var category = 'Outgoing'; // set this to whatever you want
		var event = 'Click'; // set this to whatever you want
		var label = href; // set this to whatever you want
	
		_gaq.push(['_trackEvent', category, event, href]);
	  }
	});
	
	// Temporary form disable
//	$("#invoice #submitContact").click(function() {
//		
//		alert("Invalid credit card number");	
//		
//	});

	$(document).bind('keyup', 'right', function(event){
    	$("a.next").trigger('click');
    });
	$(document).bind('keyup', 'left', function(event){
    	$("a.previous").trigger('click');
    });
	
});
