var AXIS_X=0;
var AXIS_Y=1;

function getNode(id){
	return document.getElementById(id);
}

function killNode(NodeName){
	var NodeObj=getNode(NodeName);
	var NodeParent=NodeObj.parentElement;
	if(typeof NodeParent!="undefined"){
		NodeParent.removeChild(NodeObj);
	}else{
		NodeObj.style.display="none";
	}
}

function swapTextNode(OldNode,NewNode){
	OldNode.replaceChild(document.createTextNode(NewNode),OldNode.firstChild);
}

function replaceInnerText(Element,content){
	if(typeof Element.childNodes!="undefined"&&Element.childNodes.length>0){
		var NewNode=document.createTextNode(content);
		Element.replaceChild(NewNode,Element.firstChild);
	}else{
		Element.innerHTML=content;
	}
}

function grabComputedStyle(_10){
	if(document.defaultView&&document.defaultView.getComputedStyle){
		return document.defaultView.getComputedStyle(_10,null);
	}else{
		if(_10.currentStyle){
			return _10.currentStyle;
		}else{
			return null;
		}
	}
}

function grabComputedHeight(_11){
	var _12=grabComputedStyle(_11).height;
	if(_12!=null){
		if(_12.indexOf("px")!=-1){
			_12=_12.substring(0,_12.indexOf("px"));
		}
		if(_12=="auto"){
			if(_11.offsetHeight){
				_12=_11.offsetHeight;
			}
		}
	}
	return _12;
}

function getEventTarget(evt){
	var tgt=evt.srcElement;
	if(!tgt){
		tgt=evt.target;
	}
	return tgt;
}

function getWindowHeight(){
	var _15=0;
	if(typeof (window.innerWidth)=="number"){
		_15=window.innerHeight;
	}else{
		if(document.documentElement&&document.documentElement.clientHeight){
			_15=document.documentElement.clientHeight;
		}else{
			if(document.body&&document.body.clientHeight){
				_15=document.body.clientHeight;
			}
		}
	}
	return _15;
}

function clearRanges(_16){
	if(isMacIE){
	}else{
		if(isSafari){
			_16.stopPropagation();
		}else{
			if(document.selection){
				document.selection.empty();
			}else{
				if(window.getSelection()){
					window.getSelection().removeAllRanges();
				}else{
					_16.stopPropagation();
				}
			}
		}
	}
}

function getDocumentScrollAmount(){
	if(!isSafari){
		return document.body.scrollTop;
	}else{
		return 0;
	}
}

function getElementOffsetY(_17){
	var _18=0;
	if(_17.offsetTop!=null){
		_18+=_17.offsetTop;
		while(_17.offsetParent){
			_18+=_17.offsetParent.offsetTop;
			_17=_17.offsetParent;
		}
	}
	return _18;
}

function getElementMouseCoordinate(evt,_19){
	var xC=-1;
	if(!evt){
		var evt=window.event;
	}
	if(evt.offsetX){
		xC=evt.offsetX;
	}else{
		if(_19.offsetX!=null){
			eXC=_19.offsetX;
			xC=evt.layerX-eXC;
		}else{
			if(evt.layerX){
				eXC=getElementOffsetX(_19);
				xC=evt.layerX-eXC;
				_19.offsetX=eXC;
			}
		}
	}
	return xC;
}

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 getNodeTop(_23){
	var _24=document.getElementById(_23);
	var _25=_24.style.top?(_24.offsetTop-stripUnits(_24.style.top)):_24.offsetTop;
	return _25;
}

function moveNode(_26,_27){
	if(typeof _26=="string"){
		_26=getNode(_26);
	}
	if(_26.style.top){
		_26.style.top=stripUnits(_26.style.top)+_27+"px";
	}else{
		_26.style.top=(_27)+"px";
	}
}

function displayObject(obj){
	var msg="";
	for(var _30 in obj){
		msg+=_30;
		msg+=": ";
		msg+=_30.value;
		msg+="\n";
	}
	window.alert(msg);
}

function tokenizeString(_31,_32){
	var _33=new Array();
	var cnt=0;
	if(_31){
		while(_31.indexOf(_32)!=-1){
			var end=_31.indexOf(_32);
			var _36=end+_32.length;
			_33[cnt]=_31.substring(0,end);
			_31=_31.substring(_36);
			cnt++;
		}
		_33[cnt]=_31;
	}
	return _33;
}

