
// -- jQuery functions ---------------------------------------

$(document).ready(function(){
 
 	// -- AJAX submit of contact form --------------------------
		$("#contactForm").submit(function(){  
			
			document.getElementById("nameError").innerHTML = "&Phi;";
			document.getElementById("emailError").innerHTML = "&Phi;";
			
			// -- form validation ------------
			var formProblem = 0;
			if(document.forms.contactForm.contactName.value == ""){
				document.getElementById("nameError").innerHTML = "<img src='/images/icons/redArrowLeft.jpg' class='pRight' />Please enter your name";
				formProblem = 1;
			}
			if(document.forms.contactForm.contactEmail.value == ""){
				document.getElementById("emailError").innerHTML = "<img src='/images/icons/redArrowLeft.jpg' class='pRight' />Please enter your email address";
				formProblem = 1;
			}				
			
			if(formProblem == 1){ return false; }
			// -------------------------------
		
			$.post(
				"/includes/contactEmail.cfm",
				$("#contactForm").serialize(),
				function(data){ 
					$("#contactForm").slideUp(2000);
					$("#sentMessage").slideDown(2000);
				 }
			);
		 })
	// ---------------------------------------------------------
 
 
 	// -- Portfolio functions ----------------------------------
 	$(".pImage").hover(function(){ $($(this)).animate({width: '300px' },600); })
 	$(".pImage").mouseout(function(){ $($(this)).animate({width: '150px' },400); })

	$("#shoppingBtn").click(function(){ 
		$(".otherDiv").fadeOut(1000);
		$("#shopping").fadeIn(1000);
	})
	
	$("#cmBtn").click(function(){
		$(".otherDiv").fadeOut(1000);
		$("#contentManaged").fadeIn(1000); 
	})
	
	$("#brochureBtn").click(function(){
		$(".otherDiv").fadeOut(1000);
		$("#brochure").fadeIn(1000);
	})
	
	$("#webAppsBtn").click(function(){
		$(".otherDiv").fadeOut(1000);
		$("#webApps").fadeIn(1000);
	})
	// ---------------------------------------------------------
	
	
});
