var timeoutHandle=0;
function highlight(itemid,itemtype,scoreval){
	if (timeoutHandle){
		clearTimeout(timeoutHandle);
	}
	for (i=1;i<5;i++){
		document.getElementById(itemtype+""+itemid+"-"+i).src="site_img/star-black.png";
	}
	for (i=1;i<=scoreval;i++){
		document.getElementById(itemtype+""+itemid+"-"+i).src="site_img/star-purple.png";
	}
}
function showScoreResult(itemid,itemtype,res){
	//alert(res);
	var p = eval("("+res+")");
	document.getElementById("container-"+itemtype+""+itemid).innerHTML=p.stars;
	document.getElementById("container-votes-"+itemtype+""+itemid).innerHTML=p.votes;
}
function saveScore(itemid,itemtype,scoreval,numeric){
 var xmlHttp=null; // Defines that xmlHttp is a new variable.
 document.getElementById("container-"+itemtype+""+itemid).innerHTML="Prebieha ukladanie Vášho hlasu...";
// Try to get the right object for different browser
 try {
    // Firefox, Opera 8.0+, Safari, IE7+
    xmlHttp = new XMLHttpRequest(); // xmlHttp is now a XMLHttpRequest.
 } catch (e) {
    // Internet Explorer
    try {
       xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
       xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
 }
xmlHttp.onreadystatechange = function() {
    if (xmlHttp.readyState == 4)
       try { // In some instances, status cannot be retrieved and will produce an error (e.g. Port is not responsive)
          if (xmlHttp.status == 200) {
             //Set the main HTML of the body to the info provided by the AJAX Request
		response=xmlHttp.responseText;
		showScoreResult(itemid,itemtype,response);
		}
       } catch (e) {
       		//alert(e.message);
	}
 
 }
try{
xmlHttp.open("get",XMLHttpActiveDomain+"saveScore.php?item="+itemid+"&type="+itemtype+"&value="+scoreval+"&numeric="+numeric); // .open(RequestType, Source);
xmlHttp.send(null); // Since there is no supplied form, null takes its place as a new form.
}catch (e){
	//alert(e.message+XMLHttpActiveDomain);
}
return false;
}