var ratePostId = 0;

function getHTTPObject() {
	if (typeof XMLHttpRequest != 'undefined') {
		return new XMLHttpRequest();
	}
	
	try
	{
		return new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch (e) {
		try
		{
			return new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (e) { }
	}
	
	return false;
}

var http = getHTTPObject();

function handleHttpResponse() {
	if (http.readyState == 4) {
		var temp = http.responseText;
		document.getElementById("rater_"+ratePostId).innerHTML=temp;
	}
}

function hideRater( postid ) {
	document.getElementById("rater_"+postid).style.display = "none";
	document.getElementById("arvostelijat_"+ratePostId).style.display = "inline";
}

function LoadData( url, postid ){
	ratePostId = postid;
	
	document.getElementById("arvostelijat_"+ratePostId).style.display = "none";
	document.getElementById("rater_"+ratePostId).innerHTML = "Odota hetki...";
	document.getElementById("rater_"+ratePostId).style.display = "block";
	
	http.open("GET", url, true);
	http.onreadystatechange = handleHttpResponse;
	http.send(null);
}