/**
 *	Simple ajax functions
 *	@author	prasad
 */
 
function XMLHTTPObject() {
	var A;
	if( window.ActiveXObject ) {
 		var msxmlhttp = new Array('Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP', 'Microsoft.XMLHTTP');
		for (var i = 0; i < msxmlhttp.length; i++) {
			try {
				A = new ActiveXObject(msxmlhttp[i]);
			} catch (e) {
				A = null;
			}
		}
	}
	else {
		if( window.XMLHttpRequest ){
			try {
				A = new XMLHttpRequest();
			} catch (e) {
				A = null;
			}
		}
		else {
			A = null;
		}
	}
	return A;
}


function XMLHTTPSend( url, data ) {
	
	if (XMLActive) return;
	xmlobj=XMLHTTPObject();
	if( !xmlobj ) return;
	xmlobj.onreadystatechange = function() {
		XMLActive=true;
		if (xmlobj.readyState != 4)  return;
		displayResults(xmlobj.responseText);
		XMLActive=false;
	}


	xmlobj.open("POST", url, true);
	xmlobj.setRequestHeader("Method", "POST " + url + " HTTP/1.1");
	xmlobj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlobj.send(data);
	return true;
}

function getObject(t) {
	var obj;
	if(document.getElementById) {
		obj=document.getElementById(t);
	}
	else if(document.all) {
		obj=document.all[t];
	}
	else {
		obj=false;
	}
	return obj;
}

function displayResults( t ) {
	
	if( t != '0' ) {
		obj = getObject( 'ratethis' );
		obj.innerHTML = t;
	}
}

//initialization

XMLActive = false;

