
IFILM.AdObj=function(targ,scriptSrc,confObj,disableRefresh,showCallout){this.targ=targ;this.scriptSrc=scriptSrc;this.disableRefresh=disableRefresh||false;this.showCallout=showCallout||false;this.config=confObj||{width:'300',height:'251',FRAMEBORDER:"0",border:"0",marginwidth:"0",marginheight:"0",hspace:"0",vspace:"0",scrolling:"no",style:"border: none",src:"/iframe/vciframesrc.jsp?advurl="+encodeURIComponent(scriptSrc),allowtransparency:'true'}
IFILM.adManager.addAd(this);safelog("Ad Object created with scriptSrc:"+scriptSrc,"info","IFILM.AdObj");}
IFILM.AdObj.prototype={previouslyHidden:false,display:function(){var displayAt=jq('#'+this.targ).get(0);if(displayAt&&displayAt.tagName){var iframe;if(displayAt.tagName.toLowerCase()!="iframe"){var na=new NodeAssembly(displayAt);if(this.showCallout)
na.createEl('p',{'class':'ad_callout'},'ADVERTISEMENT');var iframe=na.createElWithReturn("iframe",this.config);na.insertIn();}else{var iframe=displayAt;}
safelog(this.scriptSrc);this.targetFrame=iframe;this.addHeightAdjustTrigger();var scriptTag=this.createAdString();this.dispatchAd(scriptTag);}},adjustHeight:function(targetFrame){var cw=targetFrame.contentDocument||targetFrame.contentWindow.document;try{if(cw){var atHTML=cw.getElementsByTagName("html")[0];if(atHTML){var docSize=cw.body.scrollHeight||atHTML.offsetHeight;var rawSize=targetFrame.height;if(Math.abs(docSize-rawSize)>20&&docSize<700)
targetFrame.height=docSize;}
if(jq("img[src='http://m1.2mdn.net/viewad/817-grey.gif']",cw).get(0))
jq(targetFrame).parent().hide();}}catch(e){safelog("Error auto-resizing ad "+e,"Error","IFILM.AdObj.adjustHeight");}},addHeightAdjustTrigger:function(){var adjustHeight=this.adjustHeight;if(this.targ!='globalTextAdUnit'){jq(this.targetFrame).load(function(e){adjustHeight(this);});}},createAdString:function(){var scriptTag="/iframe/vciframesrc.jsp?advurl="+encodeURIComponent(this.scriptSrc);scriptTag+="&ifilmrnd="+Math.round(Math.random()*1000000)+'-'+Math.round(Math.random()*1000000);return scriptTag;},dispatchAd:function(adString){if(this.targetFrame){var dispatcher=this.targetFrame.contentDocument||this.targetFrame.contentWindow.document;var adLoc=adString||this.createAdString();this.adDisplayed=true;}},targetFrame:null,adDisplayed:false,refresh:function(){jq('#'+this.targ).empty();this.display();},styleref:['<style type="text/css">','body {margin:0; padding: 0; border: none; }','</style><style type="text/css">','a img { border: none; }','</style>']}
IFILM.adManager={ads:[],banner:null,ad_refresh_rate:null,timer:10,textAd:function(msg){if(StringUtils.trim(jq("#globaltxtad").html())!='')
jq("#globaltxtad").fadeOut("normal",function(){jq("#globaltxtad").html(msg);});else
jq("#globaltxtad").html(msg);jq('#globaltxtad a').html(StringUtils.truncate(jq("#globaltxtad a").html(),60));jq('#globaltxtad').fadeIn("normal");},hideChannelPlayer:function(){jq('#SUPPLEMENT embed,#SUPPLEMENT object').css('display','none');},revealAds:function(){var adLim=IFILM.adManager.ads.length;for(i=0;i<adLim;i++){if(!IFILM.adManager.ads[i].previouslyHidden)
jq('#'+IFILM.adManager.ads[i].targ+' *').css('visibility','visible');}
jq('body>iframe').not('#dsHistoryFrame').css('visibility','visible');},obscureAds:function(){var adLim=IFILM.adManager.ads.length;for(i=0;i<adLim;i++){if(jq('#'+IFILM.adManager.ads[i].targ).css('visibility')=='hidden'||jq('#'+IFILM.adManager.ads[i].targ).css('display')=='none')
IFILM.adManager.ads[i].previouslyHidden=true;jq('#'+IFILM.adManager.ads[i].targ+' *').css('visibility','hidden');}
jq('body>iframe').not('dsFrame').css('visibility','hidden');},displayAds:function(){var adlim=this.ads.length;for(var x=0;x<adlim;x++){try{if(this.ads[x]){this.ads[x].display();}}catch(e){safelog(e,"ERROR","IFILM.adManager.displayAds");}}},refreshAds:function(){var adlim=this.ads.length;for(var x=0;x<adlim;x++){if(this.ads[x].targ=='HEADERAD'){jq("#IFILM iframe").remove();jq('#HEADER .click_through').remove();}
if(this.ads[x]&&!this.ads[x].disableRefresh){this.ads[x].refresh();}else{safelog("reloading ad disabled for "+(x+1)+" of "+adlim,"info","IFILM.adManager");}}},addAd:function(adObj){if(adObj.display){this.ads.push(adObj);}},displayAdsGeneric:function(){IFILM.adManager.displayAds();},displaySkin:function(frame){},attachSkin:function(style_src){var stylesheets=document.getElementsByTagName('link');var has_stylesheet=false;stylesheetLim=stylesheets.length;for(i=0;i<stylesheetLim;i++){if(style_src==stylesheets[i].href){has_stylesheet=true;}}
if(!has_stylesheet){var parent_head=document.getElementsByTagName('head')[0];var e=document.createElement('link');e.type='text/css';e.href=style_src;e.rel='stylesheet';e.media='screen';parent_head.appendChild(e);}},hideAds:function(hideEl){if(hideEl){hideEl.style.display="none";if(hideEl.parentNode){hideEl.parentNode.style.display="none";jq('#'+hideEl.parentNode.id+'_top, #'+hideEl.parentNode.id+'_bottom').css('display','none');}}},makeFullheader:function(url,clickThrough){jq("#HEADERAD").css({'visibility':'hidden','border':'0'});if(clickThrough)
jq('#HEADER').prepend('<a href="'+clickThrough+'" target="_blank" class="click_through clearfix">&nbsp;</a>');if(jq.browser.msie&&jq.browser.version<7)
jq('#HEADER a.click_through').css('z-index','2000');jq('#LOGO a').css({position:'relative','z-index':'2000'});jq('#HEADER .click_through').css({'top':'94px','left':jq('#BODYCONTENT').offset().left+'px'});},createInterstitial:function(width){if(!width)width=600;try{tbGenerateOverlay();jq('#INTERSTITIAL').before('<div id="timer">SPIKE.com will appear in <span id="timercount">:0'+IFILM.adManager.timer+'</span> seconds</div>');jq("#INTERSTITIAL").before('<div id="closead"><a href="#" id="closeadlink">Continue to SPIKE.com</a>');jq('#TB_window').remove();jq("#TB_overlay,#closeadlink").click(IFILM.adManager.removeInterstitial);}catch(e){safelog(e);}
jq(document).keyup(function(e){if(e==null)
keycode=event.keyCode;else
keycode=e.which;if(keycode==27)
IFILM.adManager.removeInterstitial();});if(ie)
jq('html').css('overflow','hidden');if(width==300){jq('#INTERSTITIAL iframe,#INTERSTITIAL').css({"width":"300px","height":"250px"});jq('#timer').css('margin-top','75px');}
jq('#INTERSTITIAL').css({'margin-left':'-'+width/2+'px','margin-top':'-200px'}).show();jq("body>iframe,body>embed,body>object,#BODYCONTENT iframe, #BODYCONTENT embed, #BODYCONTENT object").css('visibility','hidden');IFILM.adManager.obscureAds();setTimeout(IFILM.adManager.incrementTimer,'1000');IFILM.cookieManager.setSessionCookie('prestitial',true);if(!(jQuery.browser.msie&&jQuery.browser.version<7))
jq("#INTERSTITAL").css({marginTop:'-'+parseInt((200/2),10)+'px'});},removeInterstitial:function(e){if(e){preventDefault(e);}
jq("#TB_overlay").fadeOut("fast",function(){jq('#closead,#gt_link,#timer,#INTERSTITIAL,#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});jq(document).unbind("keyup");jq("#closeadlink").unbind()
jq("body>iframe,body>embed,body>object,#BODYCONTENT iframe,#BODYCONTENT embed,#BODYCONTENT object").css('visibility','visible');IFILM.adManager.revealAds();if(typeof document.body.style.maxHeight=="undefined"){jq("body","html").css({height:"auto",width:"auto"});jq("html").css("overflow","");}},incrementTimer:function(){IFILM.adManager.timer--;jq('#timercount').html(':0'+IFILM.adManager.timer);if(IFILM.adManager.timer!=0)
setTimeout(IFILM.adManager.incrementTimer,'1000');else
IFILM.adManager.removeInterstitial();},reskinningUnit:function(imageUrl,bgColor){IFILM.adManager.reskinPage(imageUrl,bgColor);jq("#BODYCONTENT").css('background-color','transparent');jq('#ad1div iframe').css({'position':'relative','width':'330px','height':'270px','background':'transparent none'});jq('#ad1div').css({'background':'transparent none','border':0,'padding':0,'margin-bottom':'20px'});jq("#ad1div_top, #ad1div_bottom").remove();setTimeout(IFILM.adManager.removeTopBottom,250)},reskinPage:function(imageUrl,bgColor){jq('body').css('background',bgColor+' url('+imageUrl+') no-repeat top center');},removeTopBottom:function(){if(jq('#ad1div_top').get(0))
jq("#ad1div_top,#ad1div_bottom").remove();else
setTimeout(IFILM.adManager.removeTopBottom,250)}}
function textAd(msg){IFILM.adManager.textAd(msg);}
var adid="";var query=window.location.search.substring(1);var queryparams=query.split("&");ord=Math.random()*10000000000000000;var dartRef,hbxRef,refsiteSession,reftypeSession;refsiteid="";referralType="";pageLoadFuncs.push(function(){window.setTimeout(IFILM.adManager.displayAdsGeneric,1000);try{var min=10000;if(!IFILM.adManager.ad_refresh_rate||IFILM.adManager.ad_refresh_rate=='')
return;ad_refresh_rate=IFILM.adManager.ad_refresh_rate;var valInSeconds=parseInt(ad_refresh_rate)*1000;if(isNaN(valInSeconds)||valInSeconds<min){valInSeconds=min;}
safelog("reload interval: "+valInSeconds,"INFO","ad refresh interval");var z=window.setInterval('IFILM.adManager.refreshAds()',valInSeconds);}catch(e){safelog("problem reloading "+e.message,"ERROR","ad refresh interval");}});
function resolveLink(args){var string=document.location.href;if(string.indexOf("http://surveys.relevantview.com/sbox/asandboxdev.sbt/")!=-1)
{var getrev=new Array();var getrev=string.split("http://surveys.relevantview.com/sbox/asandboxdev.sbt/");var result=getrev[1];var filename=result.split("/");var filenamefinal=filename[0];var filenamefinal=result.split(",");var respondentid=filenamefinal[0];var surveyid=filenamefinal[1];var questionid=filenamefinal[2];var url1=filename[1];var url2=filename[2];if(args.indexOf("http://")!=-1)
{args=args.replace(new RegExp(/^http:\/\//i),"http/");document.location.href="http://surveys.relevantview.com/sbox/asandboxdev.sbt/"+respondentid+","+surveyid+","+questionid+",1,0/"+args;}
else
{document.location.href="http://surveys.relevantview.com/sbox/asandboxdev.sbt/"+respondentid+","+surveyid+","+questionid+",1,0/"+url1+"/"+url2+args;}}
else
{document.location.href=args;}}
function getLocation(){var string=document.location.href;if(string.indexOf("http://surveys.relevantview.com/sbox/asandboxdev.sbt/")!=-1)
{var getrev=new Array();var getrev=string.split("http://surveys.relevantview.com/sbox/asandboxdev.sbt/");var result=getrev[1];var filename=result.split("/");var filenamefinal=filename[0];var filenamefinal=result.split(",");var respondentid=filenamefinal[0];var surveyid=filenamefinal[1];var questionid=filenamefinal[2];var url1=filename[1];var url2=filename[2];var url;if(args.indexOf("http://")!=-1)
{args=args.replace(new RegExp(/^http:\/\//i),"http/");url="http://surveys.relevantview.com/sbox/asandboxdev.sbt/"+respondentid+","+surveyid+","+questionid+",1,0/"+args;}
else
{url="http://surveys.relevantview.com/sbox/asandboxdev.sbt/"+respondentid+","+surveyid+","+questionid+",1,0/"+url1+"/"+url2+args;}}
else
{var url=document.domain;}
return url;}
var RSSManager={triggers:null,curTriggered:null,addTriggers:function(){jq('#RSSFEEDS a.rssfeed_subMenu_trigger').click(this.triggerFunc);},triggerFunc:function(e){if(e){preventDefault(e);}
var id_num=this.id.replace(/subscribe_trigger_/,'');var feedEl=jq('#rssfeed_subscriptions_submenu_'+id_num).get(0);if(feedEl.style.display=='block'){RSSManager.closeEl(this,feedEl);}else{RSSManager.openEl(this,feedEl);}},openEl:function(el,feedEl){jq("#MAINCONTENT").css("position","static");if(this.curTriggered){this.curTriggered.style.display='none';}
feedEl.style.display='block';jq(feedEl).css('top',(jq(el).offset().top+20)+"px");jq(feedEl).css('left',(jq(el).offset().left)+"px");this.curTriggered=feedEl;},closeEl:function(el,feedEl){feedEl.style.display='none';this.curTriggered=null;}}
pageLoadFuncs.push(function(){RSSManager.addTriggers();});