
var time_variable;
 
function getXMLObjects()  //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 getXMLObjects();	//xmlhttp holds the ajax object


function savecomment() {

  var getdate = new Date();  //Used to prevent caching during ajax call
  if(xmlhttp) { 
  	var comment = document.getElementById("comment");

    xmlhttp.open("POST","/delta/pack_files/function:56/comment.php",true); //calling testing.php using POST method
    xmlhttp.onreadystatechange  = handleServerResponses;
    xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

  	var rating = document.getElementById("rating");
    xmlhttp.send("comment=" + escape(encodeURI(comment.value)) + "&rating=" + rating.value); //Posting txtname to PHP File
}
}


function handleServerResponses() {
   if (xmlhttp.readyState == 4) {
     if(xmlhttp.status == 200) {
ajaxpage('/delta/pack_files/function:56/comments.php', 'commentdiv');
     }
     else {
        alert("Error during AJAX call. Please try again");
     }
   }
}
