 $(document).ready(function(){
							
	$("#sendmail").click(function(){
		var valid = '';
		var isr = ' is required.';
		var name = $("#txtname").val();
		var mail = $("#txtemail").val();
		var tel = $("#txttel").val();
		var comments = $("#txtcomments").val();
		var town = $("#txttown").val();
		if (name.length<1 || name=='Name') {
			valid += '<br />Name'+isr;
		}
		if (!mail.match(/^([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4}$)/i)) {
			valid += '<br />A valid Email'+isr;
		}
		
		if (comments.length<1  || comments=='Comment') {
			valid += '<br />Comments '+isr;
		}
		if (valid!='') {
			$("#response").fadeIn("slow");
			$("#response").html("<div style='text-align:left;'><b>Error :</b>"+valid +"</div>");
		}
		else {    
			var datastr ='txtname=' + name + '&txtemail=' + mail + '&txttel=' 
							+ tel + '&txtcomments=' + comments + '&txttown=' + town;
			$("#response").css("display", "block");
			$("#response").html("Sending message .... ");
			$("#response").fadeIn("slow");
			setTimeout("send('"+datastr+"')",2000);
		}
		return false;
	});
});
function send(datastr){
	$.ajax({	
		type: "POST",
		url: "data/quote.php",
		data: datastr,
		cache: false,
		success: function(html){
		$("#response").fadeIn("slow");
		$("#response").html(html);
		setTimeout('$("#response").fadeOut("slow")',2000);
	}
	});
}

