function trim(str)
	{	
		return str.replace(/^\s*|\s*$/g,"");
	}	
function contact_us_validation(){
	
	var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
	if(trim(document.getElementById("txt_name").value)==""){
		alert("Name field should not be blank");
		document.getElementById("txt_name").value=="";
		document.getElementById("txt_name").focus();	
		return false;
	 }
	 
	 
	if(trim(document.getElementById("txt_email").value)==""){
		alert("Email field should not be blank");
		document.getElementById("txt_email").value=="";
		document.getElementById("txt_email").focus();	
		return false;
	 }
	  if (!emailFilter.test(document.getElementById("txt_email").value)) { //test email for illegal characters
		alert( "Please enter a valid email address.\n" );
			return false;			
	 }
	 
	 if(trim(document.getElementById("txt_phone").value)==""){
		alert("Phone No field should not be blank");
		document.getElementById("txt_phone").value=="";
		document.getElementById("txt_phone").focus();	
		return false;
	 }
	  if(trim(document.getElementById("txt_message").value)==""){
		alert("Message field should not be blank");
		document.getElementById("txt_message").value=="";
		document.getElementById("txt_message").focus();	
		return false;
	 }
	
	//return true; 
} 
	
function news_letter_validation(){
	
	var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
	if(trim(document.getElementById("txt_news").value)==""){
		alert("Email field should not be blank");
		document.getElementById("txt_news").value=="";
		document.getElementById("txt_news").focus();	
		return false;
	 }
	  if (!emailFilter.test(document.getElementById("txt_news").value)) { //test email for illegal characters
		alert( "Please enter a valid email address.\n" );
			return false;			
	 }
	 
	 
}
