// JavaScript Document
function postRequest(strUrl){
var x;
if(window.XMLHttpRequest){
var x=new XMLHttpRequest();
} 
else if(window.ActiveXObject){
var x=new ActiveXOject("Microsoft.XMLHTTP");
}
x.open('POST',strUrl,true);
x.setRequestHeader('Content-Tye','application/x=www-form-urlencoded');
x.onreadystatechange=function(){
if(x.readyState==4){
updatepage(x.responseText)
}
}
x.send(strUrl);

}
function updatepage(str){
   if(str=='success'){
			document.getElementById('note').innerHTML='<b style="color:blue">Message Sent.</b>';	   
	   }
	else{
			document.getElementById('note').innerHTML='<b style="color:red">Your message cannot be sent, please try again later...</b>';		
		}
}

function call_submit(){
var firstname=window.document.ft.firstname.value;
var lastname=window.document.ft.lastname.value;
var add1=window.document.ft.streetadd1.value;
var add2=window.document.ft.streetadd2.value;
var city=window.document.ft.city.value;
var state=window.document.ft.state.value;
var zip=window.document.ft.zipcode.value;
var dayphone=window.document.ft.dayphone.value;
var evephone=window.document.ft.evephone.value;
var email=window.document.ft.email.value;
var comment=window.document.ft.comment.value;
//alert(firstname+lastname+add1+add2+city+state+zip+dayphone+evephone+email+comment);
if (firstname.replace(/^\s\s+|\s\s+$/,'') == '') { alert('Please enter your Firstname.'); return false; }
else if (lastname.replace(/^\s\s+|\s\s+$/,'') == '') { alert('Please enter your Lastname.'); return false; }
else if (email.replace(/^\s\s+|\s\s+$/,'') == '') {  alert('Please enter your Email Address.'); return false; }

var url='wp-content/themes/php/submit.php?fn='+firstname+'&ln='+lastname+'&a1='+add1+'&a2='+add2+'&c='+city+'&s='+state+'&z='+zip+'&dp='+dayphone+'&ep='+evephone+'&e='+email+'&cmt='+comment;
postRequest(url);
}