function trim(inputString)
{
	inputString=inputString.replace(/^\s+/g,"");
	inputString=inputString.replace(/\s+$/g,"");
	return inputString;
}

function validateFormCall()
{
	var firstName	=trim(document.callmeform.firstName.value);
	if(firstName=="")
	{
		alert("First name should not be blank.");
		document.callmeform.firstName.focus();
		return false;
	}

	var lastName	=trim(document.callmeform.lastName.value);	
	if(lastName=="")
	{
		alert("Last name should not be blank.");
		document.callmeform.lastName.focus();
		return false;
	}
	
	var teleno		=trim(document.callmeform.teleno.value);
	if(teleno=="")
	{
		alert("Telephone number should not be blank.");
		document.callmeform.teleno.focus();
		return false;
	}
	
	var teleno2		=trim(document.callmeform.teleno2.value);
	if(teleno2=="")
	{
		alert("Re-confirm telephone  should not be blank.");
		document.callmeform.teleno2.focus();
		return false;
	}	
	
	if(teleno!=teleno2)
	{
		alert("Telehone and Re-confirm telephone number  should be same.");
		document.callmeform.teleno2.focus();
		return false;
	}	
	/*
	var statename	=trim(document.callmeform.statename.value);	
	if(statename=="")
	{
		alert("Please select a state name.");
		document.callmeform.statename.focus();
		return false;
	} */
	
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,5})+$/.test(document.callmeform.email.value))
	{
		//return (true)
	}
	else{
		alert("Invalid E-mail Address! Please re-enter.")
		document.callmeform.email.focus();
		return (false);

	}
	/*
	var calltime	=trim(document.callmeform.calltime.value);	
	if(calltime=="")
	{
		alert("Call Time should not be blank.");
		document.callmeform.calltime.focus();
		return false;
	}
	
	var callday	=trim(document.callmeform.callday.value);	
	if(callday=="")
	{
		alert("Call Day should not be blank.");
		document.callmeform.callday.focus();
		return false;
	}
	
	var pdate_from	=trim(document.callmeform.pdate_from.value);	
	if(pdate_from=="")
	{
		alert("Preferred date should not be blank.");
		document.callmeform.pdate_from.focus();
		return false;
	}
	*/
	
	/*
	var sec_code	=trim(document.callmeform.security_code.value);	
	if(sec_code=="")
	{
		alert("Security code should not be blank.");
		document.callmeform.security_code.focus();
		return false;
	}
	*/

}

function validateForm()
{


  /*============================ */
   var firstName2	=trim(document.enquiriesForm.firstName2.value);
   
   if(firstName2=="")
   {
		alert("First name should not be blank.");
		document.enquiriesForm.firstName2.focus();
		return false;
	}

	var lastName2	=trim(document.enquiriesForm.lastName2.value);	
	
	if(lastName2=="")
	{
		alert("Last name should not be blank.");
		document.enquiriesForm.lastName2.focus();
		return false;
	}
	
	var teleno2		=trim(document.enquiriesForm.teleno2.value);
	if(teleno2=="")
	{
		alert("Telephone number should not be blank.");
		document.enquiriesForm.teleno2.focus();
		return false;
	}
	
	var teleno21		=trim(document.enquiriesForm.teleno21.value);
	if(teleno21=="")
	{
		alert("Re-confirm telephone  should not be blank.");
		document.enquiriesForm.teleno21.focus();
		return false;
	}	
	
	if(teleno2!=teleno21)
	{
		alert("Telehone and Re-confirm telephone number  should be same.");
		document.enquiriesForm.teleno21.focus();
		return false;
	}	
	/*
	var statename2	=trim(document.enquiriesForm.statename2.value);	
	if(statename2=="")
	{
		alert("Please select a state name.");
		document.enquiriesForm.statename2.focus();
		return false;
	} */
	
	
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,5})+$/.test(document.enquiriesForm.email2.value))
	{
		//return (true)
	}
	else{
		alert("Invalid E-mail Address! Please re-enter.")
		document.enquiriesForm.email2.focus();
		return (false);

	}
	/*
	var calltime2	=trim(document.enquiriesForm.calltime2.value);	
	if(calltime2=="")
	{
		alert("Call Time should not be blank.");
		document.enquiriesForm.calltime2.focus();
		return false;
	}
	
	var callday2	=trim(document.enquiriesForm.callday2.value);	
	if(callday2=="")
	{
		alert("Call Day should not be blank.");
		document.enquiriesForm.callday2.focus();
		return false;
	}
	
	var pdate_from2	=trim(document.enquiriesForm.pdate_from2.value);	
	if(pdate_from2=="")
	{
		alert("Preferred date should not be blank.");
		document.enquiriesForm.pdate_from2.focus();
		return false;
	} */
	
	var sec_code	=trim(document.enquiriesForm.security_code.value);	
	if(sec_code=="")
	{
		alert("Security code should not be blank.");
		document.enquiriesForm.security_code.focus();
		return false;
	}
	/*
	var poststr = "title=" + encodeURI( document.getElementById("ti").value );
		poststr = poststr + "&firstName=" + encodeURI( document.getElementById("fn").value );
		poststr = poststr + "&lastName=" + encodeURI( document.getElementById("ln").value );
	    poststr = poststr + "&companyname=" + encodeURI( document.getElementById("cn").value );
		poststr = poststr + "&teleno=" + encodeURI( document.getElementById("te").value );
		poststr = poststr + "&teleno2=" + encodeURI( document.getElementById("te2").value );
		poststr = poststr + "&statename=" + encodeURI( document.getElementById("ti").value );
		poststr = poststr + "&email=" + encodeURI( document.getElementById("em").value );
		poststr = poststr + "&homeRequirements=" + encodeURI( document.getElementById("h_rq").value );
        poststr = poststr + "&calltime=" + encodeURI( document.getElementById("ar").value );
		poststr = poststr + "&callday=" + encodeURI( document.getElementById("calldayid").value );
	    poststr = poststr + "&pdate_from=" + encodeURI( document.getElementById("pdate_from").value );
       	poststr = poststr + "&callday=" + encodeURI( document.getElementById("calldayid").value );
       	poststr = poststr + "&callday=" + encodeURI( document.getElementById("calldayid").value );

		showResultData(poststr);
		*/
	

}