function xmlRequest(){
	if(window.XMLHttpRequest){
		req=new XMLHttpRequest();
		req.isDOM=true;
		return req;
	}else{
		if(window.ActiveXObject){
			req=new ActiveXObject("Microsoft.XMLHTTP");
			return req;
		}else{
			return null;
		}
	}
}

function isXMLReady(XMLHttpObj){
	return (XMLHttpObj.readyState==4&&XMLHttpObj.status==200);
}

function getElementHeightMidpoint(_38,_39){
	var _40=grabComputedHeight(_38);
	if(_40==null){
		return null;
	}else{
		var _41=""+_40;
		if(_41.indexOf("px")!=-1){
			_40=_41.substring(0,_40.indexOf("px"));
		}
	}
	return _40/2;
}

function createNFTextNode(_42){
	var _43=tokenizeString(_42,"%%~p;");
	var _44=document.createElement("SPAN");
	for(var ii=0;ii<_43.length;ii++){
		_44.appendChild(document.createTextNode(_43[ii]));
		if(ii+1<_43.length){
			_44.appendChild(document.createElement("P"));
		}
	}
	return _44;
}

function getMouseCoordinates(e){
	var _47=0;
	var _48=0;
	if(!e){
		var e=window.event;
	}
	if(e.pageX||e.pageY){
		_47=e.pageX;
		_48=e.pageY;
	}else{
		if(e.clientX||e.clientY){
			_47=e.clientX+document.body.scrollLeft;
			_48=e.clientY+document.body.scrollTop;
		}
	}
	return {x:_47,y:_48};
}

var ServerConnectionFactory={getConnection:function(){
	return new ServerConnection();
}};

function ServerConnection(){
	this.method=ServerConnection.METHOD_GET;
	this.returnType=ServerConnection.RETURN_XML;
	this.setTransport();
}

ServerConnection.METHOD_GET="GET";
ServerConnection.METHOD_POST="POST";
ServerConnection.RETURN_XML="XML";
ServerConnection.RETURN_TEXT="TEXT";

ServerConnection.prototype={parameters:{},transportStates:["Uninitialized","Loading","Loaded","Interactive","Complete"],setTransport:function(){
		this.transport=false;
		tryTransports=[];
		tryTransports.push(function(){
			return new ActiveXObject("Msxml2.XMLHTTP");
		});
		tryTransports.push(function(){
			return new ActiveXObject("Microsoft.XMLHTTP");
		});
		tryTransports.push(function(){
			return new XMLHttpRequest();
		});
		for(var i=0;i<tryTransports.length;i++){
			try{
				this.transport=tryTransports[i]();
				break;
			}catch(e){}
		}
		if(this.transport){
			this.bindStateChangeHandler();
		}
	},bindStateChangeHandler:function(){
		oThis=this;
		this.transport.onreadystatechange=function(){
			oThis.handleReadyStateChange();
		};
	},handleReadyStateChange:function(){
		if(this.transportStates[this.transport.readyState]=="Complete"){
			if(this.transport.status=="200"){
				this.successCallback(this.returnType==ServerConnection.RETURN_XML?this.transport.responseXML:this.transport.responseText);
			}else{
				this.failureCallback(this.transport.status,this.url);
			}
		}
	},fixMozillaContentLength:function(){
		if(this.transport&&this.transport.overrideMimeType){
			this.transport.setRequestHeader("Connection","close");
		}
	},getQueryString:function(){
		var s="";
		var _51=true;
		for(param in this.parameters){
			if(typeof this.parameters[param]!="function"){
				if(!_51){
					s+="&";
				}
				s+=param+"="+this.parameters[param];
				_51=false;
			}
		}
	return s;
	},execute:function(){
		if(this.transport){
			var _52=null;
			if(this.method==ServerConnection.METHOD_GET){
				var _53=this.getQueryString();
				if(_53.length>0){
					this.url+="?"+this.getQueryString();
				}
			}
			//alert("this.url: " + this.url);
			this.transport.open(this.method,this.url,true);
			if(this.method==ServerConnection.METHOD_POST){
				_52=this.getQueryString();
				this.transport.setRequestHeader("Content-type","application/x-www-form-urlencoded");
				this.fixMozillaContentLength();
			}
			this.transport.send(_52);
		}
	},setParameters:function(_54){
		this.parameters=_54;
	},successCallback:function(){
	},failureCallback:function(_55,url){
	}};
	
function Movie(){}

