// JavaScript Document

$(function(){
		   
	$("#nav li a").hover(function(){
		$(this).parent().find("div").stop().animate({"opacity": 1});
	}, function(){
		$(this).parent().find("div").stop().animate({"opacity": 0});
	});
	
	$('form#contactform').submit(function(){
	
		if ($("#name").val()!=''){
			
			if ($("#youremail").val()!=''){
				if($('#validate').val()=='tan') {  		  
					$.post("processor.php", $('form').serialize());
					$('.field').css({"display": "none"});
					$('#messagesuccess').show();
					return false;
				} else {
					$('#validatefail').show();
					return false;
				}
			} else {
				$('#youremailfail').show();
				$('#messagefail').show();
				return false;
			}
			
		} else {
			$('#namefail').show();
			$('#messagefail').show();
			return false;
		}
		
	});
	
	$('input#validate[type="text"]').focus(function() {
		$('#validatefail').hide();	
		$('#messagefail').hide();
	});
	
	$('input#name[type="text"]').focus(function() {
		$('#namefail').hide();		
		$('#messagefail').hide();
	});
	
	$('input#youremail[type="text"]').focus(function() {
		$('#youremailfail').hide();		
		$('#messagefail').hide();
	});
	
	
});

