function GetXmlHttpObject() {
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	} catch (e) {
		// Internet Explorer
		try {
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	return xmlHttp;
}

ratingxmlhttp=GetXmlHttpObject();


function rateItem(ratinglink) {
	ratingxmlhttp.onreadystatechange=ratingStateChanged;
	ratingxmlhttp.open("GET", ratinglink,true);
	ratingxmlhttp.send(null);	
}

function ratingStateChanged() {
	if (ratingxmlhttp.readyState==4) {
		document.getElementById("ratingspan").innerHTML+="<br />Thanks for your rating!";
		
		// prevent accidental double-clicks, etc.
		document.getElementById("rate1").href="#";
		document.getElementById("rate2").href="#";
		document.getElementById("rate3").href="#";
		document.getElementById("rate4").href="#";
		document.getElementById("rate5").href="#";
		document.getElementById("rate5").href="#";
		// ---------------------------------------
		
		document.getElementById("current-rating").style.width=ratingxmlhttp.responseText+"%";

	}
}