//JAS Mod
Movie.prototype={id:false,parentID:false,title:false,synopsis:false,rating:false,year:false,genreID:false,genre:false,CMURate:false,CMPred:false,CMWgtR:false,starring:[],director:false,friendRated:false,recommended:false,importFrom:function(_57){
	var _58=/&#38;/g;
	for(field in this){
		_57[field]&&(this[field]=_57[field]());
		if(typeof this[field]=="string"){
			//alert("this[field]: " + this[field]);
			this[field]=this[field].replace(_58,"&");
		}
		if(this[field]=="false"){
			this[field]=false;
		}
	}
}};

function Person(_59,id){
	this.name=_59;
	this.id=id;
}

MovieXMLImporter=function(_61){
	this.xmlDoc=_61;
	this.detailsNode=null;
	this.glyphNode=null;
	this.setDetailsNode();
	this.setGlyphNode();
};

MovieXMLImporter.prototype={getAttribute:function(objNode,Name){
		try{
			var s=objNode.getAttribute(Name);
			if(s.length>0){
				return s;
			}
		}catch(e){}
		return false;
	},setDetailsNode:function(){
		try{
			this.detailsNode=this.xmlDoc.getElementsByTagName("DETAILS")[0];
		}catch(e){}
	},setGlyphNode:function(){
		try{
			this.glyphNode=this.xmlDoc.getElementsByTagName("GLYPH")[0];
		}catch(e){}
	},id:function(){
		return this.getAttribute(this.xmlDoc.getElementsByTagName("MOVIE")[0],"ID");
	},parentID:function(){
		return this.getAttribute(this.xmlDoc.getElementsByTagName("MOVIE")[0],"PARENTID");
	},title:function(){
		return this.xmlDoc.getElementsByTagName("TITLE")[0].firstChild.nodeValue;
	},synopsis:function(){
		return this.xmlDoc.getElementsByTagName("SYNOPSIS")[0].firstChild.nodeValue;
	},rating:function(){
		return this.getAttribute(this.detailsNode,"RATED");
	},year:function(){
		return this.getAttribute(this.detailsNode,"RELYEAR");
	},genreID:function(){
		return this.getAttribute(this.detailsNode,"GENREID");
	},genre:function(){
		return this.getAttribute(this.detailsNode,"GENRENAME");
	},CMURate:function(){
		return this.getAttribute(this.detailsNode,"CMURATE");
	},CMPred:function(){
		return this.getAttribute(this.detailsNode,"CMPRED");
	},CMWgtR:function(){
		return this.getAttribute(this.detailsNode,"CMWGTR");
	},starring:function(){
		stars=[];
		try{
			var arrStars=this.xmlDoc.getElementsByTagName("STARRING")[0].getElementsByTagName("PERSON");
			for(var i=0;i<arrStars.length;i++){
				var objStarNode=arrStars[i];
				stars.push(new Person(this.getAttribute(objStarNode,"NAME"),this.getAttribute(objStarNode,"ID")));
			}
		}catch(e){}
		return stars;
	},director:function(){
		try{
			var objDirectorNode=this.xmlDoc.getElementsByTagName("DIRECTOR")[0].getElementsByTagName("PERSON")[0];
			return new Person(this.getAttribute(objDirectorNode,"NAME"),this.getAttribute(objDirectorNode,"ID"));
		}catch(e){}
	},friendRated:function(){
		return this.getAttribute(this.glyphNode,"FRND");
	},recommended:function(){
		return this.getAttribute(this.glyphNode,"REC");
	}
};

function BobTextHandler(id){
	this.element=this.addTextNodeTo(id);
}

BobTextHandler.prototype={addTextNodeTo:function(id){
		var NewTextNode=document.createTextNode("");
		$(id).appendChild(NewTextNode);
		return NewTextNode;
	},handle:function(s){
		this.setText(s);
	},setText:function(s){
		//alert("BobTextHandler: " + s);
		//JAS
		this.element.nodeValue=s;
		//this.element.nodeValue="Title";
	}
};

function BobCapHandler(id){
	this.element=$(id).firstChild;
}

BobCapHandler.prototype=BobTextHandler.prototype;

function BobSynopsisHandler(id){
	this.element=$(id);
	this.dummy=document.createElement("SPAN");
}

