var time_variable;
 
function getXMLObject()  //XML OBJECT
{
   var xmlHttp = false;
   try {
     xmlHttp = new ActiveXObject("Msxml2.XMLHTTP")  // For Old Microsoft Browsers
   }
   catch (e) {
     try {
       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP")  // For Microsoft IE 6.0+
     }
     catch (e2) {
       xmlHttp = false   // No Browser accepts the XMLHTTP Object then false
     }
   }
   if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
     xmlHttp = new XMLHttpRequest();        //For Mozilla, Opera Browsers
   }
   return xmlHttp;  // Mandatory Statement returning the ajax object created
}
 
var xmlhttp = new getXMLObject();	//xmlhttp holds the ajax object
 
function sendtoafriend() {
  var getdate = new Date();  //Used to prevent caching during ajax call
  if(xmlhttp) { 
  	var friendsname = document.getElementById("friendsname");
	var friendsemail = document.getElementById("friendsemail");
	var yourname = document.getElementById("yourname");
	var youremail = document.getElementById("youremail");
	var mymessage = document.getElementById("mymessage");
	
    xmlhttp.open("POST",dotdotpath+"_include/ssi/process_staf.php",true); //calling testing.php using POST method
    xmlhttp.onreadystatechange  = handleServerResponse;
    xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlhttp.send("friendsname=" + friendsname.value+ "&friendsemail=" +friendsemail.value+ "&yourname=" +yourname.value+ "&youremail=" +youremail.value+ "&mymessage=" +mymessage.value+ "&curDir=" + curDir ); //Posting  to PHP File
  }
}
 
function handleServerResponse() {
   if (xmlhttp.readyState == 4) {
     if(xmlhttp.status == 200) {
       document.getElementById("message").innerHTML=xmlhttp.responseText; //Update the HTML Form element 
     }
     else {
        alert("Sorry an error occurred. Please try again");
     }
   }
}
