var globalDivId='';

  function trim(str)
  {
	return str.replace(/^\s+|\s+$/g,'');
  }


	
function ajaxcontactus(div_id) {	
	
						if (trim(document.contact_form.full_name.value)=="" )
							{ 
							alert("Please enter the name. ");
							document.contact_form.full_name.focus();
							return false;	
							}
						
						if(document.contact_form.email.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1)
							{
							alert("Please enter the correct email address");
							document.contact_form.email.focus();
							return false;
							}
						if (trim(document.contact_form.address.value)=="")
							{
							alert("Please select the State.");
							document.contact_form.address.focus();
							return false;	
							}	
						if (trim(document.contact_form.comment.value)=="")
							{
							alert("Please tyoe the comment.");
							document.contact_form.comment.focus();
							return false;	
							}
			  //return true;
			  
			

	
		var namevalue = document.getElementById('full_name').value;
		var emailvalue = document.getElementById('email').value;
		var addressvalue = document.getElementById('address').value;
		var phonevalue = document.getElementById('comment').value;
		/*document.form1.action="send_newsletter.php";
		document.form1.method="POST";
		document.form1.submit();*/
		globalDivId="contact_us";
		var strURL="contact_process.php";
		var myData="full_name="+namevalue+"&email="+emailalue+"&address="+addressvalue+"&comment="+commentvalue;	
		
		myAjax(strURL,myData);
	}
	
	function myAjax(myurl,myData){	
	$.ajax({
	type: "GET",
	url: myurl, 
    data: myData,
	beforeSend:function(){	
		$("#"+globalDivId).html(" Submitting...");
		},
	success: function(responseTxt){	 	 
	 //alert(responseTxt);
	 $("#"+globalDivId).html(responseTxt);
	}
	});	
	}
