
var fullImgPath="http://stat1.studijuok.lt/lib/ratingImage/star.png";var emptyImgPath="http://stat1.studijuok.lt/lib/ratingImage/empstar.png";var activeImagePath="http://stat1.studijuok.lt/lib/ratingImage/over.png";var rElemID="rTxt";var ratingLength=5;function rOut(elem,rating)
{var resSplit=elem.id.split("_",3);for(i=0;i<=resSplit[2];i++)
document.getElementById(resSplit[0]+"_"+resSplit[1]+"_"+i).src=(i<rating)?fullImgPath:emptyImgPath;}
function rOver(elem)
{var resSplit=elem.id.split("_",3);for(i=0;i<=resSplit[2];i++)
document.getElementById(resSplit[0]+"_"+resSplit[1]+"_"+i).src=activeImagePath;}
function rClick(elem)
{var resSplit=elem.id.split("_",3);var value=parseInt(resSplit[2])+1;var item_id=resSplit[1];var xmlHttp;try{xmlHttp=new XMLHttpRequest();}
catch(e){try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}}
xmlHttp.onreadystatechange=function()
{if(xmlHttp.readyState==4)
{if(xmlHttp.responseText=='0')
{location.href='/usr/login.php';return false;}
var myResultSplit=xmlHttp.responseText.split(";",2);document.getElementById(rElemID+"_"+item_id).innerHTML=myResultSplit[0];for(i=0;i<ratingLength;i++)
{var element=document.getElementById(resSplit[0]+"_"+item_id+"_"+i);element.onclick='';element.onmouseover='';element.onmouseout='';element.src=(i<=value)?activeImagePath:emptyImgPath;}}}
if(value>0&&item_id>0)
{xmlHttp.open("GET","/lib/vote.php?item_id="+item_id+"&val="+value+"&"+Math.random(),true);xmlHttp.send(null);}}
