function wR(_1,_2,_3,_4){
	var _5=document.getElementById("w"+_1);
	var _4=_4||window.event;
	sbHandler.prediction=_3;
	RatingManager.handleMouseover(_4,_5);
}

function RatingElementHandler(_6,_7,_8){
	this.value=_6;
	this.onSrc=this.imageRoot+_7;
	this.offSrc=this.imageRoot+_8;
}

RatingElementHandler.prototype.load=function(_9){
	this.element=_9;
	this.defaultSrc=_9.src;
	this.onload();
};

RatingElementHandler.prototype.unload=function(){
	this.onunload();
	this.element=null;
};

RatingElementHandler.prototype.updatemouseout=function(_10){
	if(this.element){
		this.element.src=this.defaultSrc;
	}
};

RatingElementHandler.prototype.updatemouseover=function(_11){
	if(this.element){
		if(_11==this.element){
			this.element.src=this.onSrc;
		}else{
			this.element.src=this.offSrc;
		}
	}
};

RatingElementHandler.prototype.updateclick=function(_12){
	if(this.element){
		if(_12==this.element){
			this.persistValue(this.value);
			this.defaultSrc=this.onSrc;
		}else{
			this.defaultSrc=this.offSrc;
		}
		this.element.src=this.defaultSrc;
	}
};

RatingElementHandler.prototype.persistValue=function(){
	//var loc=STARBAR_SET_PAGE+"&widgetid="+this.widgetID+"&value="+this.value;

    var type = this.widgetID.substr(this.widgetID.lastIndexOf('_')+1);
    var id = this.widgetID.substr(1, this.widgetID.lastIndexOf('_')-1);

    var loc = '/rate/save/type/' + type + '/id/' + id + '/rating/' + this.value

	/*if(window.encodeURIComponent){
		loc+=encodeURIComponent(location.href);
	}else{
		loc+=escape(location.href);
	}*/
	var _14=false;
	if(window.duplicateWidgetId){
		movieAndWid=this.widgetID.split("_");
		movie=movieAndWid[0];
		if(movie==duplicateWidgetId){
			_14=true;
		}
	}
	/*if(!forcePgRefresh&&!_14){
		loc+="&ncok=true";
	}*/
	RatingElementHandler.prototype.lastPersistLocation=loc;
	RatingManager.RatingNotifier.notify(this.widgetID,this.value);
	//window.location.href=loc;
	saveRating(loc);
};

RatingElementHandler.prototype.onload=function(){};
RatingElementHandler.prototype.onunload=function(){};

if(window.STARBAR_IMG_ROOT){
	RatingElementHandler.prototype.imageRoot=STARBAR_IMG_ROOT;
}else{
	RatingElementHandler.prototype.imageRoot="http://www.indycar.com/modules/images/stars/";
}

var sbHandler=new RatingElementHandler(null,null,"stars_1_0.gif");
sbHandler.value=-1;
sbHandler.sbOffsets=[18,37,56,75,94];
//sbHandler.sbOffsets=[-172,-153,-134,-115,-96]
sbHandler.displayStrings=["","Hated It","Didn't Like It","Liked It","Really Liked It","Loved It"];
sbHandler.sbImages=[new Image()];
sbHandler.sbImages[0].src=sbHandler.imageRoot+"stars_1_0.gif";
sbHandler.STD_STARBAR_SRC=sbHandler.imageRoot+"stars_";
for(var i=1;i<6;i++){
	sbHandler.sbImages[i]=new Image();
	sbHandler.sbImages[i].src=sbHandler.imageRoot+"stars_1_"+i+"0.gif";
}
sbHandler.offSrc=sbHandler.sbImages[0].src;

sbHandler.updatemouseover=function(_15){
	if(_15!=this.element){
		if(_15.id.substring(0,2)=="cr"){
			this.element.src=this.getPredictionSrc();
		}else{
			this.element.src=this.offSrc;
		}
	}
};

