if(typeof(tracker)=="undefined"){tracker=false}var AdSwap=Class.create({createMovieSizes:function(j){j.addClassName("adtrigger");
var b=j.up("div").identify().replace(/ad-/,"");var a=document.createElement("div");
if(this.movieSizeNav){var f=this.movieSizeNav.cloneNode(true);var h=f.select("a");
h.each(function(m,l){var k=m.getAttribute("href").replace(/.*#/,"#"+b+"-");m.href=k
})}var g=a.cloneNode(true);g.id=b+"-large";g.className="size large";j.parentNode.appendChild(g);
var c=a.cloneNode(true);c.className="movie";c.innerHTML+='<a class="movieLink" href="'+j.href.toString().replace("848x480","640x360")+'?width=640&amp;height=360"></a>';
if(this.endState){c.appendChild(this.endState.cloneNode(true))}if(f){c.appendChild(f.cloneNode(true))
}g.appendChild(c);var e=a.cloneNode(true);e.id=b+"-hd";e.className="size hd";j.parentNode.appendChild(e);
var c=a.cloneNode(true);c.className="movie";c.innerHTML+='<a class="movieLink" href="'+j.href+'?width=848&amp;height=480"></a>';
if(this.endState){c.appendChild(this.endState.cloneNode(true))}if(f){c.appendChild(f.cloneNode(true))
}e.appendChild(c);var d=a.cloneNode(true);d.id=b+"-small";d.className="size small";
j.parentNode.appendChild(d);var c=a.cloneNode(true);c.className="movie";c.innerHTML+='<a class="movieLink" href="'+j.href.toString().replace("848x480","320x180")+'?width=320&amp;height=180"></a>';
if(this.endState){c.appendChild(this.endState.cloneNode(true))}if(f){c.appendChild(f.cloneNode(true))
}d.appendChild(c);var i=a.cloneNode(true);i.id=b+"-medium";i.className="size medium";
j.parentNode.appendChild(i);var c=a.cloneNode(true);c.className="movie";c.innerHTML+='<a class="movieLink" href="'+j.href.toString().replace("848x480","480x272")+'?width=480&amp;height=272"></a>';
if(this.endState){c.appendChild(this.endState.cloneNode(true))}if(f){c.appendChild(f.cloneNode(true))
}i.appendChild(c);j.href="#"+b+"-large"},initialize:function(){this.wrapper=$("display").up();
this.endState=this.wrapper.down(".endState");this.movieSizeNav=this.wrapper.down(".sizenav");
this.ads=$$("#adsnav div a");this.ads.each(this.createMovieSizes.bind(this));this.swapView=new AC.ViewMaster.Viewer(null,"display","adtrigger",{animationDuration:0.4});
this.swapView.setDelegate(this);if(document.location.hash){var c=document.location.hash.replace(/#/,"");
var a=$(c);if(a){var b=this.swapView.addSection(a);this.swapView.show(b)}}if(!this.swapView.currentSection){var b=this.swapView.addSection($$("#adsnav div.size")[0]);
this.swapView.show(b)}else{this.swapView.didAppendContent(this.swapView)}},willShow:function(b,c,a){this.currentId=a.id;
var d=a.id.replace(/.*-/,"");b.options.shouldAnimateContentChange=!(this.currentSize==d);
this.currentSize=d},didAppendContent:function(c){var b=c.currentSection;var a=c.view.view();
if(b&&a){var d=b.content.getDimensions();var e=c.view.view().getDimensions();if(c.options.shouldAnimateContentChange){new Effect.Parallel([new Effect.Scale(a,((d.width/e.width)*100),{scaleY:false,scaleContent:false,sync:true}),new Effect.Scale(a,((d.height/e.height)*100),{scaleX:false,scaleContent:false,sync:true})],{duration:c.options.animationDuration})
}else{a.style.width=d.width+"px";a.style.height=d.height+"px"}}},didShow:function(b,c,a){if(!this.currentId||!this.currentSize){this.currentId=a.id;
this.currentSize=a.id.replace(/.*-/,"")}this.setSize(a.id);b.options.shouldAnimateContentChange=false
},setSize:function(b,c,a){var e=this.currentId;var d=this.currentSize;$$("#adsnav div > a."+this.swapView.triggerClassName).each(function(g){var f=g.href.replace(/.*#(.*)-.*/,"$1");
g.href="#"+f+"-"+d})}});Event.observe(window,"load",function(){if(!tracker){tracker=new AC.ViewMaster.Tracker("click")
}var a=$("adsnav");if(AC.Detector.isMobile()){a.addClassName("mobile");a.select("a").each(function(b){b.href=b.href.replace(b.href.substr(b.href.length-11,7),"r320-9cie")
})}else{a.addClassName("standard");new AdSwap()}});
