function SendEmail(send_to,bcc_to,subject,message){//send emails
	var params = "send_to=" + send_to + "&bcc_to=" + bcc_to + "&subject=" + subject + "&message=" + message + "&";
	var objXmlHttp=null;
	objXmlHttp = new XMLHttpRequest();
	objXmlHttp.onreadystatechange=function(){
    	if(objXmlHttp.readyState==4 || objXmlHttp.readyState=="complete"){
			SendEmailState(objXmlHttp);
 		}
    }
    objXmlHttp.open("POST","phpmailer.php",false);
    objXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  	objXmlHttp.setRequestHeader("Content-length", params.length);
	objXmlHttp.setRequestHeader("Connection", "close");
    objXmlHttp.send(params);
}

function SendEmailState(obj){
    var xmlLog = obj.responseText;
	global_xmlLog = xmlLog;
	if (window.ActiveXObject){ //for IEE
		var objXmlDom = new ActiveXObject("Microsoft.XMLDOM");
		objXmlDom.async="true";
		objXmlDom.loadXML(xmlLog);
		while(objXmlDom.readyState != 4) {} 
		XML = objXmlDom.getElementsByTagName("response");
	}
	else if(document.implementation && document.implementation.createDocument){ //for FF  
		parser=new DOMParser();
   		objXmlDom=parser.parseFromString(xmlLog,"text/xml");
 		XML = objXmlDom.getElementsByTagName("response");
 	}
	else
		XML = null; 
}