BobSynopsisHandler.prototype.handle=function(s){
	/*
	var tString=tokenizeString(s,"%%~p;");
	while(this.dummy.hasChildNodes()){
		this.dummy.removeChild(this.dummy.firstChild);
	}
	for(var i=0;i<tString.length;i++){
		if(i==0){
			var tagName="SPAN";
		}else{
			var tagName="P";
		}
		var parentElement=this.dummy.appendChild(document.createElement(tagName));
		parentElement.appendChild(document.createTextNode(tString[i]));
	}
	//alert("BobSynHandler: " + this.dummy.innerHTML);
	this.element.innerHTML= this.dummy.innerHTML;
	*/
	//alert("s: " + s);
	this.element.innerHTML= s;
	//this.element.innerHTML= "<SPAN><p>This is a paragraph</p> &nbsp;&nbsp;</SPAN>";
	//this.element.innerHTML="<html><body>This is a test of NetFlix<br>One<br>Two<br>Three<br>Four<br> </body></html>";
};

function BobVisibilityHandler(id){
	this.element=$(id);
}

BobVisibilityHandler.prototype={handle:function(s){
		this.setVisible(s);
	},setVisible:function(bool){
		this.element.style.visibility=(bool)?"visible":"hidden";
	}
};

var BobContentHandler={initialized:false,shownFlag:false,initialize:function(){
		this.PARENTAL_RATING_ROOT=IMAGE_ROOT+"/pages/parental_ratings/rating_",this.canvas=$("bob");
		this.boxImg=$("bobimg");
		//$("bobprating").src=IMAGE_ROOT+"labels/1px.gif";
		//this.detailElements.initialize($("bobstarring").parentNode);
		// JAS mod
		//this.textHandlers={title:new BobCapHandler("bobtitle"),synopsis:new BobSynopsisHandler("bobsynopsis"),year:new BobCapHandler("bobyear"),starring:new BobTextHandler("bobactors"),director:new BobTextHandler("bobdirector"),genre:new BobTextHandler("bobgenre")};
		this.textHandlers={title:new BobCapHandler("bobtitle"),synopsis:new BobSynopsisHandler("bobsynopsis")};
		//JAS mod
		//this.visibilityHandlers={starring:new BobVisibilityHandler("bobstarring"),director:new BobVisibilityHandler("bobdirecting"),genre:new BobVisibilityHandler("bobgenretbl"),rating:new BobVisibilityHandler("bobprating"),friendRated:new BobVisibilityHandler("bobfrnd"),recommended:new BobVisibilityHandler("bobrec")};
		this.visibilityHandlers={friendRated:new BobVisibilityHandler("bobfrnd"),recommended:new BobVisibilityHandler("bobrec")};
		/*
		this.textHandlers.starring.handle=function(a){
			if(a.length>0){
				var txtString="";
				for(var i=0;i<a.length-1;i++){
					txtString+=a[i].name+", ";
				}
				txtString+=a[i].name;
				this.setText(txtString);
			}
		};
		*/
		//this.textHandlers.director.handle=function(p){
		//	p&&this.setText(p.name);
	  //};
		//this.textHandlers.year.handle=function(s){
		//	this.setText(" ("+s+")");
		//};
		/*
		this.visibilityHandlers.starring.handle=function(a){
			this.setVisible(a.length>0);
		};
		this.visibilityHandlers.starring.setVisible=function(bool){
			if(bool){
				if(this.rowRemoved){
					BobContentHandler.detailElements.elements[this.element.id]=this.element;
					this.rowRemoved=false;
				}
			}else{
				if(!this.tBody){
					this.tBody=this.element.parentNode;
				}
				if(!this.rowRemoved){
					this.tBody.removeChild(this.element);
					BobContentHandler.detailElements.elements[this.element.id]=null;
					this.rowRemoved=true;
				}
			}
		};
		*/
		//this.visibilityHandlers.director.setVisible=this.visibilityHandlers.starring.setVisible;
		//this.visibilityHandlers.genre.setVisible=this.visibilityHandlers.starring.setVisible;
		//this.visibilityHandlers.director.handle=function(_76){
		//  this.setVisible(_76&&_76.name.length>0);
		//};
		/*
		this.visibilityHandlers.rating.handle=function(_77){
			if(_77){
				if(_77.indexOf("TV")!=-1){
					this.element.height=32;
				}else{
					this.element.height=16;
				}
				this.element.src=BobContentHandler.PARENTAL_RATING_ROOT+_77+".gif";
			}
			this.setVisible("rating",_77);
		};
		*/
		this.initialized=true;
	},display:function(_78,_79){
		if(!this.initialized){
			return false;
		}
		this.movieID=_78.id;
		this.parentID=_78.parentID;
		this.handleBoxshot(_79);
		for(field in _78){
			if(this.textHandlers[field]){
				//alert("field: " + field);
				this.textHandlers[field].handle(_78[field]);
			}
			if(this.visibilityHandlers[field]){
						this.visibilityHandlers[field].handle(_78[field]);
			}
		}
		this.detailElements.display();
		if(!this.shownFlag&&(isSafari||isOpera)){
			this.hideContent(_78,_79);
		}
	},handleBoxshot:function(_80){
		if(!_80){
			this.boxImg.style.display="none";
		}else{
			this.boxImg.style.display="inline";
			this.boxImg.src=IMAGE_ROOT+"boxshots/small/"+(this.parentID?this.parentID:this.movieID)+".jpg";
		}
	},preloadBoxshot:function(_81){
		if(!this.preloadBoxshot){
			this.preloadBoxshot=new Image();
		}
		this.preloadBoxshot.src=IMAGE_ROOT+"boxshots/small/"+_81+".jpg";
	},hideContent:function(_82,_83){
		this.handleBoxshot(false);
		for(k in this.visibilityHandlers){
			this.visibilityHandlers[k].setVisible(false);
		}
		this.detailElements.clear();
		if(!this.shownFlag&&(isSafari||isOpera)){
			var _84=this;
			var _85=function(){
				_84.shownFlag=true;
				_84.display(_82,_83);
			};
			window.setTimeout(_85,2);
		}
	}
};

