var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
  xmlhttp = new XMLHttpRequest();
}


function star(id,iset,c,v) {
var imgString;
var theImg;
var url;
var myv;
imgString = 'myv = id'+id+';';
eval(imgString);

switch (iset)
{
case 0:
 for (i = 1; i <= 5; i++) {
  imgString = 'theImg = document.getElementById("s'+i+'-'+id+'")';
  eval(imgString);
   if (v>=i) { theImg.src='/images/rstar.gif'; } else { theImg.src='/images/gstar.gif'; }
   if (myv>=i) { theImg.src='/images/ystar.gif'; } else { if (v>=i) { theImg.src='/images/rstar.gif'; } else { theImg.src='/images/gstar.gif'; } }
 }
  window.status='';
  break
case 1:
 for (i = 1; i <= 5; i++) {
  imgString = 'theImg = document.getElementById("s'+i+'-'+id+'")';
  eval(imgString);
  if (c>=i) {  theImg.src='/images/ystar.gif'; } else { theImg.src='/images/gstar.gif'; }
 }
  switch (c) {
   case 1: window.status='One Jolly Roger!';
   break;
   case 2: window.status='Two Jolly Rogers!';
   break;
   case 3: window.status='Three Jolly Rogers!';
   break;
   case 4: window.status='Four Jolly Rogers!';
   break;
   case 5: window.status='Five Jolly Rogers!';
   break;
  }
  break
case 2:
  window.status='Voted '+c+' stars!';
  imgString = 'id'+id+' = '+c+';';
  eval(imgString);
  url='http://' + window.location.host + '/vote.asp?j=y&v='+c+'&id='+id;
  xmlhttp.open("GET",url,true);
  xmlhttp.onreadystatechange=function() {
   if (xmlhttp.readyState==4) {
    window.status='Thanks for voting!';
    //window.status=xmlhttp.responseText;
   }
  }
  xmlhttp.send()

  break
}

}

function votes(id,v) {
var c;
for (i = 1; i <= 5; i++) {
 if (v>=i) { c='r'; } else { c='g'; }
 document.write('<img id=s'+i+'-'+id+' src="/images/' + c + 'star.gif" onClick="star('+id+',2,'+i+',0);" onmouseover="star('+id+',1,'+i+',0);" onmouseout="star('+id+',0,'+i+','+v+');">');
}
}
