var tvgFrameId=1;var tvgBaseUrl="http://widgets.tvguide.com";var tvgFrames=new Array();function tvgURLEncode(plaintext){var SAFECHARS="0123456789" +"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +"abcdefghijklmnopqrstuvwxyz" +"-_.!~*'()";var HEX="0123456789ABCDEF";var encoded="";for(var i=0;i255){encoded+="+";} else{encoded+="%";encoded+=HEX.charAt((charCode>>4)&0xF);encoded+=HEX.charAt(charCode&0xF);} } } return encoded;} ;function tvgURLDecode(encoded){if(encoded==null||encoded==undefined)return"";var HEX="0123456789ABCDEFabcdef";var plaintext="";var i=0;try {while(i1){this.q=q.substring(1,q.length);} else{this.q=null;} this.keyValuePairs=new Array();if(q){for(var i=0;i=0);tvgFrames[this.FrameID]=this;this.Watcher=function(){var frame=document.getElementById(this.FrameName);if(frame!=null){frame.setAttribute("border","0");frame.setAttribute("frameborder","0");} window.setInterval("tvgFrames[" +this.FrameID+"].pollFrame();",10);} this.resizeFrame=function(){if(this.CurrentHeight!=this.LastHeight){var frame=document.getElementById(this.FrameName);var objToResize=(frame.style)?frame.style:frame;if(this.MaxHeight!=-1){if(this.CurrentHeight>this.MaxHeight){ObjToResize.scrolling='yes';this.CurrentHeight=maxHeight;} } objToResize.height=this.CurrentHeight+"px";this.LastHeight=this.CurrentHeight;} } ;this.pollFrame=function(){this.resizeFrame();var frame=document.getElementById(this.FrameName);if(window.top.location.toString().indexOf("#")==-1){return;} var hashValue=window.top.location.toString().split("#")[1];if((hashValue==null)||(hashValue.length==0)||(hashValue==this.OldValue)){return;} this.OldValue=hashValue;hashValue=tvgURLDecode(hashValue);var pairs=hashValue.split('&');var _frameID=null;var _message=null;if((pairs!=null)&&(pairs.length>0)){for(var i=0;i0)){if(pair[0]=='tvgFrameid'){if((pair[1]!=null)&&(pair[1].length>0)){_frameID=pair[1];} } else if(pair[0]=='message'){_message=pair[1];} } } } if(_frameID!=this.FrameName||_message==null){return;} var newLoc=window.top.location.toString().split('#')[0];if(this.isSafari){window.top.location=newLoc+"#tvg";} else{window.top.location.replace(newLoc+"#tvg");} var token=_message;var ind=token.indexOf("|");if(ind!=-1){var cmd=token.substring(0,ind);var arg=token.substring(ind+1,token.length);switch(cmd){case"size":this.CurrentHeight=parseInt(arg,10);this.CurrentHeight+=15;this.resizeFrame();break;case"link":var newLink=this.BaseURL;var concat="?";if(newLink.indexOf("?")!=-1){concat="&";} newLink+=concat+"tvgindex=" +arg;window.top.location=newLink;break;case"reload":frame.src=this.calcFrameUrl(parseInt(arg,10));break;case"jump":var strUrl=arg;window.top.location=arg;break;case"back":if(this.BackURL==""){var newLink=this.BaseURL;var concat="?";if(newLink.indexOf("?")!=-1){concat="&";} newLink+=concat+"tvgindex=-1";window.top.location=newLink;} else{window.top.location=this.BackURL;} case"load":var strUrl=tvgURLDecode(arg);frame.src=strUrl;break;} } } ;this.calcFrameUrl=function(item){var rVal="";rVal=tvgBaseUrl+"/partner/" +this.RelationID+"/" +this.Key+"/" +this.Width;var a;for(a=2;a0){this.originalArgs[0]=arguments[0];} if(arguments.length>1){this.originalArgs[1]=arguments[1];} for(a=2;a";document.write(HTML);} ;} var tvgmicroContainer=new TVGContainer("micro");var tvgmacroContainer=new TVGContainer("macro");