/* Copyright (c) The Internet Movie Database, 2010 */function consoleLog(message){try{if((window.console)&&(window.console.log)){window.console.log(message);}
else
if((console)&&(console.log)){console.log(message);}
else{throw(message);}}
catch(err){}}
(function(){var element_table={};var by_id_=document.all?function(id){return document.all[id];}:function(id){return document.getElementById(id);};var by_name_=function(tagName){return document.getElementsByTagName(tagName);};var frame_doc_=function(frameName){return window.frames[frameName].document;};var ord=Math.random()*10000000000000000;var cookie_dumper_url="/images/a/ifb/doubleclick/indirect.html";var amazon_pa_cookie="us";var twilight_url="http://www.imdb.com/twilight/?";var restricted_url_regexes=[/\/r[gir]?\//,/\/tiger_redirect/,/^https:/,/secure\.imdb\.com/,/pro\.imdb\.com/,/^javascript:/,/imdb\.[a-z]+\/update/,/resume/,/help/];var doubleclick_url_unescapes=[[/%3B/g,";"],[/%3D/g,"="],[/%2C/g,","],[/%3F/g,"?"]];var client_side_ord_regex=/(\[|%5B)CLIENT_SIDE_ORD(\]|%5D)/;var page_segment_regex=/(\[|%5B)PASEGMENTS(\]|%5D)/;var cache={};this.ad_utils={ord:ord,ord_regex:client_side_ord_regex,ad_table:{},ad_queue:[],queue_ad:function(tile,slot){var queue=this.ad_queue;var prev=queue.length>0?queue[queue.length-1].slot:null;var entry={tile:tile,slot:slot,prev:prev};queue.push(entry);this.ad_table[slot]=entry;},render_ad:function(doc,win){var queue=this.ad_queue;var slot=win.frameElement.id;if(!this.ad_table[slot]){this.ad_table[slot]={slot:slot};}
var prev=this.ad_table[slot].prev;var hash=doc.location.hash;try{if(queue.length===0||queue[0].slot==slot){if(prev){this.ad_table[prev].onFireAd=null;}
queue.shift();this.ad_table[slot].fired=true;try{generic.monitoring.start_timing(slot);}catch(e_inner){consoleLog("start_timing failed: "+e_inner.toString());}
doc.write('<script src="'+
custom.doubleclick.construct_url(hash)+
'" type="text/javascript"><\/script>');if(this.ad_table[slot].onFireAd){this.ad_table[slot].onFireAd();}}
else if(prev){this.ad_table[prev].onFireAd=function(){win.location.reload();};}}catch(e){doc.write('<script src="'+
custom.doubleclick.construct_url(hash)+
'" type="text/javascript"><\/script>');}},resize_iframe:function(iframe){this.expand_ad(iframe);},expand_ad:function(iframe){var slot=iframe.name;var element=by_id_(slot);var fDoc=frame_doc_(slot);var adObject=null;try{adObject=fDoc.ad;}
catch(e1){consoleLog("Cannot access ad parameters: "+e1.toString());}
if(this.ad_table[slot]&&!this.ad_table[slot].fired){return;}
if(!adObject){var width=0;var height=0;if(fDoc.body){if(fDoc.body.scrollWidth){width=parseInt(fDoc.body.scrollWidth,10);}
if(fDoc.body.scrollHeight){height=parseInt(fDoc.body.scrollHeight,10);}}
var media_types=['img','object','embed'];var i,j,media;for(j in media_types){media=fDoc.getElementsByTagName(media_types[j]);for(i=0;i<media.length;i++){var el=media[i];if(el.scrollWidth){width=Math.max(width,parseInt(el.scrollWidth,10));}
if(el.scrollHeight){height=Math.max(height,parseInt(el.scrollHeight,10));}}}
if(width>1&&height>1){adObject={w:width.toString(),h:height.toString(),aid:'0',cid:'0'};}}
try{generic.monitoring.stop_timing(slot,this.get_type_of_ad(adObject),true);}catch(e2){consoleLog("stop_timing failed: "+e2.toString());}
if(fDoc.location.href.match(/\/ads\/request\//)){this.log_ad_impression(adObject,slot);}
if(adObject){if(!document.ads){document.ads={};}
document.ads[adObject.cid]=adObject;if(adObject.w){element.width=parseInt(adObject.w,10)+'px';}
if(adObject.h){element.height=parseInt(adObject.h,10)+'px';}
if(adObject.st){this.expand_supertab(adObject);}
else
if(iframe.id=="top_ad"&&this.is_open(adObject)){this.expand_top_banner(adObject);}
if(adObject.wrap){this.expand_wrap(adObject);}
if(adObject.bamf){this.expand_bamf(adObject,element);}
if(adObject.inner_bamf){this.expand_inner_bamf(adObject);}
if(adObject.relative_bamf){this.expand_relative_bamf(adObject);}
if(this.is_open(adObject)){var before=by_id_(slot+"_before");if(before){this.expand_label(before);}
var after=by_id_(slot+"_after");if(after){this.expand_label(after);}}
if(adObject.styles){for(var id in adObject.styles){generic.override_style(id,adObject.styles[id].style);}}}},is_open:function(adObject){return adObject&&adObject.w&&adObject.h&&adObject.w>0&&adObject.h>0;},expand_supertab:function(adObject){var nb15=by_id_('nb15');if(nb15){nb15.className='supertab';}else{by_id_('nb20').className='supertab';}},expand_top_banner:function(adObject){var nb15=by_id_('nb15');if(nb15){nb15.className='banner';}else{by_id_('nb20').className='banner';}},expand_bamf:function(adObject,element){var bamf=adObject.bamf;generic.extend(element.style,bamf.style);},expand_inner_bamf:function(adObject){var inner_bamf=adObject.inner_bamf;var targetNode=by_id_(inner_bamf.targetId);if(targetNode&&inner_bamf.node){generic.insert_after(inner_bamf.node,targetNode);}},expand_relative_bamf:function(adObject){var relative_bamf=adObject.relative_bamf;var targetNode=by_id_(relative_bamf.targetId);var attach=generic[relative_bamf.relation];if(targetNode&&relative_bamf.node){attach(relative_bamf.node,targetNode);}},expand_wrap:function(adObject){if(!adObject.styles){adObject.styles={};}
var styles={wrapper:{style:{background:adObject.wrap}},root:{style:{background:"transparent"}},footer:{style:{background:"#ffffff"}},pagecontent:{style:{height:"100%"}}};generic.extend(adObject.styles,styles);},expand_label:function(label){label.className=label.className.replace(/hidden/,"");},log_ad_impression:function(adObject,slot){var log_url="/ads/record/[scope];[slot];[aid];[cid];[ord];[time].js";log_url=log_url.chained_replace([[/\[slot\]/g,slot],[/\[ord\]/g,this.ord],[/\[time\]/g,new Date().getTime()]]);var replacements=adObject?[[/\[scope\]/g,adObject.scope||'0'],[/\[aid\]/g,adObject.aid],[/\[cid\]/g,adObject.cid]]:[[/\[scope\]/g,"null"]];log_url=log_url.chained_replace(replacements);generic.load_script(log_url);},get_type_of_ad:function(adObject){if(!adObject){return"null";}
if(adObject.scope){return adObject.scope;}
return"got_ad";}};this.generic={scrollers:[],should_jQuery_noConflict:(window.$&&!window.jQuery),document_readys:[],one_way_send_record:[],insert_after:function(newNode,targetNode){try{targetNode.parentNode.insertBefore(newNode,targetNode.nextSibling);}
catch(err){targetNode.parentNode.appendChild(newNode);}},insert_before:function(newNode,targetNode){targetNode.parentNode.insertBefore(newNode,targetNode);},insert_inside:function(newNode,targetNode){targetNode.appendChild(newNode);},extend:function(targetObject,sourceObject){for(var h in sourceObject){if(typeof sourceObject[h]=='object'){if(targetObject[h]!=sourceObject[h]){if(typeof targetObject[h]=='undefined'){targetObject[h]={};}
this.extend(targetObject[h],sourceObject[h]);}}
else{targetObject[h]=sourceObject[h];}}},override_style:function(id,style){var selector="#"+id;for(var k in style){style[k]+=" !important";}
generic.add_json_style(selector,style);},add_json_style:function(selector,style,id,mode){var css=selector+"{";for(var k in style){css+=k+":"+style[k]+";";}
css+="}";generic.add_css_style(css,id,mode);},add_css_style:function(css,id,mode){if(!id){id='css-style-generic';}
if(!mode){mode='a';}
var style_node=by_id_(id);if(!style_node){style_node=document.createElement("style");style_node.setAttribute("type","text/css");style_node.id=id;by_name_('head')[0].appendChild(style_node);}
var new_css=(mode==='a'?style_node.innerHTML:"")+css;if(style_node.styleSheet){if(style_node.styleSheet.addRule){if(mode!=='a'){style_node.styleSheet.cssText="";}
var tokens=css.split(/[\{\}]/);for(i=0;i<tokens.length;i+=2){style_node.styleSheet.addRule(tokens[i],tokens[i+1]);}}
else{style_node.styleSheet.cssText=new_css;}}
else{try{style_node.innerHTML=new_css;}
catch(err){style_node.innerText=new_css;}}},add_css_file:function(path,id){if(!id){id='css-file-generic';}
var link_node=by_id_(id);if(!link_node){link_node=document.createElement("link");link_node.setAttribute("type","text/css");link_node.rel="stylesheet";link_node.id=id;by_name_('head')[0].appendChild(link_node);}
link_node.href=path;},set:function(source,value){var path=source.split(':');generic[path[0]].set(path[1],value);},get:function(source){var path=source.split(':');return generic[path[0]].get(path[1]);},erase:function(source){var path=source.split(':');generic[path[0]].erase(path[1]);},cookie:{set:function(name,value,days){var expires;if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));expires="; expires="+date.toGMTString();}
else{expires="";}
document.cookie=name+"="+escape(value)+expires+"; path=/";},get:function(name){var ca=document.cookie.split(";");for(var i=0;i<ca.length;i++){if(typeof ca[i]!="string"){continue;}
var pair=ca[i].split('=');if(pair[0]&&pair[1]&&pair[0].replace(/\s/,"")==name){return unescape(pair[1]);}}
return null;},erase:function(name){this.set(name,"",-1);}},cache:{set:function(name,value){cache[name]=value;},get:function(name){return cache[name];},erase:function(name){delete cache[name];}},load_script:function(src){var script=document.createElement('script');script.type="text/javascript";script.src=src;by_name_('head')[0].appendChild(script);},one_way_send:function(src){imageObj=new Image(0,0);imageObj.src=src;this.one_way_send_record.push(imageObj);},extensions:{String:{chained_replace:function(regexArray){var text=this;for(var i=0;i<regexArray.length;i++){var regexPair=regexArray[i];text=text.replace(regexPair[0],regexPair[1]);}
return text;},collapse:function(regex,length){var text=this;while(text.length>length){var newText=text.replace(regex,'');if(newText.length==text.length){break;}
text=newText;}
return text;}}},monitoring:{event_starts:{},event_stops:{},events_to_stop:0,event_duration:{},event_counters:[],all_events_started_flag:false,twilight_info:"",start_timing:function(event){this.start_timing_at(event,new Date().getTime());},start_timing_at:function(event,timestamp){this.event_starts[event]=timestamp;this.events_to_stop++;},stop_timing:function(event,return_type,flush){var timestamp=new Date().getTime();this.event_stops[event]=timestamp;if(return_type){this.event_duration[event+"."+return_type]=timestamp-this.event_starts[event];}else{this.event_duration[event]=timestamp-this.event_starts[event];}
delete this.event_starts[event];this.events_to_stop--;if(flush||(this.all_events_started_flag&&this.events_to_stop===0)){this.send_metrics();}},record_event:function(event,flush){this.event_counters.push(event);if(flush){this.send_metrics();}},record_metric:function(metric_name,metric_value,flush){this.event_duration[metric_name]=metric_value;if(flush){this.send_metrics();}},send_metrics:function(){var url=twilight_url;url+=this.twilight_info;var i=1;for(var operation in this.event_duration){url+="&Operation."+i+"="+operation;url+="&OperationTiming."+i+"="+this.event_duration[operation];i++;}
this.event_duration={};for(i=0;i<this.event_counters.length;i++){url+="&Counter."+(i+1)+"="+this.event_counters[i];}
this.event_counters=[];url+="&ord="+ord;generic.one_way_send(url);},set_twilight_info:function(page_type,country_code,twilight_ord,timestamp,twilight_url_arg){this.twilight_info="PageType="+page_type+"&Geo="+country_code+"&tw_ord="+twilight_ord+"&timestamp="+timestamp;twilight_url=twilight_url_arg;},all_events_started:function(){this.all_events_started_flag=true;}},document_is_ready:function(){var gdrs=generic.document_readys;generic.document_readys=null;for(var i=0;i<gdrs.length;i++){try{gdrs[i]();}catch(e){}}
if(generic.should_jQuery_noConflict){jQuery.noConflict(false);}},on_document_ready:function(callback){if(generic.document_readys===null){callback();}else{generic.document_readys.push(callback);}},load_when_visible:function(container,callback){var loaded=0;var w_=jQuery(window);var scrollPos=w_.height()+w_.scrollTop();if(jQuery("#"+container).length){var c_=jQuery(jQuery("#"+container).get(0));var adPos=c_.offset().top;if(scrollPos>adPos){callback(container);}else{w_.scroll(function(){scrollPos=w_.height()+w_.scrollTop();adPos=c_.offset().top;if((scrollPos>adPos)&&!loaded){loaded=1;callback(container);}});}}else{callback(container);}},scrolling_content:function(adContainer){var self=this;self.adCont=adContainer;self.adHeight=0;self.numAds=0;self.currAd=0;self.scrollSpeed=1000;self.scrollDelay=5000;self.scrollAuto=1;self.scroll_to_current=function(){if(self.currAd>=self.numAds){return;}
jQuery(jQuery("#"+self.adCont+">div").get(0))
.animate({marginTop:"-"+(self.currAd*self.adHeight)+"px"},self.scrollSpeed);};self.scroll_up=function(){self.stop_auto();self.currAd--;if(self.currAd<0){self.currAd=self.numAds-1;}
self.scroll_to_current();};self.scroll_down=function(){self.stop_auto();self.currAd++;if(self.currAd>=self.numAds){self.currAd=0;}
self.scroll_to_current();};self.scroll_auto=function(){if(self.scrollAuto){self.currAd++;if(self.currAd>=self.numAds){self.currAd=0;}
self.scroll_to_current();if(self.currAd!==0){setTimeout(function(){self.scroll_auto();},self.scrollDelay);}}};self.stop_auto=function(){self.scrollAuto=0;};jQuery("#"+self.adCont+">div").each(function(i){self.numAds++;if(this.scrollHeight>self.adHeight){self.adHeight=this.scrollHeight;}});jQuery("#"+self.adCont+">div").css("height",self.adHeight);jQuery("#"+self.adCont).css("height",self.adHeight);setTimeout(function(){self.scroll_auto();},self.scrollDelay);}};generic.extend(String.prototype,generic.extensions.String);this.custom={amazon:{segments:null,aan_call_name:"aan_call",get_segments:function(){this.segments=this.segments||generic.cookie.get(amazon_pa_cookie)||"";return this.segments;},load_callback:function(aan_segments){trimmed_segs=aan_segments.collapse(/s=[^;]*;$/,500);if(trimmed_segs.length<aan_segments.length){generic.monitoring.record_metric("seg_trimmed",aan_segments.length-trimmed_segs.length);}
generic.cookie.set(amazon_pa_cookie,trimmed_segs,7);if(this.segments===null){generic.monitoring.stop_timing(this.aan_call_name,"in_time",false);}else{generic.monitoring.stop_timing(this.aan_call_name,"late",false);}},aan_iframe_oncall:function(){generic.monitoring.start_timing(custom.amazon.aan_call_name);}},doubleclick:{construct_url:function(hash){var dclkcmd=(hash.match(';ifb=pf;'))?'pfadj':'adj';var params=escape(hash.substring(1,hash.length));params=params.chained_replace([[client_side_ord_regex,ord],[page_segment_regex,custom.amazon.get_segments()]]);params=params.chained_replace(doubleclick_url_unescapes);return"http://ad.doubleclick.net/"+dclkcmd+"/"+params;}},indirect:{close:function(win){if(win.location.href.match("floater")){custom.floater.close(win.frameElement.id);}}},floater:{close:function(id){generic.extend(by_id_(id),{style:{width:'0px',height:'0px'}});},launch:function(url,size,sec,ref_node,insertion_rule,offset,id){if(sec!='none'){setTimeout(function(){custom.floater.close(id);},sec*1000);}
var iframe=document.createElement("iframe");generic.extend(iframe,{id:id,name:id,src:url,width:size[0]+'px',height:size[1]+'px',frameBorder:"0",scrolling:"no",allowTransparency:"true",style:{marginLeft:offset[0]+'px',marginTop:offset[1]+'px',zIndex:offset[2],position:'absolute'}});insertion_rule(iframe,by_id_(ref_node));},set:function(content,size,sec,ref_node,insertion_rule,offset){generic.cache.set("floater",content);var id="floater_"+Math.ceil(Math.random()*9999999);custom.floater.launch(cookie_dumper_url+"?source=cache:floater",size,sec,ref_node,insertion_rule,offset,id);return id;}}};var makeSwfParam=function(name,value){return((value))?'<param name="'+name+'" value="'+value+'">':'';};var makeSwfEmbed=function(name,value){return((value))?' '+name+'="'+value+'" ':'';};this.flashAdUtils={makeFlashAd:function(args){var swfID=args.id;var swfSRC=args.src;var swfWidth=args.width;var swfHeight=args.height;var swfBgcolor=args.bgcolor;var swfWmode=args.wmode||"opaque";var swfSAlign=args.salign;var swfScale=args.scale;var swfExtraParams=args.extraParams;var swfExtraTAGs=args.extraTAGs;var swfMinVersion=args.minVersion;var swfClickThru=escape(args.clickThru);var swfClickTAGs=args.clickTAGs;if(swfID===null||swfSRC===null||swfWidth===null||swfHeight===null){consoleLog('makeFlashAd: Missing required params');return;}
if(!flashAdUtils.canPlayFlash(swfMinVersion)){consoleLog('makeFlashAd: Current flash version too low');}
var clickSTR='';if((swfClickTAGs)){for(var i=0;i<swfClickTAGs.length;i++){if(swfClickTAGs[i]){clickSTR=clickSTR+'&clickTAG'+(i+1)+'='+escape(swfClickTAGs[i]);}}}
if((swfExtraTAGs)){for(var tag in swfExtraTAGs){clickSTR=clickSTR+'&'+escape(tag)+'='+escape(swfExtraTAGs[tag]);}}
clickSTR+="&ord="+ad_utils.ord;var extra_obj='';var extra_emb='';try{var reserved={width:1,height:1,src:1,bgcolor:1,wmode:1,salign:1,scale:1,flashvars:1};for(var param in swfExtraParams){if(reserved[param]){continue;}
extra_obj=extra_obj+makeSwfParam(param,swfExtraParams[param]);extra_emb=extra_emb+makeSwfEmbed(param,swfExtraParams[param]);}}
catch(err){}
var bgcolor_obj=makeSwfParam('bgcolor',swfBgcolor);var bgcolor_emb=makeSwfEmbed('bgcolor',swfBgcolor);var wmode_obj=makeSwfParam('wmode',swfWmode);var wmode_emb=makeSwfEmbed('wmode',swfWmode);var scale_obj=makeSwfParam('scale',swfScale);var scale_emb=makeSwfEmbed('scale',swfScale);var salign_obj=makeSwfParam('salign',swfSAlign);var salign_emb=makeSwfEmbed('salign',swfSAlign);var swfSTR='<object '+
' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '+
' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" '+
' width="'+swfWidth+'" '+
' height="'+swfHeight+'" '+
' id="swf_'+swfID+'">'+
'<param name="movie" value="'+swfSRC+'">'+
'<param name="flashvars" value="env=WEB&clickTAG='+swfClickThru+'&'+clickSTR+'">'+
'<param name="play" value="true">'+
'<param name="quality" value="high">'+
'<param name="allowScriptAccess" value="always">'+
scale_obj+
salign_obj+
bgcolor_obj+
wmode_obj+
extra_obj+
'<!--HACK--><div style="margin-left:0.1px"><embed src="'+swfSRC+'" '+
' flashvars="env=WEB&clickTAG='+swfClickThru+'&'+clickSTR+'" '+
' quality="high" '+
' play="true" '+
' width="'+swfWidth+'" '+
' height="'+swfHeight+'" '+
' name="swf_'+swfID+'" '+
' allowScriptAccess="always" '+
' type="application/x-shockwave-flash" '+
' pluginspage="http://www.macromedia.com/go/getflashplayer" '+
scale_emb+
salign_emb+
bgcolor_emb+
wmode_emb+
extra_emb+
'></embed></div></object>';return swfSTR;},canPlayFlash:function(minFlashVersion){var canPlay=false;var selectedVersion=parseInt(minFlashVersion,10);if(!minFlashVersion||selectedVersion<9){minFlashVersion=9;}
else{minFlashVersion=selectedVersion;}
var flashPlugin=(navigator.mimeTypes&&navigator.mimeTypes["application/x-shockwave-flash"])?navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin:0;if(flashPlugin&&navigator.plugins["Shockwave Flash"]){var words=navigator.plugins["Shockwave Flash"].description.split(" ");var pluginVersion;for(var i=0;i<words.length;++i){if(isNaN(parseInt(words[i],10))){continue;}
pluginVersion=parseInt(words[i],10);}
canPlay=pluginVersion>=minFlashVersion;}
else{if(navigator.userAgent&&navigator.userAgent.indexOf("MSIE")>=0&&(navigator.appVersion.indexOf("Win")!==-1)){try{var axo=new ActiveXObject('ShockwaveFlash.ShockwaveFlash.'+minFlashVersion);axo.AllowScriptAccess="always";var versionStr=axo.GetVariable("$version");var version=versionStr.match(/([0-9]+)/);canPlay=version[1]>=minFlashVersion;}
catch(err){}}}
return canPlay;}};})();document.getElementsByTagName('html')[0].className+=" scriptsOn";
