function str_replace (search, replace, subject)
{
	var result = "";
	var oldi = 0;
	for (i = subject.indexOf (search); i > -1; i = subject.indexOf (search, i))
	{
		result += subject.substring (oldi, i);
		result += replace;
		i += search.length;
		oldi = i;
	}
	return result + subject.substring (oldi, subject.length);
}
var xmlHttp

function GetXmlHttpObject()
{ 
	var objXMLHttp=null
	if (window.XMLHttpRequest)
		{
			objXMLHttp=new XMLHttpRequest()
		}
	else if (window.ActiveXObject)
		{
			objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
		}
	
	return objXMLHttp
}

function doSendContact()
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	}
	var str =  document.getElementById('detail_email_txt').value+ "^^^***" +
			   document.getElementById('detail_company_txt').value  + "^^^***" +
			   document.getElementById('detail_country_cbo').value+ "^^^***" +  
			   document.getElementById('detail_youname_txt').value+ "^^^***" + 
			   document.getElementById('detail_jobtitle_txt').value+ "^^^***" + 
			   document.getElementById('detail_contact_txt').value+ "^^^***" +
			   document.getElementById('equi_product_txt').value+ "^^^***" +
			   document.getElementById('equi_brand_txt').value+ "^^^***" +
			   document.getElementById('equi_capacity_txt').value+ "^^^***" + 
			   document.getElementById('equi_app_txt').value+ "^^^***" +
			   document.getElementById('rentalchk').checked+ "^^^***" + 
			   document.getElementById('equi_Rental_months_txt').value+ "^^^***" +
			   document.getElementById('equi_Rental_quantity_txt').value+ "^^^***" +
			   document.getElementById('buychk').checked+ "^^^***" + 
			   document.getElementById('Brandnews_radio').checked+ "^^^***" +
			   document.getElementById('Bsecondhand_radio').checked+ "^^^***" +
			   document.getElementById('equi_Buy_quantity_txt').value+ "^^^***" +
			   document.getElementById('comm_month_cbo').value+ "^^^***" +  
			   document.getElementById('comm_year_cbo').value+ "^^^***" +   
			   document.getElementById('comm_delivery_cbo').value+ "^^^***" +   
			   document.getElementById('comm_content_txt').value+"^^^***";
	var content=str_replace('&','$$$^^^',str);
	var url="process.php?act=sendcontact"
	url=url+"&cnt="+content
	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function stateChanged() 
{ 
	if (xmlHttp.readyState==4 )
	{ 
	  	if(xmlHttp.status == 200)
	  	{
			   document.getElementById('detail_email_txt').value='';
			   document.getElementById('detail_company_txt').value='';
			   document.getElementById('detail_youname_txt').value='';
			   document.getElementById('detail_jobtitle_txt').value=''; 
			   document.getElementById('detail_contact_txt').value='';
			   document.getElementById('equi_product_txt').value='';
			   document.getElementById('equi_brand_txt').value='';
			   document.getElementById('equi_capacity_txt').value='';
			   document.getElementById('equi_app_txt').value='';
			   document.getElementById('equi_Rental_months_txt').value='';
			   document.getElementById('equi_Rental_quantity_txt').value='';
			   document.getElementById('Brandnews_radio').checked='';
			   document.getElementById('Bsecondhand_radio').checked='';
			   document.getElementById('equi_Buy_quantity_txt').value='';
			   document.getElementById('comm_content_txt').value='';
				alert(xmlHttp.responseText);
	} 	 
  } 	
} 

