aVoteWords = Array ("Poor", "Nothing special", "Worth watching", "Pretty cool", "Awesome!");
	
function voteMouseOver (ev, aid, isvoted) {
  if (isvoted == true) {
    $("actorVoteInfo"+aid).innerHTML = "You have already rated.";
    $("actorVoteInfo"+aid).focus();
    return;
  }
  $("actorLinkVote"+aid).style.background="url('images/r10.gif')"
  var x = ev.layerX | ev.offsetX;
  var rate = Math.ceil(x/100*5);
  x = 20*rate;
  $("actorVote"+aid).style.clip='rect(auto auto auto '+x+'px)';
  if (aVoteWords[rate-1]!=undefined) {
    $("actorVoteInfo"+aid).innerHTML = aVoteWords[rate-1];
  }
  $("actorVoteInfo"+aid).focus();
  return false;
}

function voteMouseOut (ev, aid, x, y, j) {
  $("actorVote"+aid).style.clip='rect(auto auto auto '+x+'px)';
  $("actorVoteInfo"+aid).innerHTML = y;
  if (j < 10) {
    $("actorLinkVote"+aid).style.background="url('images/rx10.gif')"
  }
  return false;
}
	
function sendVote (ev, aid) {
  if ($("actorLinkVote"+aid).onmouseout == null) {
  	return false;
  }
  $("actorLinkVote"+aid).onmouseout  = null
  $("actorLinkVote"+aid).onmousemove = null
  var x = ev.layerX | ev.offsetX;
  var rate = Math.ceil(x/100*5);
  new Ajax.Request('?ajax=1&act=rateactor&aid='+aid+"&v="+rate, {
  method: 'get',
  onSuccess: function(transport) {
  	//alert (transport.responseText);
    if (transport.responseText.match (/^ERROR/)) {
      alert (transport.responseText);
    } else {
      $("actorVoteInfo"+aid).voted = true;
      try {
      	eval (transport.responseText);
      } catch (e) {
        alert (e);
      }
    }
  },
  onFailure : function (transport) {
  	alert ("Ooops. Could not process your request now. Please try again later.");
  }
  });
}