BobContentHandler.detailElements={initialize:function(_86){
		this.tBody=_86;
	},elements:[],elementIDs:new Array("bobstarring","bobdirecting","bobgenretbl"),clear:function(){
		for(field in this.elements){
			//alert("detailElements: " + field);
			this.elements[field]=null;
		}
	},display:function(){
		for(var i=0;i<this.elementIDs.length;i++){
			if(this.elements[this.elementIDs[i]]){
				//alert("elements: " + this.elementIDs[i]);
				this.tBody.appendChild(this.elements[this.elementIDs[i]]);
			}
		}
	}
};

var XMLMovieFetcher={cache:{},getMovie:function(id,_87,Link){
		if(this.cache[id]){
			_87(this.cache[id]);
		}else{
			sc=ServerConnectionFactory.getConnection();
			//alert("id = " + id);
		  sc.url=XML_ROOT+"/includes/cubehelper/ajax_get_prod.php";
			Link.movieid=id;
			sc.setParameters(Link);
			var _89=this;
			sc.successCallback=function(_90){
				_89.handleXMLReturn(_90,id,_87);
			};
			sc.execute();
		}
	},handleXMLReturn:function(_91,id,_92){
		var _93=false;
		
		try{
			var _94=new MovieXMLImporter(_91);
			var _95=new Movie();
			_95.importFrom(_94);
			//alert("_95: " + _95);
			this.cache[id]=_95;
			_93=true;
		}catch(e){}
		if(_93){
			_92(_95);
		}
	}
};

