function ajaxSubmit(url, processingDiv, targetDiv)
{
targetArea = document.getElementById(targetDiv);
processingArea = document.getElementById(processingDiv);

var xmlHttp;
try
{ xmlHttp=new XMLHttpRequest(); }
catch (e)
{
 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;
     }
   }
 }

xmlHttp.onreadystatechange=function()
 {
  if(xmlHttp.readyState==4)
   {
    LockStars(document.getElementById('idItem').value, xmlHttp.responseText);
    processingArea.style.display = 'none';
    //targetArea.innerHTML = xmlHttp.responseText;
   }
}

processingArea.style.display = 'block';
xmlHttp.open('GET',url,true);
xmlHttp.send(null);
}

function SubmitVote(vote, item)
{
var poststr = '/rating.php' +
'?idPhone=' +  item +
'&rating=' +  vote;

//LockStars(item, vote);
ajaxSubmit(poststr, 'processingDiv-'+item, 'ratingDiv-'+item);
}

function HoverStars(item, star)
{
var starCount;
for (starCount=1; starCount<=star; starCount++)
 document.getElementById('ratings-'+item+'-'+starCount.toString()).className = 'starOn';
for (starCount=star+1; starCount<=5; starCount++)
 document.getElementById('ratings-'+item+'-'+starCount.toString()).className = 'starOff';
}

function LockStars(item, star)
{
  var starCount;
  for (starCount=1; starCount<=5; starCount++)
  {
  document.getElementById('ratings-'+item+'-'+starCount.toString()).onmouseover = null;
  document.getElementById('ratings-'+item+'-'+starCount.toString()).onmouseout = null;
  document.getElementById('ratings-'+item+'-'+starCount.toString()).onmouseup = 'javascript:void(0);';
  }
  for (starCount=1; starCount<=star; starCount++)
    document.getElementById('ratings-'+item+'-'+starCount.toString()).className = 'starOn';

  for (starCount=star+1; starCount<=5; starCount++)
    document.getElementById('ratings-'+item+'-'+starCount.toString()).className = 'starOff';

}