sbHandler.updatemouseout=function(_16){
	if(this.element){
		this.value=-1;
		this.element.src=this.defaultSrc;
	}
};
sbHandler.onload=function(){
	if(this.element.onmousemove!=null){
		return;
	}
	var _17=this;
	this.element.onmousemove=function(evt){
		var evt=evt||window.event;
		_17.showStars(evt);
	};
};
sbHandler.onunload=function(){
	if(this.element){
		this.element.onmousemove=null;
	}
};
sbHandler.showStars=function(evt){
	var _19=this.getStarCount(evt);
	if(_19==this.value){
		return;
	}
	this.element.src=this.sbImages[_19].src;
	this.setDisplayString(_19);
	this.value=_19;
};
sbHandler.updateclick=function(_20){
	if(this.element){
		if(_20==this.element){
			this.persistValue();
			this.defaultSrc=this.sbImages[this.value].src;
		}else{
			if(_20.id.substring(0,2)=="cr"){
				this.defaultSrc=this.getPredictionSrc();
			}else{
				this.defaultSrc=this.offSrc;
			}
		}
		this.element.src=this.defaultSrc;
	}
};
sbHandler.getStarCount=function(evt){
	var xC=-1;
	if(evt.offsetX){
		xC=evt.offsetX;
	}else{
		if(this.element.offsetX!=null){
			eXC=this.element.offsetX;
			xC=evt.layerX-eXC;
		}else{
			if(evt.layerX){
				eXC=getOffsetX(this.element);
				xC=evt.layerX-eXC;
				this.element.offsetX=eXC;
			}
		}
	}
	for(var i=0;i<5;i++){
		if(xC<=this.sbOffsets[i]){
			return i+1;
		}
	}
	return 0;
};
sbHandler.setDisplayString=function(_23){
	this.element.alt=this.element.title="Click to rate \""+this.displayStrings[_23]+"\"";
};
sbHandler.getPredictionSrc=function(){
	return this.STD_STARBAR_SRC+this.prediction+".gif";
};
var noOpinionHandler=new RatingElementHandler("noseen","nop_high.gif","nop_low.gif");
var notInterestedMiniHandler=new RatingElementHandler("norec","nim_high.gif","nim_low.gif");
var notInterestedHandler=new RatingElementHandler("norec","ni_high.gif","ni_low.gif");
var clearRatingsHandler=new RatingElementHandler("clear","clear_high.gif","clear_low.gif");
clearRatingsHandler.updateclick=function(_24){
	if(this.element){
		if(_24==this.element){
			this.persistValue();
		}
	}
};
var RatingManager={
	containerElement:null,
	handlers:{
		st:sbHandler,
		no:noOpinionHandler,
		ni:notInterestedHandler,
		nm:notInterestedMiniHandler,
		cr:clearRatingsHandler
	},
	attachToClass:function(_25){
		var _26=getElementsByClass(_25);
		var _27=/^wM-/i;
		var _28=this;
		var n=_26.length;
		for(var i=0;i<n;i++){
			if(_27.test(_26[i].id)){
				continue;
			}
			_26[i].onmouseover=function(evt){
				var evt=evt||window.event;
				_28.handleMouseover(evt,this);
			};
		}
	},
	handleMouseover:function(evt,_30){
		if(!this.containerElement||this.containerElement!=_30){
			this.containerElement=_30;
			this.setEventHandlers();
			this.unloadHandlers();
			this.loadHandlers();
			RatingElementHandler.prototype.widgetID=_30.id.substring(1);
		}
		this.updateObservers(evt);
	},
	setEventHandlers:function(){
		var _31=this;
		var _32=function(evt){
			var evt=evt||window.event;
			_31.updateObservers(evt);
		};
		this.containerElement.onmouseout=_32;
		this.containerElement.onclick=_32;
	},
	unloadHandlers:function(){
		for(key in this.handlers){
			this.handlers[key].unload();
		}
	},
	loadHandlers:function(){
		var _33=this.containerElement.getElementsByTagName("IMG");
		var l=_33.length;
		for(var i=0;i<l;i++){
			var _35=_33[i].id.substring(0,2);
			var _36=this.handlers[_35];
			if(_36){
				_36.load(_33[i]);
			}
		}
	},
	updateObservers:function(evt){
		var _37=this.getTarget(evt,"IMG");
			if(_37){
				var _38="update"+evt.type;
				for(key in this.handlers){
					this.handlers[key][_38](_37);
				}
			}
	},
	getTarget:function(evt,_39){
		if(evt.target){
			targ=evt.target;
		}else{
			if(evt.srcElement){
				targ=evt.srcElement;
			}
		}
		if(targ.nodeType==3){
			targ=targ.parentNode;
		}
			if(targ.tagName==_39){
			return targ;
		}
	},
	registerRatingCallback:function(_40,_41){
		if(arguments.length==2){
			this.RatingNotifier.subscribe(_40,_41);
		}else{
			this.RatingNotifier.subscribe(_40);
		}
	},
	RatingNotifier:{
		cbFunctions:{all:new Array()},
		subscribe:function(_42,_43){
			if(arguments.length==2){
				if(this.cbFunctions[_43]){
					this.cbFunctions[_43][this.cbFunctions[_43].length]=_42;
				}else{
					this.cbFunctions[_43]=new Array(_42);
				}
			}else{
				this.cbFunctions.all[this.cbFunctions.all.length]=_42;
			}
		},
		notify:function(_44,_45){
			var _46=_44.substring(1,_44.indexOf("_"));
			for(var i=0;i<this.cbFunctions.all.length;i++){
				this.cbFunctions.all[i](_46,_45);
			}
			if(this.cbFunctions[_46]){
				var _47=this.cbFunctions[_46];
				for(var i=0;i<_47.length;i++){
					_47[i](_46,_45);
				}
			}
		}
	}
};
function getElementsByClass(_48){
	var _49=document.getElementsByTagName("*");
	var _50=new Array();
	var i;
	var j;
	for(i=0,j=0;i<_49.length;i++){
		var c=" "+_49[i].className+" ";
		if(c.indexOf(" "+_48+" ")!=-1){
			_50[j++]=_49[i];
		}
	}
	return _50;
}
function StarbarFillInAll(){}

function getElementOffsetX(_21){
	var _22=0;
	if(_21.offsetLeft!=null){
		_22+=_21.offsetLeft;
		while(_21.offsetParent){
			_22+=_21.offsetParent.offsetLeft;
			_21=_21.offsetParent;
		}
	}
	return _22;
}

function getOffsetX(node) {
    var result = node.offsetLeft;
    return result;
}