﻿// AJAX ----------------------------------------

var xmliHttp

function GetxmliHttpObject(){
    var xmlhttp=false; 
        try {
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
                        } catch (e) {
                try {
                        xmlhttp = new
                        ActiveXObject("Microsoft.XMLHTTP"); 
            } catch (E) {
                xmlhttp = false;
                        }
        }
        if (!xmlhttp && typeof XMLHttpRequest!="undefined") {
                xmlhttp = new XMLHttpRequest(); 
        }
return xmlhttp;

}

// Calculate the rating
function doPageHttp(url,params,loading){

	xmliHttp = GetxmliHttpObject();
	
	if(xmliHttp == null){
		alert ("Your browser does not support AJAX!");
		return;
	  }

	xmliHttp.onreadystatechange = function(){
	var loader = document.getElementById(loading);
	
		if (xmliHttp.readyState == 4){ 
			var res = xmliHttp.responseText;
			//alert(res);
			loader.innerHTML = res;	
		} else {
			loader.innerHTML = '<img src="/images/ajax-loader-gray.gif" alt="loading" />';	
		}
	
	}

	xmliHttp.open("POST",url,true);
	xmliHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmliHttp.setRequestHeader("Content-length", params.length);
	xmliHttp.setRequestHeader("Connection", "close");
	xmliHttp.send(params);

} 