/* - eShopperForum.com Ratings Widget
For current version, usage instructions, and other help, 
visit http://www.eshopperforum.com/starWidget/

This code is protected by copyright and may not be used
for any other purpose than permitted by the terms
of use of the Ragings Widget (copyright) powered by
eshopperforum.com

*/

var rTdoc=document;

function init(){
   if(!rTdoc.rTix) rTdoc.rTix=0;
   if(!rTdoc.rTdata) rTdoc.rTdata=new Object();
   rTdoc.rTix++;
   var ix=rTdoc.rTix;

   rTdoc.rTdata[ix]={
	ix : rTdoc.rTix,
	w  : (window["starWidget_width"] ? starWidget_width : 100),
	h  : (window["starWidget_height"] ? starWidget_height : 30),
	ip : (window["starWidget_imagePath"] ? starWidget_imagePath : 'http://www.starwidget.com/starimages/star_'),
	to : '',
	ih : '',
	ua : navigator.userAgent,
	a  : true,
	href: window.location.href,
	url : window["starWidget_url"] ? starWidget_url : window.location.href,
	mask: window["starWidget_mask"] ? starWidget_mask : ''
		};
   var data=rTdoc.rTdata[ix];
   document.write("<script type=\"text/javascript\" src=\"http://www.starwidget.com/perl/starWidget.js?u=" + escape(data.url)+ "&m=" + escape(data.mask) + "&rand="+ Math.random() +"&ua="+ url_escape(data.ua) + "&i="+data.ix+"\"><\/script>");

}

function starWidget(rating) {
   var ix=rTdoc.rTix;
   var D=document.getElementById('starWidgetDiv');
   if (!D) return false;
   D.style.position='Relative';
   D.style.border='none';
   D.style.margin='0px';
   D.style.padding='0px';
   D.style.overflow='hidden';
   D.id="starWidgetDiv_"+ix;
   var data=rTdoc.rTdata[ix];
   data.ih=url_escape(D.innerHTML.toLowerCase());
   var html='';
   if (rating.voted){
      html="<img id=\"starWidgetImgId_" + data.ix + "\" border=\"0\" style=\"margin: 0px; padding: 0px; border: none;\" width=\"" + data.w + "\" height=\"" + data.h + "\" src=\"" + data.ip + rating.score + "_" + rating.yourscore + ".png\" alt=\""+rating.votes+" Votes\" title=\""+rating.votes+" Votes\"/>\n";
   }else{
      html="<img id=\"starWidgetImgId_" + data.ix + "\" border=\"0\" style=\"margin: 0px; padding: 0px; border: none;\" width=\"" + data.w + "\" height=\"" + data.h + "\" src=\"" + data.ip + rating.score + "_r.png\" usemap=\"#starWidgetMap_" + data.ix + "\" alt=\""+rating.votes+" Votes\" title=\""+rating.votes+" Votes\"/>\n";
      html += "<map id=\"starWidgetMap_" + data.ix + "\" name=\"starWidgetMap_" + data.ix + "\">\n";
      for(var j=0; j <= 9; j++){
         var x1=Math.round(data.w*j/10);
         var x2=Math.round(data.w*(j+1)/10)-1;
         html += "<area shape=\"rect\" coords=\"" + x1 + ",0," + x2 + "," + data.h + "\" href=\"javascript:"+rating.func+"("+j+")\" onmouseover=\"mover(" + j + "," + data.ix + ")\" onmouseout=\"mout('" + rating.score + "'," + data.ix + ")\"  alt=\""+rating.votes+" Votes\" title=\""+rating.votes+" Votes\"/>\n";
      }
      html += "</map>\n";
   }
   D.innerHTML=html;
   if (typeof document.createElementNS != 'undefined'){
      cMdiv=document.createElementNS("http://www.w3.org/1999/xhtml","div");
   }else{
      cMdiv=document.createElement("div");
   }
   cMdiv.style.position='absolute';
   cMdiv.style.padding='2px';
   cMdiv.style.fontSize='10pt';
   cMdiv.style.border='1px solid #808080';
   cMdiv.style.backgroundColor='#e0e0e0';
   cMdiv.style.visibility='hidden';
   cMdiv.style.zIndex='100';
   cMdiv.style.textAlign='left';
   cMdiv.style.width='150px';
   cMdiv.innerHTML='Stars Widget by<br/><a href="http://www.StarWidget.com/">StarWidget.com</a>';
   D.parentNode.insertBefore(cMdiv,D);
   D.oncontextmenu=function(e) { if(!e) { e=window.event } cMdiv.style.visibility="visible"; return false;};
   document.onclick=function() {cMdiv.style.visibility="hidden"; };
}

function mover(s,i) {
   var data=rTdoc.rTdata[i];
   if (data.to) clearTimeout(data.to);
   var I=document.getElementById("starWidgetImgId_"+i);
   if (data.a) I.src=data.ip + s + "_r.png";
}

function mout(s,i) {
   rTdoc.rTdata[i].to=setTimeout("mover('" + s + "'," + i + ");",100);
}

function url_escape(a){ if (!rTdoc.rTc){ rTdoc.rTc=[]; for( var i=0; i < 256; i++){ var b=i; for(var j=0; j < 8; j++) b = b & 1 ? 3988292384 ^ (b >>> 1) : b >>> 1; rTdoc.rTc[i]=b; } } var c=-1; for( var i=0 ; i < a.length ; i++ ) c=(c >>> 8) ^ rTdoc.rTc[(c ^ a.charCodeAt(i)) & 255]; c=~c; var h=''; for (var i=0; i<4; i++){ var g=(c & 255).toString(16); h=g.length==1 ? "0"+g+h: g+h; c=c >>> 8; } return h; }

init();