var BobManager={STYLE_POSITION:1,COUNT_DELIM:"_",BOXSHOT_STATE_DEFAULT:0,BOXSHOT_STATE_NONE:1,BOXSHOT_STATE_DISPLAY:2,STATE_AWAKE:0,STATE_ASLEEP:1,LINKCTR_TEXT:"TXT",LINKCTR_BOXSHOT:"BOX",LINKCTR_TEXT_NEAR_BOXSHOT:"BTX",LINKCTR_MINIQ:"MQI",displayFlag:false,initialize:function(){
		this.readyState=BobManager.STATE_AWAKE;
		this.bob=$("bob");
		this.arrow=$("bobarrow");
		var _96=this;
		this.arrow.onclick=function(){
			window.location.href=_96.href;
		};
		this.arrow.onmouseout=function(){
			_96.hideBob();
		};
		this.arrow.onmouseover=function(){
			if(_96.hideBobTimer){
				clearTimeout(_96.hideBobTimer);
				_96.hideBobTimer=null;
			}
		};
		document.onkeydown=function(evt){
			evt=evt||window.event;
			if(evt.keycode){
				if(evt.keyCode==33||evt.keyCode==34){
					_96.currentScroll=document.body.scrollTop;
				}
			}
		};
		document.onkeyup=function(evt){
			evt=evt||window.event;
			if(evt.keycode){
				if(evt.keyCode==33||evt.keyCode==34){
					if(document.body.scrollTop!=_96.currentScroll){
						_96.hideBob();
					}
				}
			}
		};
		BobContentHandler.initialize();
		BobPositioner.initialize();
	},setReadyState:function(_97){
		this.readyState=_97;
		if(this.readyState==BobManager.STATE_ASLEEP){
			this.hideBob();
			this.detach();
		}
	},bobifyLinks:function(){
		var _98=$("CContainer");
		var _99=_98.getElementsByTagName("IMG");
		var _100=[];
		var _101=/dB\(/;
		for(var i=0;i<_99.length;i++){
			var img=_99[i];
			if(img.onmouseover){
				if(_101.test(img.onmouseover.toString())){
					countIndex=img.id.indexOf(BobManager.COUNT_DELIM);
					_100[_100.length]=img.id.substring(2,countIndex);
				}
			}
		}
		if(_100.length>0){
			var _103=/MovieDisplay?.*movieid=(\d+)/;
			var _104=/Read\s?More/;
			var _105=/^Why\s?is\s?this\s?movie/i;
			var _106=_98.getElementsByTagName("A");
			linkloop:
			for(var i=0;i<_106.length;i++){
				var link=_106[i];
				if(link.onmouseover){
					continue;
				}
				if(link.hasChildNodes()){
					var kids=link.childNodes;
					for(var j=0;j<kids.length;j++){
						if(kids[j].tagName=="IMG"){
							continue linkloop;
						}
					}
				}
				if(link.firstChild&&link.firstChild.nodeValue){
					var _110=link.firstChild.nodeValue;
					if(_104.test(_110)){
						continue;
					}
					if(_105.test(_110)){
						continue;
					}
				}
				result=link.href.match(_103);
				if(result!=null){
					var id=result[1];
					for(var j=0;j<_100.length;j++){
						if(id==_100[j]){
							link.movieid=id;
							link.onmouseover=function(_111){
								_111=_111||window.event;
								BobManager.dB(_111,this,BobManager.BOXSHOT_STATE_NONE);
							};
							continue;
						}
					}
				}
			}
		}
		},bobifyMiniqueue:function(){
			var _112=$("mqbox");
			if(_112){
				var _113=_112.getElementsByTagName("DIV");
				for(var i=0;i<_113.length;i++){
					if(_113[i].className.indexOf(CLASS_MINIQ_ROW)>-1){
						_113[i].setAttribute("persist_mouseout",1);
						_113[i].onmouseover=function(_114){
							_114=_114||window.event;
							var _115=getPositionFromElementId(this.id);
							if(custq.getItem(_115)){
								this.movieid=custq.getItem(_115).id;
								BobManager.dB(_114,this,BobManager.BOXSHOT_STATE_DISPLAY);
							}
						};
						_113[i].onmouseout=function(){
							if(this.movieid){
								BobManager.hideBob();
							}
						};
						_113[i].onmousedown=function(){
							BobManager.setReadyState(BobManager.STATE_ASLEEP);
						};
						_113[i].onmouseup=function(){
							BobManager.setReadyState(BobManager.STATE_AWAKE);
						};
					}
				}
			}
		},getURLParams:function(){
			if(this.triggerElement.movieid){
				var _116={pos:0,ds:"b"};
				_116.linkCtr=this.triggerElement.tagName=="A"?BobManager.LINKCTR_TEXT_NEAR_BOXSHOT:BobManager.LINKCTR_MINIQ;
			}else{
				var _116={pos:this.triggerElement.id.substring(this.triggerElement.id.indexOf(BobManager.COUNT_DELIM)+1),ds:this.triggerElement.id.charAt(BobManager.STYLE_POSITION)};
				_116.linkCtr=this.triggerElement.tagName=="A"?BobManager.LINKCTR_TEXT:BobManager.LINKCTR_BOXSHOT;
			}
			return _116;
		},isShowBoxshot:function(){
			if(this.boxshotState==BobManager.BOXSHOT_STATE_DEFAULT){
				return this.triggerElement.tagName=="A"||this.triggerElement.tagName=="DIV";
			}else{
				return this.boxshotState==BobManager.BOXSHOT_STATE_DISPLAY;
			}
		},display:function(id){
			if(id!=this.getMovieID()){
				return;
			}
			this.displayFlag=true;
			var _118=this;
			var _119=this.isShowBoxshot();
			var _120=this.getURLParams();
			if(window.isQueue){
				_120.linkCtr+="QUEUE";
			}
			if(this.triggerElement.alt){
				this.triggerElement.altbackup=this.triggerElement.alt;
				this.triggerElement.alt="";
			}
			var _121=function(_122){
				_118.showBobTimer=null;
				if(!BobManager.displayFlag){
					return;
				}
				BobContentHandler.display(_122,_119);
				BobPositioner.setPosition(_118.triggerElement,_118.mouseCoord);
				if((isSafari||isOpera)&&!_118.shownFlag){
					window.setTimeout(function(){
						BobPositioner.setPosition(_118.triggerElement,_118.mouseCoord);
						_118.shownFlag=true;
					},5);
				}
				_118.bob.style.visibility="visible";
			};
			if(_119){
				BobContentHandler.preloadBoxshot(id);
			}
			XMLMovieFetcher.getMovie(id,_121,_120);
		},detach:function(){
			if(this.triggerElement){
				if(!this.triggerElement.getAttribute("persist_mouseout")){
					this.triggerElement.onmouseout=null;
				}
				this.triggerElement=null;
			}
		},attach:function(){
			if(!this.triggerElement.onmouseout){
				var _123=this;
				this.triggerElement.onmouseout=function(){
					_123.hideBob();
				};
			}
		},dB:function(evt,_124,_125){
			if(!window.d_bobMS||d_bobMS==-1||this.readyState==BobManager.STATE_ASLEEP){
				return;
			}
			if(this.hideBobTimer&&this.triggerElement&&this.triggerElement==_124){
				clearTimeout(this.hideBobTimer);
				this.hideBobTimer=null;
				return;
			}
			this.mouseCoord=getMouseCoordinates(evt);
			this.detach();
			this.triggerElement=_124;
			this.href=_124.href||_124.parentNode.href;
			if(arguments.length==3){
				this.boxshotState=_125;
			}else{
				this.boxshotState=BobManager.BOXSHOT_STATE_DEFAULT;
			}
			this.attach();
			var _126=this.getMovieID();
			var _127=this;
			var _128=function(){
				_127.display(_126);
			};
			this.showBobTimer=setTimeout(_128,d_bobMS);
		},getMovieID:function(){
			if(this.triggerElement.movieid){
				return this.triggerElement.movieid;
			}else{
				var id=this.triggerElement.id;
				var _129=id.indexOf(BobManager.COUNT_DELIM);
				return id.substring(2,_129);
			}
		},hideBob:function(){
			this.displayFlag=false;
			if(this.showBobTimer){
				clearTimeout(this.showBobTimer);
				this.showBobTimer=null;
				return;
			}
			var _130=this;
			var _131=function(){
				_130.hideBobTimer=null;
				_130.bob.style.visibility="hidden";
				if(_130.triggerElement&&_130.triggerElement.altbackup){
					_130.triggerElement.alt=_130.triggerElement.altbackup;
				}
				BobContentHandler.hideContent();
			};
			this.hideBobTimer=setTimeout(_131,3);
		}
	};
	//var BobPositioner={TOP_SHADOW_OFFSET:-10,BOB_BOX_WIDTH:290,MOVIE_TO_ARROW_SPACER:25,DISPLAY_STYLE_DEFAULT:0,DISPLAY_STYLE_LARGE_BOXSHOT:1,DISPLAY_STYLE_TINY_BOXSHOT:2,ARROW_HEIGHT:101,ARROW_HEIGHT_NO_SHADOW:70,LARGE_BOXSHOT_WIDTH:110,MED_BOXSHOT_WIDTH:65,TINY_BOXSHOT_WIDTH:50,TEXT_LINK_BUFFER_WIDTH:50,POSITION_LEFT:0,POSITION_RIGHT:1,MAX_PAGE_LEFT_OFFSET:380,initialize:function(){
  var BobPositioner={TOP_SHADOW_OFFSET:-10,BOB_BOX_WIDTH:290,MOVIE_TO_ARROW_SPACER:25,DISPLAY_STYLE_DEFAULT:0,DISPLAY_STYLE_LARGE_BOXSHOT:1,DISPLAY_STYLE_TINY_BOXSHOT:2,ARROW_HEIGHT:101,ARROW_HEIGHT_NO_SHADOW:70,LARGE_BOXSHOT_WIDTH:110,MED_BOXSHOT_WIDTH:65,TINY_BOXSHOT_WIDTH:50,TEXT_LINK_BUFFER_WIDTH:50,POSITION_LEFT:0,POSITION_RIGHT:1,MAX_PAGE_LEFT_OFFSET:380,initialize:function(){
	
		this.bob=$("bob");
		this.arrow=$("bobarrow");
		this.arrowImages={UL:$("bobarrowulimg"),UR:$("bobarrowurimg"),LL:$("bobarrowllimg"),LR:$("bobarrowlrimg")};
	},setPosition:function(_132,_133){
		this.bobPosition=BobPositioner.POSITION_RIGHT;
		this.triggerElement=_132;
		this.mouseCoordX=_133.x;
		this.mouseCoordY=_133.y;
		this.setTop();
		this.setLeft();
		this.positionArrow();
	},setTop:function(){
		var _134=grabComputedHeight(this.bob);
		//JAS MOD
		var _135=_134/4;
		//var _135=_134-30;
		var _136=getElementOffsetY(this.triggerElement)+BobPositioner.TOP_SHADOW_OFFSET-_135;
		this.bob.style.top=_136+"px";
		this.correctForYOverrun(_136);
	},correctForYOverrun:function(_137){
		var _138=0;
		var _139=getWindowHeight();
		var _140=document.body.scrollTop;
		var top=getElementOffsetY(this.bob)-BobPositioner.TOP_SHADOW_OFFSET-_140;
		var _142=(top*1)+(grabComputedHeight(this.bob)*1);
		if(_142>_139){
			_138=_142-_139-30;
		}
		if(top-_138<1){
			_138=top;
		}
                // JAS Mod
		//this.bob.style.top=(_137-_138)+"px";
                this.bob.style.top=(_137-100)+"px";
	},getTriggerTop:function(){
		return getElementOffsetY(this.triggerElement);
	},setLeft:function(){
		var _143=0;
		if(this.triggerElement.tagName=="A"||this.triggerElement.tagName=="DIV"){
			_143=Math.max(this.mouseCoordX,0)+BobPositioner.TEXT_LINK_BUFFER_WIDTH;
			if(_143>this.maxLeftPosition()){
				_143-=(BobPositioner.BOB_BOX_WIDTH+BobPositioner.MOVIE_TO_ARROW_SPACER+(1.5*BobPositioner.TEXT_LINK_BUFFER_WIDTH));
				this.bobPosition=BobPositioner.POSITION_LEFT;
			}
		}else{
			var _144=0;
			var _145=this.getBoxshotStyle();
			if(_145==BobPositioner.DISPLAY_STYLE_LARGE_BOXSHOT){
				_144=BobPositioner.LARGE_BOXSHOT_WIDTH;
			}else{
				if(_145==BobPositioner.DISPLAY_STYLE_TINY_BOXSHOT){
					_144=BobPositioner.TINY_BOXSHOT_WIDTH;
				}else{
					_144=BobPositioner.MED_BOXSHOT_WIDTH;
				}
			}
			var _146=getElementOffsetX(this.triggerElement);
			_143=_146+BobPositioner.MOVIE_TO_ARROW_SPACER+_144;
			if(_143>this.maxLeftPosition()){
				_143-=(BobPositioner.BOB_BOX_WIDTH+BobPositioner.MOVIE_TO_ARROW_SPACER+_144);
				this.bobPosition=BobPositioner.POSITION_LEFT;
			}
		}
		this.bob.style.left=_143+"px";
	},maxLeftPosition:function(){
		return getElementOffsetX($("CContainer"))+BobPositioner.MAX_PAGE_LEFT_OFFSET;
	},positionArrow:function(){
		var _147=false;
		var _148=this.getTriggerTop()-getElementOffsetY(this.bob);
		var _149=grabComputedHeight(this.bob);
		if(_148<(_149/2)){
				_147=true;
		}else{
			_148-=BobPositioner.ARROW_HEIGHT_NO_SHADOW;
		}
		if(_148+BobPositioner.ARROW_HEIGHT+10>_149){
			_148-=10;
		}
		if(_148<10){
			_148=10;
		}
		this.arrow.style.top=_148+"px";
		if(this.bobPosition==BobPositioner.POSITION_LEFT){
			this.arrow.style.left="268px";
		}else{
			this.arrow.style.left="-42px";
		}
		var _150=_147?"U":"L";
		_150+=(this.bobPosition==BobPositioner.POSITION_LEFT)?"R":"L";
		for(key in this.arrowImages){
			this.arrowImages[key].style.display=(key==_150)?"block":"none";
		}
	},getBoxshotStyle:function(){
		return this.triggerElement.id.substring(1,2);
	}
};

function primeBOB(){
	BobManager.initialize();
	callOnWindowLoad(BobManager.bobifyLinks);
	callOnWindowLoad(BobManager.bobifyMiniqueue);
}

function dB(evt,link){
	BobManager.dB(evt,link);
}

function $(element){
	if(typeof element=="string"){
		element=document.getElementById(element);
	}
	return element;
}