$(document).ready(function(){
	$.ajaxSetup ({  
    	cache: false,
		type: "POST"
	});
	
	$("#contactsubmit1").click(function() {
		if ($("#first_name").val() == '') {
			alert('Please enter your first name');
			$("#first_name").focus();
			return false;
		}

		if ($("#last_name").val() == '') {
			alert('Please enter your last name');
			$("#last_name").focus();
			return false;
		}

		if ($("#email").val() == '') {
			alert('Please enter your e-mail address');
			$("#email").focus();
			return false;
		}

		if ($("#telephone").val() == '') {
			alert('Please enter your telephone number');
			$("#telephone").focus();
			return false;
		}

		if ($("#comments").val() == '') {
			alert('Please enter your comments');
			$("#comments").focus();
			return false;
		}

		$("#contactload").load("/contact/contact1.php", {first_name: $("#first_name").val(), last_name: $("#last_name").val(), email: $("#email").val(), telephone: $("#telephone").val(), comments: $("#comments").val()}, function(responseText){  
			//alert('Thank you, your message was sent. We will reply to you shortly.');
			$("#contacttable1 input[type='text'], #contacttable1 textarea").val("");
			window.location="/contact/thankyou.html";
		});
		
		return false;
	});
	
	$("#Full_Name").focus(function() {
		if ($(this).val() == 'Name')
			$(this).val('');
	});
	
	$("#Full_Name").blur(function() {
		if ($(this).val() == '')
			$(this).val('Name');
	});
	
	$("#Email_Address").focus(function() {
		if ($(this).val() == 'Email')
			$(this).val('');
	});
	
	$("#Email_Address").blur(function() {
		if ($(this).val() == '')
			$(this).val('Email');
	});
	
	$("#Telephone_Number").focus(function() {
		if ($(this).val() == 'Cell')
			$(this).val('');
	});
	
	$("#Telephone_Number").blur(function() {
		if ($(this).val() == '')
			$(this).val('Cell');
	});
	
	$("#Your_Message").focus(function() {
		if ($(this).val() == 'Move Date')
			$(this).val('');
	});
	
	$("#Your_Message").blur(function() {
		if ($(this).val() == '')
			$(this).val('Move Date');
	});
	
	$("#contactsubmit2").click(function() {
		if (($("#Full_Name").val() == '') || ($("#Full_Name").val() == 'Name')) {
			alert('Please enter your full name');
			$("#Full_Name").focus();
			return false;
		}
		
		if (($("#Email_Address").val() == '') || ($("#Email_Address").val() == 'Email')) {
			alert('Please enter your e-mail address');
			$("#Email_Address").focus();
			return false;
		}
		
		if (($("#Telephone_Number").val() == '') || ($("#Telephone_Number").val() == 'Cell')) {
			alert('Please enter your telephone number');
			$("#Telephone_Number").focus();
			return false;
		}
		
		if (($("#Your_Message").val() == '') || ($("#Your_Message").val() == 'Move Date')) {
			alert('Please enter your first name');
			$("#Your_Message").focus();
			return false;
		}

		$("#contactload").load("/contact/contact2.php", {Full_Name: $("#Full_Name").val(), Email_Address: $("#Email_Address").val(), Telephone_Number: $("#Telephone_Number").val(), Your_Message: $("#Your_Message").val()}, function(responseText){  
			//alert('Thank you, your message was sent. We will reply to you shortly.');
			$("#contacttable2 input[type='text'], #contacttable2 textarea").val("");
			window.location="/contact/thankyou.html";
		});
		
		return false;
	});
});
