function CustomEventDispatcher(){this._listeners={}}
CustomEventDispatcher.prototype={constructor:CustomEventDispatcher,addListener:function(a,d){typeof this._listeners[a]=="undefined"&&(this._listeners[a]=[]);this._listeners[a].push(d)},dispatchEvent:function(a){typeof a=="string"&&(a={type:a});if(!a.target)a.target=this;if(!a.type)throw Error("Event object missing 'type' property.");if(this._listeners[a.type]instanceof Array)for(var d=this._listeners[a.type],b=0,c=d.length;b<c;b++)d[b].call(this,a)},removeListener:function(a,d){if(this._listeners[a]instanceof
Array)for(var b=this._listeners[a],c=0,g=b.length;c<g;c++)if(b[c]===d){b.splice(c,1);break}}};function CustomEvent(a){this.type=a}CustomEvent.prototype={target:null};function ESPYS2011(a,d,b){function c(){a("a.launchBestPlay").live("click",function(b){var c=a(this).metadata({type:"attr",name:"data"});g(this.href,c&&c.width?c.width:null,c&&c.height?c.height:null);b.preventDefault()})}function g(b,c,d){(new OverlayController(a)).init().openBestPlay(b,c!=null?c:970,d!=null?d:612)}function e(b,c,d){(b=document.getElementById(b))&&c.addTab((new d(a,b)).init())}function h(b){ESPYS2011.addressModel.removeListener(ModelEvent.INIT,h);f(b);q.style.visibility="visible";
q.style.overflow="visible";q.style.height="auto";if(k.openOverlay&&k.openOverlay.type!=null&&k.openOverlay.url!=null)switch(k.openOverlay.type.toLowerCase()){case "bestplay":g(k.openOverlay.url,k.openOverlay.width,k.openOverlay.height)}p=(new ALookAboveMediator(a,document.getElementById("aLookAboveModule"),k)).init()}function f(a){var b=ESPYS2011.addressModel.getPathSectionByIndex(0),c;if(!(c=!b))if(c=b!=n){a:{if(c=b){c=c.toLowerCase();for(var d=0;d<m.length;d++)if(c==m[d]){c=!0;break a}}c=!1}c=!c}if(c){var e;
a:{if(k&&k.links)for(e=0;e<k.links.length;e++)if(k.links[e].defaultUrl&&k.links[e].defaultUrl=="true"){e=k.links[e];break a}e=null}l.setValue(ESPYS2011.addressModel.trimSlashes(e.url)+"/")}else if(b!=n)c=b,d=o[c.toLowerCase()],!d||d.defaultUrl==="true"?(e="espysfeatureindex",c="index"):d&&(c=d.omniSection),d&&(e=d.adSection),d=!(!d||d.omniTrack!=null&&d.omniTrack==="false")&&!s,r.placeAd(document.getElementById("ad_728x90"),e,AdType.SIZE_728x90),d&&r.pageTrack(c),s=!1;n=b;j.sendUpdate(a);p&&p.sendUpdate(a)}
function i(){var b=a.fn.fadeIn;a.fn.fadeIn=function(c,d){return b.apply(this,[c,function(){a.browser.msie&&this.style.removeAttribute("filter");a.isFunction(d)&&d()}])};var c=a.fn.fadeOut;a.fn.fadeOut=function(b,d){return c.apply(this,[b,function(){a.browser.msie&&this.style.removeAttribute("filter");a.isFunction(d)&&d()}])};var d=a.fn.fadeTo;a.fn.fadeTo=function(b,c,e){return d.apply(this,[b,c,function(){c==1&&a.browser.msie&&this.style.removeAttribute("filter");a.isFunction(e)&&e()}])}}var j,k=
d,l,m=[],o={},n="notYetSet",q,p,r,s=!0;ESPYS2011.lang=b;this.init=function(){i();ESPYS2011.addressModel=new AddressModel(a);ESPYS2011.addressModel.addListener(ModelEvent.INIT,h);ESPYS2011.addressModel.addListener(ModelEvent.UPDATE,f);l=new AddressController(a,ESPYS2011.addressModel);r=new AdController(a);ESPYS2011.stateModel=new StateModel;ESPYS2011.stateModel.addListener(ModelEvent.UPDATE,f);q=document.getElementById("mainContent");j=(new TabGroupContainerMediator(a,q)).init();e("sectionBehindProduction",
j,BehindProductionSectionMediator);e("moments",j,MomentsSectionMediator);e("tv",j,TVSectionMediator);e("arthurashe",j,ArthurAsheSectionMediator);e("vfoundation",j,VFoundationSectionMediator);e("environmentality",j,EnvironmentalitySectionMediator);e("sectionVoting",j,VotingSectionMediator);e("sectionESPYSLive",j,LiveSectionMediator);e("sectionGiftBag",j,GiftBagSectionMediator);for(var b=0;b<k.links.length;b++){var g=ESPYS2011.addressModel.getPathSectionByIndex(0,ESPYS2011.addressModel.trimAnchor(d.links[b].url));
g&&(g=g.toLowerCase(),m.push(g),o[g]=d.links[b])}ESPYS2011.stateModel.init();ESPYS2011.addressModel.init();(b=document.getElementById("countdownClock"))&&(new CountdownMediator(a,b,new Date("July 13, 2011 9:00:00 pm"))).init();c()}}(function(a){ESPYS2011.extend=function(d,b){d.prototype=new b(a);d.prototype.constructor=d;d.uber=b.prototype};ESPYS2011.getRootURL=function(){var a=function(a,b){var d=a.lastIndexOf(b);return d!=-1?a.substring(0,d):a},b=document.URL,b=a(b,"#"),b=a(b,"/");return b+"/"}})(jQuery);function Mediator(a,d){CustomEventDispatcher.apply(this,arguments);var b=this;b.el=d;b.initialized=!1;b.init=function(){b.initialized=!0;return b};b.sendUpdate=function(){}}ESPYS2011.extend(Mediator,CustomEventDispatcher);function TabNavBtnMediator(a,d,b){Mediator.apply(this,arguments);var c=this,g=b,e,h,f,i,j,k=!1,l,m=c.init;c.init=function(){var b=a(c.el);h=new AddressController(a,ESPYS2011.addressModel);g.addListener(ModelEvent.UPDATE,c.sendUpdate);e=new StateController(g);b.find("a[address][href]").each(function(){var c=a(this);f=Boolean(c.attr("address")==="true");i=l=ESPYS2011.addressModel.getStrictDeeplink(c.attr("href"));var d=c.attr("unique");j=d&&d.toLowerCase()==="true"?!0:!1;c.click(function(a){a.preventDefault()});
b.click(function(){f?h.setValue(i):e.changeState(i)})});m();return c};var o=c.sendUpdate;c.sendUpdate=function(){f?c.toggleSelect(!j&&ESPYS2011.addressModel.isUrlWithinPath(i,ESPYS2011.addressModel.value)||j&&ESPYS2011.addressModel.isUrlMatch(i,ESPYS2011.addressModel.value)):c.toggleSelect(g.getValue()===i);o()};c.setUrl=function(b){var d=b!=null?b:l;a(c.el).find("a[address][href]").each(function(){a(this).attr("href",d);i=ESPYS2011.addressModel.getStrictDeeplink(d)});c.sendUpdate()};c.toggleSelect=
function(b){k&&!b?(k=!1,a(c.el).toggleClass("active",!1),c.dispatchEvent(new NavBtnEvent(NavBtnEvent.TOGGLE))):!k&&b&&(k=!0,a(c.el).toggleClass("active",!0),c.dispatchEvent(new NavBtnEvent(NavBtnEvent.TOGGLE)))};c.getUrl=function(){return i};c.isUnique=function(){return j};c.usesAddress=function(){return f};c.isSelected=function(){return k}}ESPYS2011.extend(TabNavBtnMediator,Mediator);function NavBtnEvent(){CustomEvent.apply(this,arguments)}ESPYS2011.extend(NavBtnEvent,CustomEvent);
NavBtnEvent.TOGGLE="toggle";function TabItemMediator(a){function d(b){var c;b.find(".transitionSlideDown").each(function(){c=new TransitionMediator(a,this,"transitionSlideDown");f.push(c)}).end().find(".transitionInFade").each(function(){c=new TransitionMediator(a,this,"transitionInFade");f.push(c)})}function b(a,d){d?c.dispatchEvent(new TransitionEvent(TransitionEvent.OPEN_COMPLETE)):(i++,i<f.length&&f[i].open(d,b),i>=f.length&&c.dispatchEvent(new TransitionEvent(TransitionEvent.OPEN_COMPLETE)))}Mediator.apply(this,arguments);
var c=this;c.index=-1;var g,e,h=!1,f=[],i=0,j=c.init;c.init=function(){var b=a(c.el);g=b.attr("url");var f=b.attr("unique");e=f&&f.toLowerCase()==="true"?!0:!1;d(b);j();return c};c.open=function(b,d){h=!0;var e=a(c.el),f=function(){c._onOpenComplete(b)};b?e.stop(!0,!1,!1).show(0,f):e.stop(!0,!1,!1).fadeIn("normal",f);return d?d:e};c._onOpenComplete=function(d){a(c.el).show().fadeTo(0,1);if(d){for(var e=0;e<f.length;e++)f[e].open(d);b(null,d)}else i=0,f.length>0&&f[0].open(d,b)};c.close=function(b,
d){var e=h,f=a(c.el),i=function(){c._onCloseComplete(b)};b?(f.stop(!0,!1,!1).slideUp(0).hide(),c._onCloseComplete(b)):e&&f.stop(!0,!1,!1).slideUp(0,i);return d?d:f};c._onCloseComplete=function(a){h=!1;for(var b=0;b<f.length;b++)f[b].close(a)};c.getUrl=function(){return g};c.isOpen=function(){return h};c.isUnique=function(){return e}}ESPYS2011.extend(TabItemMediator,Mediator);function TabGroupContainerMediator(a,d,b,c){function g(a){f.sendUpdate(a)}function e(){var b=a(f.el).attr("navId");return b?document.getElementById(b):null}function h(a,b,c){var d;if(a&&f.isStacking())a.index!=i?(a.el.style.zIndex=""+a.index+"",d=a.close(b,c)):(a.el.style.zIndex=""+j.length+"",d=a.open(b,c));return d}Mediator.apply(this,arguments);var f=this,i=-1,j=[],k=[],l={};f.parentStack=null;var m,o;f.isStacking=null;var n=[],q=!1,p=f.init;f.init=function(){switch(b){case TabGroupContainerMediator.TYPE_SLIDER:o=
TabGroupContainerMediator.TYPE_SLIDER;m=a(d).find(".tabSlider").first();break;default:o=TabGroupContainerMediator.TYPE_STACK}var c=e();if(c)f.stateModel=new StateModel,f.stateModel.addListener(ModelEvent.UPDATE,g),a(c).children("li").each(function(){var b=(new TabNavBtnMediator(a,this,f.stateModel)).init();n.push(b);!q&&b.usesAddress()&&(q=!0)});f.close();p();return f};f.isStacking=function(){return Boolean(o==TabGroupContainerMediator.TYPE_STACK)};f.addTab=function(b){if(b instanceof TabItemMediator){var c=
j.length;b.index=c;var d=b.getUrl();d&&(l[d]=b);j.push(b);if(!f.isStacking())d=a(f.el),d=parseInt(d.width()),b.el.style.left=c*d+"px",m.width(j.length*d+"px");h(b,!0)}else throw"addTab must be passed a TabItemMediator";};f.addStack=function(a){if(a instanceof TabGroupContainerMediator)k.push(a);else throw"addStack must be passed a TabGroupContainerMediator";};f.selectByIndex=function(b,d){i=b;if(f.isStacking()){for(var e,g=0;g<j.length;g++)if(g!=i){var k=j[g];k.isOpen()&&(e=h(k,d,e))}i!=-1&&h(j[i],
d,e)}else if(i!=-1){e=a(f.el);g=parseInt(e.width());k=parseInt(a(j[i].el).height());c&&e.parent().toggleClass("closed",!1);var l=d?0:1150;m.stop(!0,!1,!0,!0).animate({left:-g*b+"px",leaveTransforms:!1},l,"easeInOutExpo",null,!0);e.stop(!0,!1,!0,!0).animate({height:k+"px",leaveTransforms:!1},l,"easeInOutExpo",null,!0)}};f.getTabByIndex=function(a){return j[a]};f.getNumberOfTabs=function(){return j.length};f.selectLast=function(a){f.selectByIndex(j.length-1,a)};f.selectByUrl=function(a,b){f.selectByTab(l[a],
b)};f.selectByTab=function(a,b){a&&f.selectByIndex(a.index,b)};f.close=function(){!f.isStacking()&&c&&a(f.el).css("height","0px").parent().toggleClass("closed",!0);i=-1;f.stateModel.reset()};var r=f.sendUpdate;f.sendUpdate=function(a){var b=Boolean(!a||a.type==ModelEvent.INIT);for(url in l){var c=l[url];if(q&&(!c.isUnique()&&ESPYS2011.addressModel.isUrlWithinPath(url)||c.isUnique()&&ESPYS2011.addressModel.isUrlMatch(c.getUrl(),ESPYS2011.addressModel.value))||!q&&f.stateModel&&f.stateModel.getValue()==
url){c.index!=i&&f.selectByTab(c,b);break}}for(b=0;b<j.length;b++)c=j[b],c.isOpen()&&c.sendUpdate(a);for(c=0;c<n.length;c++)n[c].sendUpdate(a);r()};f.getNavBtnByID=function(a){for(var b=0;b<n.length;b++){var c=n[b],d=c.el.id;if(d&&d===a)return c}return null}}ESPYS2011.extend(TabGroupContainerMediator,Mediator);TabGroupContainerMediator.TYPE_STACK="stack";TabGroupContainerMediator.TYPE_SLIDER="slider";function CountdownMediator(a,d,b){function c(a){e.days.html(g(a[3]));e.hours.html(g(a[4]));e.minutes.html(g(a[5]));e.seconds.html(g(a[6]))}function g(a){var b=String(a);a<10&&a>-1&&(b="0"+b);return b}Mediator.apply(this,arguments);var e=this,h=e.days=e.hours=e.minutes=e.seconds=null,f=!1,i=e.init;e.init=function(){var d=a(e.el);e.days=d.find(".countdownDays");e.hours=d.find(".countdownHours");e.minutes=d.find(".countdownMinutes");e.seconds=d.find(".countdownSeconds");h=d.offset().top;var g=document.createElement("span"),
l=-b.getTimezoneOffset()/60;a(g).countdown({until:a.countdown.UTCDate(l,b),onTick:c});a.support.touch||a(window).scroll(function(){a(this).scrollTop()>h&&!f?(d.css({position:"fixed",top:"0"}),f=!0):a(this).scrollTop()<=h&&f&&(d.css({position:"absolute",top:"322px"}),f=!1)});i();return e}}ESPYS2011.extend(CountdownMediator,Mediator);function TransitionMediator(a,d,b){Mediator.apply(this,arguments);var c=this,g=!0;new CssRef(d);switch(b){case "transitionSlideDown":b=function(b){a(c.el).stop(!0,!1,!1).slideUp(0).slideDown(100,b)};break;case "transitionInFade":b=function(b){a(c.el).stop(!0,!0,!1).hide().fadeIn("slow",b)}}c.open=function(e,h){var f=function(){h&&(typeof h).toLowerCase()==="function"&&h(c,e);c.dispatchEvent(new TransitionEvent(TransitionEvent.OPEN_COMPLETE))};g?c.dispatchEvent(new TransitionEvent(TransitionEvent.OPEN_COMPLETE)):
(g=!0,e?a(d).stop(!0,!0,!1).show(0,f):b&&b(f))};c.close=function(b){var d=g;g=!1;b?a(c.el).stop(!0,!0,!1).hide():d&&a(c.el).stop(!0,!0,!1).hide()};c.isOpen=function(){return g}}ESPYS2011.extend(TransitionMediator,Mediator);function TransitionEvent(){CustomEvent.apply(this,arguments)}ESPYS2011.extend(TransitionEvent,CustomEvent);TransitionEvent.OPEN_COMPLETE="openComplete";function extendCopy(a){var d={},b;for(b in a)d[b]=a[b];d.uber=a;return d}
function CssRef(a){var d=extendCopy(a.style);this.restore=function(){for(var b in a.style)try{a.style[b]=d[b]}catch(c){}};return this};function SectionAbstractMediator(a){function d(){if(b.video&&b.video.useAddress&&!ESPYS2011.addressModel.hasVideo()){var a=b.video.getVideoByIndex(0);a&&b.addressController.setValue(a.url)}}TabItemMediator.apply(this,arguments);var b=this,c;b._titleController=null;b.video=b.photo=b.title=b.url=b.addressController=null;b._moreVideoThumbs=[];b.subContentGroups=[];var g,e,h,f=b.init;b.init=function(){var c=a(b.el);b.title=c.attr("title");b.url=c.attr("url");c.removeAttr("title");b._titleController=new BrowserTitleController(a,
ESPYS2011.addressModel.getBaseTitle());b.addressController=new AddressController(a,ESPYS2011.addressModel);var e=c.find("video.memVideo").get(0);b.video=e?(new VideoMediator(a,e)).init():null;if(!SectionAbstractMediator.moreVideosTooltipSkin)SectionAbstractMediator.moreVideosTooltipSkin=a(".more-videos-rollover").first().html();a.browser.msie?c.find(".mod-container.more-videos a[title][href][address][ceID]").each(function(){b._moreVideoThumbs.push((new MoreVideoThumbMediator(a,this)).init())}):c.find(".mod-container.more-videos a[title][href][address][ceID]").tooltip({tipClass:"more-videos-rollover",
effect:"slide",position:"top center",onBeforeShow:function(){var a=this.getTip(),b=a.html();a.html(SectionAbstractMediator.moreVideosTooltipSkin).children(".label").html(b)}}).each(function(){b._moreVideoThumbs.push((new MoreVideoThumbMediator(a,this)).init())});g=c.children("aside.secondarySubHead").first().html();b.addListener(TransitionEvent.OPEN_COMPLETE,d);f();return b};var i=b.open;b.open=function(c,d){b.setTitle();a("#secondarySubHead").html(g?g:" ");b.photo&&(b.photo.hide(),b.photo.sendUpdate());
i(c,d)};var j=b.close;b.close=function(a,c){b.video&&b.video.clearVideo();j(a,c)};b._initSubContent=function(){var c=a(b.el);if(!b.video){var d=c.find("div.memPhoto").get(0);b.photo=d?(new PhotoMediator(a,d)).init():null}c.find(".tabGroupContainer.subContentContainer").each(function(){var c=a(this),d=c.attr("tabType");switch(d){case TabGroupContainerMediator.TYPE_SLIDER:case TabGroupContainerMediator.TYPE_STACK:break;default:d=TabGroupContainerMediator.TYPE_SLIDER}var e=new TabGroupContainerMediator(a,
this,d);b.subContentGroups.push(e);e.init();(d===TabGroupContainerMediator.TYPE_SLIDER?c.children(".tabSlider").first().children(".tabContent"):c.children(".tabContent")).each(function(){var b=(new TabItemMediator(a,this)).init();e.addTab(b.init())});e.sendUpdate()})};var k=b.sendUpdate;b.sendUpdate=function(a){var d=ESPYS2011.addressModel.value;d!=c&&(c=d,b.setTitle());for(d=0;d<b.subContentGroups.length;d++)b.subContentGroups[d].sendUpdate();b.video&&b.video.sendUpdate(a);b.photo&&b.photo.sendUpdate(a);
for(d=0;d<b._moreVideoThumbs.length;d++)b._moreVideoThumbs[d].sendUpdate(a);k()};b.getNavBtnByID=function(a){for(var c=0;c<b.subContentGroups.length;c++){var d=b.subContentGroups[c].getNavBtnByID(a);if(d)return d}return null};b.setTitle=function(){b._titleController.setTitle(b.getTitle())};b.getTitle=function(){return b.title};b.setMediaContent=function(c,d){var f=d?ESPYS2011.addressModel.getVideoValue():ESPYS2011.addressModel.getPhotoValue(),g=d?h:e;if((d?b.video:b.photo)&&f&&f!=g){if((g=d?b.video.getVideoByID(f):
b.photo.getPhotoByID(f))&&c){var i=a(c);i.children("h3").first().html(g.title!=null?g.title:"undefined");i.children("p").first().html(g.caption!=null?g.caption:"undefined")}d?h=f:e=f}}}ESPYS2011.extend(SectionAbstractMediator,TabItemMediator);SectionAbstractMediator.moreVideosTooltipSkin=null;function BehindProductionSectionMediator(a,d){function b(){var b;if((b=e==="es"?ESPYS2011.addressModel.getPhotoValue():ESPYS2011.addressModel.getVideoValue())&&b!=g){var d;if(d=e==="es"?c.photo.getPhotoByID(b):c.video.getVideoByID(b)){var f=a("#behindProductionContent");f.children("h3").first().html(d.title);f.children("p").first().html(d.caption)}g=b}}SectionAbstractMediator.apply(this,arguments);var c=this,g,e=a(d).attr("lang"),e=e?e:"en",h=c.init;c.init=function(){h();var d=a(c.el).find("div.memPhoto").get(0);
c.photo=d?(new PhotoMediator(a,d)).init():null;b();return c};var f=c.sendUpdate;c.sendUpdate=function(){if(e==="es"&&c.photo&&!ESPYS2011.addressModel.hasPhoto()){var a=c.photo.getPhotoByIndex(0);a&&c.addressController.setValue(a.url)}else b();f()}}ESPYS2011.extend(BehindProductionSectionMediator,SectionAbstractMediator);function MomentsSectionMediator(a){SectionAbstractMediator.apply(this,arguments);var d=this,b,c,g=d.init;d.init=function(){var e=a(d.el).find(".tabGroupContainer").first();b=new TabGroupContainerMediator(a,e.get(),TabGroupContainerMediator.TYPE_SLIDER,!0);b.init();e.children(".tabSlider").first().children(".tabContent").each(function(){var c=(new TabItemMediator(a,this)).init();b.addTab(c.init());a(this).children(".pastWinnersContentMasonryContainer").first().masonry({itemSelector:"dl",columnWidth:145,
gutterWidth:20,isFitWidth:!0,isResizable:!1})});b.sendUpdate();c=document.getElementById("momentsContent");g();d.setMediaContent(c,!0);return d};var e=d.sendUpdate;d.sendUpdate=function(a){b.sendUpdate(a);d.setMediaContent(c,!0);e()};var h=d.close;d.close=function(a,c){b.close();h(a,c)}}ESPYS2011.extend(MomentsSectionMediator,SectionAbstractMediator);function TVSectionMediator(){SectionAbstractMediator.apply(this,arguments);var a=this,d,b=a.init;a.init=function(){d=document.getElementById("tvContent");b();a.setMediaContent(d,!0);return a};var c=a.sendUpdate;a.sendUpdate=function(){a.setMediaContent(d,!0);c()}}ESPYS2011.extend(TVSectionMediator,SectionAbstractMediator);function ArthurAsheSectionMediator(a){SectionAbstractMediator.apply(this,arguments);var d=this,b,c=d.init;d.init=function(){d._initSubContent();var e=new StateModel;b=new SubTabContentControl(a,d.photo,document.getElementById("arthurPastWinnersContent"),d.getNavBtnByID("arthurPastNavBtn"),document.getElementById("arthurPastWinnersNav"),e);b.init();c();return d};var g=d.sendUpdate;d.sendUpdate=function(a){b.sendUpdate(a);g()}}ESPYS2011.extend(ArthurAsheSectionMediator,SectionAbstractMediator);function VFoundationSectionMediator(a){function d(){h===b.video&&b.video.loadFirstVideo()}SectionAbstractMediator.apply(this,arguments);var b=this,c="notYetSet",g,e=!1,h,f=b.init;b.init=function(){b._initSubContent();var c=new StateModel;g=new SubTabContentControl(a,b.photo,document.getElementById("vfPastWinnersContent"),b.getNavBtnByID("vfoundationPastNavBtn"),document.getElementById("vfPastWinnersNav"),c);g.init();f();if(b.video)b.video.useAddress=!1;if(b.video&&b.photo)e=!0,b.photo.getPhotoByURL(ESPYS2011.addressModel.value)?
(h=b.photo,a(b.video.el).remove()):(h=b.video,a(b.photo.el).remove(),b.addListener(TransitionEvent.OPEN_COMPLETE,d));return b};var i=b.sendUpdate;b.sendUpdate=function(d){if(ESPYS2011.addressModel.value!=c)c=ESPYS2011.addressModel.value;if(e){var f=b.photo.getPhotoByURL(ESPYS2011.addressModel.value);if((f&&h===b.video||!f&&h===b.photo)&&e)h===b.video?(a(b.video.el).replaceWith(b.photo.el),h=b.photo,b.photo.reset()):(a(b.photo.el).replaceWith(b.video.el),h=b.video,b.video.loadFirstVideo())}g.sendUpdate(d);
i()}}ESPYS2011.extend(VFoundationSectionMediator,SectionAbstractMediator);function EnvironmentalitySectionMediator(a){SectionAbstractMediator.apply(this,arguments);var d=this,b,c,g,e,h=d.init;d.init=function(){var f=a(d.el);b=a("header nav ul");c=a("header nav .theme");var i=f.find("div.memPhoto").get(0);d.photo=i?(new PhotoMediator(a,i)).init():null;f=f.find(".tabGroupContainer").first();g=new TabGroupContainerMediator(a,f.get(),TabGroupContainerMediator.TYPE_SLIDER);g.init();f.children(".tabSlider").first().children(".tabContent").each(function(){var b=(new TabItemMediator(a,
this)).init();g.addTab(b.init())});g.getNumberOfTabs()>0&&(f=g.getTabByIndex(0),g.stateModel.reset(f.getUrl()));g.sendUpdate();e=document.getElementById("environmentalityContent");h();d.setMediaContent(e,!1);return d};var f=d.sendUpdate;d.sendUpdate=function(a){g.sendUpdate(a);d.photo&&!ESPYS2011.addressModel.hasPhoto()&&(a=d.photo.getPhotoByIndex(0))&&d.addressController.setValue(a.url);d.setMediaContent(e,!1);f()};var i=d.open;d.open=function(a,d){b.toggleClass("tabMenu-env",!0);c.toggleClass("theme-env",
!0);i(a,d)};var j=d.close;d.close=function(a,d){b.toggleClass("tabMenu-env",!1);c.toggleClass("theme-env",!1);j(a,d)}}ESPYS2011.extend(EnvironmentalitySectionMediator,SectionAbstractMediator);function VotingSectionMediator(a){SectionAbstractMediator.apply(this,arguments);var d=this,b=!1,c=d.open;d.open=function(e,g){var f=a(d.el);f.parent().toggleClass("mBot-29",!1);if(!b){var i=a("#votingFrame");if(f=f.metadata({type:"attr",name:"data"}))f=ESPYS2011.getRootURL()+f.src,i.attr("src",f),b=!0}c(e,g)};var g=d.close;d.close=function(b,c){a(d.el).parent().toggleClass("mBot-29",!0);g(b,c)}}ESPYS2011.extend(VotingSectionMediator,SectionAbstractMediator);function GiftBagSectionMediator(a){SectionAbstractMediator.apply(this,arguments);a("div.giftBag li.active").hide();a(".giftBag-mem").hide();a("a.giftBag-btn").live("click",function(d){a(".giftBag-mem").fadeIn();a(".giftBagdiv11").hide();a(".giftBagdiv7").hide();d.preventDefault()});a("div.closeBtn-cont > a.closeBtn").live("click",function(d){a(".giftBag-mem").hide();a(".giftBagdiv11").fadeIn();a(".giftBagdiv7").fadeIn();d.preventDefault()});a("a.viewGift").click(function(){a("div.giftBag li.active").hide();
a(this).parent().hide();a("div.giftBag").addClass("giftBag-overlay");a("div.blackBG").show();var d=a(this).attr("id");a("li."+d+"active").fadeIn();return!1});a("div.giftBag-popup-cont > a.closeBtn").live("click",function(d){a("div.giftBag li.active").hide();a("li.giftstills").show();a("div.blackBG").hide();a("div.giftBag").removeClass("giftBag-overlay");d.preventDefault()});a("li.giftstills img").hover(function(){altSrc=a(this).attr("src").replace("&grayscale=true","");a(this).attr("src",altSrc)},
function(){altSrc=a(this).attr("src")+"&grayscale=true";a(this).attr("src",altSrc)})}ESPYS2011.extend(GiftBagSectionMediator,SectionAbstractMediator);function LiveSectionMediator(a){SectionAbstractMediator.apply(this,arguments);var d=this.open;this.open=function(){a(".twitterwidget-iframe").attr("src","");a(".twittersphere-iframe").attr("src","http://massrelevance.s3-website-us-east-1.amazonaws.com/espn-espy-2011-dayof/index.html");a(".livestream-iframe").attr("src","http://cdn.livestream.com/embed/espnlivechat?layout=4&amp;autoplay=true");a(".coveritlive-iframe").attr("src","http://www.coveritlive.com/index2.php/option=com_altcaster/task=viewaltcast/altcast_code=63dd1a0628/height=418/width=970");
a(".espys-live-btns-cont").show();a(".livestream-iframe").show();a(".coveritlive-iframe").show();a(".cil-header").show();a(".espys-live-ea-placeholder").show();a(".mod-headlines").hide();a("#aLookAboveModule").hide();a(".mod-twitter").hide();d()};var b=this.close;this.close=function(){a(".twitterwidget-iframe").attr("src","http://massrelevance.s3-website-us-east-1.amazonaws.com/espn-espy-2011/index.html");a(".twittersphere-iframe").attr("src","");a(".livestream-iframe").attr("src","");a(".coveritlive-iframe").attr("src",
"");a(".espys-live-btns-cont").hide();a(".mod-headlines").show();a("#aLookAboveModule").show();a(".mod-twitter").show();b()};a("a.backstage").addClass("active");a(".twittersphere-iframe").hide();a(".livestream-iframe").hide();a(".coveritlive-iframe").hide();a(".cil-header").hide();a(".espys-live-ea-placeholder").hide();a(".espys-live-btns-cont").hide();a("a.twittersphere").click(function(){a(".livestream-iframe").attr("src","");a(".coveritlive-iframe").attr("src","");a(".twittersphere-iframe").attr("src",
"http://massrelevance.s3-website-us-east-1.amazonaws.com/espn-espy-2011-dayof/index.html");a(".livestream-iframe").hide();a(".coveritlive-iframe").hide();a(".twittersphere-iframe").fadeIn();a(".espys-live-ea-placeholder").hide();a(".cil-header").hide();a("a.backstage").removeClass("active");a("a.twittersphere").addClass("active");return!1});a("a.backstage").click(function(){a(".livestream-iframe").attr("src","http://cdn.livestream.com/embed/espnlivechat?layout=4&amp;autoplay=true");a(".coveritlive-iframe").attr("src",
"http://www.coveritlive.com/index2.php/option=com_altcaster/task=viewaltcast/altcast_code=63dd1a0628/height=418/width=970");a(".twittersphere-iframe").attr("src","");a(".livestream-iframe").fadeIn();a(".coveritlive-iframe").fadeIn();a(".twittersphere-iframe").hide();a(".espys-live-ea-placeholder").fadeIn();a(".cil-header").fadeIn();a("a.backstage").addClass("active");a("a.twittersphere").removeClass("active");return!1})}ESPYS2011.extend(LiveSectionMediator,SectionAbstractMediator);function VideoMediator(a){function d(){var b="";b+='<iframe scrolling="no" marginheight="0" marginwidth="0" frameborder="0" width="'+h+'" height="'+f+'" style="visibility:hidden;" onload="this.style.visibility = \'visible\';"></iframe>';g.el.innerHTML=b;j=a(g.el).children("iframe").first()}function b(a,b,c,d){b="http://espn.go.com/videohub/mpf/frame/playerEmbed?id="+a+"&player=iFrame_promo09_16_9_noMenu_dev&height="+c+"&width="+b+"&autoStart="+(d?"true":"false");a==9999999&&(b="http://cdn.livestream.com/embed/espnlivechat?layout=4&amp;autoplay=true");
return b}function c(a){return new MediaVO(a.attr("ceID"),a.attr("title"),a.html(),a.attr("img"),parseInt(a.attr("width")),parseInt(a.attr("height")),ESPYS2011.addressModel.getStrictDeeplink(a.attr("url")),!0)}Mediator.apply(this,arguments);var g=this,e,h=576,f=324,i=null,j=null;g.useAddress=!0;var k=g.init;g.init=function(){e=[];var b=a(g.el);e.push(c(b));b.siblings("video.memVideo").each(function(){var b=a(this);e.push(c(b))});var f=document.createElement("div");f.setAttribute("class","memVideo");
b.parent().empty().append(f);g.el=f;d();k();return g};g.loadVideo=function(a){g.loadVideoByID(a.id,a.width,a.height,a.autoStart)};g.loadVideoByID=function(a,c,e,k){g.initialized||g.init();a&&a!=i&&(isNaN(c)||(h=c),isNaN(e)||(f=e),j||d(),j.css("visibility","hidden"),j.attr("src",b(a,c,e,k)),i=a)};g.clearVideo=function(){g.el.innerHTML="";i=j=null};g.loadFirstVideo=function(a){g.initialized||g.init();e.length>0&&g.loadVideo(e[0],a)};g.getVideoByIndex=function(a){return a<e.length?e[a]:null};g.getVideoByID=
function(a){for(var b=0;b<e.length;b++){var c=e[b];if(c.id===a)return c}return null};var l=g.sendUpdate;g.sendUpdate=function(a){if(g.useAddress){var b=ESPYS2011.addressModel.getVideoValue();b&&b!=i&&g.loadVideoByID(b,h,f,!0)}l(a)};g.getPlayID=function(){return i}}ESPYS2011.extend(VideoMediator,Mediator);function MoreVideoThumbMediator(a){function d(){if(ESPYS2011.addressModel.hasVideo()){var a=ESPYS2011.addressModel.getVideoValue();return a&&a===g}else return ESPYS2011.addressModel.hasPhoto()?(a=ESPYS2011.addressModel.getPhotoValue())&&a===g:!1}Mediator.apply(this,arguments);var b=this,c;b.selected=!1;var g,e,h=b.init;b.init=function(){e=new ImageFader(a,b.el);c=new AddressController(a,ESPYS2011.addressModel);var f=a(b.el),j=Boolean(f.attr("address")==="true");g=f.attr("ceID");if(j){var k=ESPYS2011.addressModel.getStrictDeeplink(f.attr("href"));
f.click(function(a){a.preventDefault();c.setValue(k)})}d()&&b.select(!0);h();return b};b.select=function(a){b.selected=!0;e.select(a)};b.deselect=function(a){b.selected=!1;e.deselect(a)};var f=b.sendUpdate;b.sendUpdate=function(){var a=d();b.selected&&!a?b.deselect():!b.selected&&a&&b.select();f()}}ESPYS2011.extend(MoreVideoThumbMediator,Mediator);function PhotoMediator(a){function d(a,b,c){a=document.createElement(a);b!=null&&a.setAttribute("class",b);c!=null&&a.setAttribute("name",c);return a}function b(b){if(b===f){var c=!a.browser.msie?k.parent():null;switch(b){case e:c&&c.stop(!0,!1).fadeTo(m,0);j.stop(!0,!1).fadeTo(m,1);break;default:c&&c.stop(!0,!1).fadeTo(m,1),j.stop(!0,!1).fadeTo(m,1)}}}Mediator.apply(this,arguments);var c=this,g,e,h,f,i,j,k,l,m="slow",o=c.init;c.init=function(){g=[];a(c.el).children("aside.noDisplay[data]").each(function(){var b=
ESPYSUtils.getMediaVOByMetaData(a(this));b&&b.imgSrc&&g.push(b)});o();return c};c.loadPhotoByIndex=function(a){(a=c.getPhotoByIndex(a))&&c.loadPhotoByVO(a)};c.loadPhotoByVO=function(a){c.loadPhoto(a.imgSrc)};c.loadPhoto=function(g){c.initialized||c.init();if(g&&g!=i){var p;if(f)f=f===e&&l&&!a.browser.msie?h:e,p=a(f);else{var r=d("div","fadeContainer");e=f=r.appendChild(d("img","layer1","imgA"));var m=function(){f===this&&b(this)};a.browser.msie||(h=r.appendChild(d("div","layer2")).appendChild(d("img",
null,"imgB")),k=a(h),k.load(m));p=j=a(e);j.load(m);p.fadeTo(0,0);a(c.el).empty().append(r)}i=g;g=p.attr("src");i&&i!=g&&p.attr("src",i);b(f)}};c.reset=function(){l=null;c.sendUpdate()};var n=c.sendUpdate;c.sendUpdate=function(a){var b=ESPYS2011.addressModel.value;if(b!=l){var d=c.getPhotoByURL(b);d&&d.imgSrc!=i?c.loadPhotoByVO(d):d||(k&&k.parent().stop(!0,!1).fadeTo(m,0),j&&j.stop(!0,!1).fadeTo(m,0),i=null);l=b}n(a)};c.hide=function(){e&&h&&(a.browser.msie||k.parent().stop(!0,!1).fadeTo(0,0),j.stop(!0,
!1).fadeTo(0,0),l=i=null)};c.getPhotoByIndex=function(a){return a<g.length?g[a]:null};c.getPhotoByURL=function(a){for(var b in g){var c=g[b];if(c.url&&ESPYS2011.addressModel.isUrlMatch(c.url,a))return c}return null};c.getPhotoByID=function(a){for(var b=0;b<g.length;b++){var c=g[b];if(c.id===a)return c}return null}}ESPYS2011.extend(PhotoMediator,Mediator);function ALookAboveMediator(a,d,b){function c(c){for(var d=a.merge([],b.links),e=0;e<c.length;e++){var f;a:{for(f=0;f<d.length;f++)if(d[f].ceID===c[e])break a;f=-1}f!=-1&&d.splice(f,1)}return d[Math.floor(Math.random()*(d.length-1)+1)]}function g(a){for(var c=0;c<b.links.length;c++)if(ESPYS2011.addressModel.isUrlWithinPath(a,b.links[c].url))return b.links[c].ceID;return null}Mediator.apply(this,arguments);var e=this,h,f="notYetSet",i=e.init;e.init=function(){e.sendUpdate();i();return e};var j=e.sendUpdate;
e.sendUpdate=function(a){var c=ESPYS2011.addressModel.getPathSectionByIndex(0);if(!c)a:{if(b&&b.links)for(c=0;c<b.links.length;c++)if(b.links[c].defaultUrl&&b.links[c].defaultUrl=="true"){c=b.links[c].url;break a}c=null}c!=f&&(f=c,e.changeModule());j(a)};e.changeModule=function(){var b=[];h&&b.push(h);var d=g(f);d&&b.push(d);if((b=c(b))&&b.ceID!=h){var i=a(e.el),j=!1;h=b.ceID;var n=ESPYS2011.getRootURL()+"format/aLookAbove";i.load(n,"sectionID="+h,function(a){j||i.html(a)}).ajaxError(function(a,b,
c){c.url==n&&(j=!0)})}}}ESPYS2011.extend(ALookAboveMediator,Mediator);function Model(){var a=this;CustomEventDispatcher.apply(this,arguments);a.init=function(){a.dispatchEvent(new ModelEvent(ModelEvent.INIT))};a.sendUpdate=function(){a.dispatchEvent(new ModelEvent(ModelEvent.UPDATE))}}ESPYS2011.extend(Model,CustomEventDispatcher);function ModelEvent(){CustomEvent.apply(this,arguments)}ESPYS2011.extend(ModelEvent,CustomEvent);ModelEvent.UPDATE="update";ModelEvent.INIT="init";function AddressModel(a){function d(i){var j=a.address.value();if(g){if(j!=c.value)c.value=j,e=b(j),c.sendUpdate()}else g=!0,f(),d(i)}function b(a){var b=a.split("/");(a.substr(0,1)=="/"||a.length==0)&&b.splice(0,1);a.substr(a.length-1,1)=="/"&&b.splice(b.length-1,1);return b}var c=this;Model.apply(this,arguments);var g=!1;c.value=a.address.value();var e=null,h=a.address.title(),f=c.init;c.init=function(){e=b(c.value);a.address.strict(!0).crawlable(!0).wrap(!0).init(d).change(d);d()};c.isUrlWithinPath=
function(b,d){var e=d?d:a.address.value();return c.trimSlashes(e.toLowerCase()).indexOf(c.trimSlashes(b.toLowerCase()))==0};c.isUrlMatch=function(b,d){var e=d?d:a.address.value();return c.trimSlashes(e.toLowerCase())==c.trimSlashes(b.toLowerCase())};c.trimSlashes=function(a){a=c.trimAnchor(a);a=a.indexOf("/")==0?a.substr(1):a;return a=a.lastIndexOf("/")==a.length-1?a.substr(0,a.length-1):a};c.trimAnchor=function(a){var b=a.indexOf("#!")==0?a.substr(2):a;return b=a.indexOf("#")==0?a.substr(1):a};c.getBaseTitle=
function(){return h};c.getPath=function(){return e};c.getPathSectionByIndex=function(a,c){var d=c?b(c):e;return d&&a>=0&&a<d.length?d[a]:null};c.hasVideo=function(){return e&&e.length>0?e[e.length-1].toLowerCase().indexOf(AddressModel.VIDEO_PREFIX)==0:!1};c.getVideoValue=function(){return c.hasVideo()?e[e.length-1].substring(AddressModel.VIDEO_PREFIX.length,e[e.length-1].length):null};c.hasPhoto=function(){return e&&e.length>0?e[e.length-1].toLowerCase().indexOf(AddressModel.PHOTO_PREFIX)==0:!1};
c.getPhotoValue=function(){return c.hasPhoto()?e[e.length-1].substring(AddressModel.PHOTO_PREFIX.length,e[e.length-1].length):null};c.getStrictDeeplink=function(a){return a?a.replace(/^#/,""):null}}ESPYS2011.extend(AddressModel,Model);AddressModel.VIDEO_PREFIX="video=";AddressModel.PHOTO_PREFIX="photo=";function StateModel(){Model.apply(this,arguments);var a;this.setValue=function(d){a=d;this.sendUpdate()};this.getValue=function(){return a};this.reset=function(d){a=d}}ESPYS2011.extend(StateModel,Model);function MediaVO(a,d,b,c,g,e,h,f){this.id=a;this.title=d;this.caption=b;this.imgSrc=c;this.width=g;this.height=e;this.url=h;this.autoStart=f};function Controller(){CustomEventDispatcher.apply(this,arguments)}ESPYS2011.extend(Controller,CustomEventDispatcher);function AddressController(a,d){Controller.apply(this,arguments);this.setValue=function(b){a.address.value(d.trimSlashes(b)+"/")}}ESPYS2011.extend(AddressController,Controller);function BrowserTitleController(a,d){Controller.apply(this,arguments);this.setTitle=function(b){a.address.title((b?b+" - ":"")+d)}}ESPYS2011.extend(BrowserTitleController,Controller);function StateController(a){Controller.apply(this,arguments);this.changeState=function(d){a.setValue(d)}}ESPYS2011.extend(StateController,Controller);function SubTabContentControl(a,d,b,c,g,e){function h(){for(var a=0;a<m.length;a++){var b=m[a],c=b.getUrl();if(b.usesAddress()){if(!b.isUnique()&&ESPYS2011.addressModel.isUrlWithinPath(c,ESPYS2011.addressModel.value)||b.isUnique()&&ESPYS2011.addressModel.isUrlMatch(c,ESPYS2011.addressModel.value))return b}else if(l.getValue()===c)return b}return null}Controller.apply(this,arguments);var f=this,i=b,j=c,k=g,l=e,m=[],o="notYetSet";f.init=function(){k&&a(k).children("li").each(function(){var b=(new TabNavBtnMediator(a,
this,l)).init();m.push(b)});f.sendUpdate();return f};f.sendUpdate=function(b){var c=h();if(ESPYS2011.addressModel.value!=o){if(j){var d,e,f;c&&(e=a(c.el),d=e.children("a[href][address]").first().html(),e=e.children("aside").first().html(),f=c.getUrl());d=d!=null?d:"";e=e!=null?e:"";var c=a(i),g=c.children(".donate-btn").first().get();g&&a(g).remove();c.html(e);g&&c.append(g);j.setUrl(f);a(j.el).children("a[href]").first().html(d);d=j.isSelected();a(j.el).toggle(d)}o=ESPYS2011.addressModel.value}for(d=
0;d<m.length;d++)m[d].sendUpdate(b)}}ESPYS2011.extend(SubTabContentControl,Controller);function AdController(a){Controller.apply(this,arguments);this.placeAd=function(d,b,c){d=a(d);d.css("visibility","hidden");b=ESPYS2011.getRootURL()+"analytics/doubleClickAd?v="+(new Date).getTime()+"&section="+b+"&adType="+c+"&lang="+ESPYS2011.lang;d.attr("src",b)};this.pageTrack=function(a){(typeof anTrackLink).toLowerCase()==="function"&&anTrackLink(this,"espn","espys2011",a)}}ESPYS2011.extend(AdController,Controller);AdType={SIZE_200x55:"SponsoredByLogoHeader",SIZE_728x90:"Banner",SIZE_300x100:"PromoBox_Marketing"};function OverlayController(a){Controller.apply(this,arguments);var d=this,b;d.init=function(){b=function(b,d){a.fn.colorbox(a.extend(d,{scrolling:!1,iframe:!0,opacity:"0.7",onOpen:function(){d.css!==void 0&&a("#colorbox").removeClass().addClass(d.css).find("#cboxClose").remove()},onClosed:function(){a("#colorbox").removeClass()},onCleanup:function(){a("#colorbox iframe").attr("src","about:blank")}}))};return d};d.openBestPlay=function(a,d,e){b(this,{css:"bestPlayOverlay",href:a,open:!0,innerHeight:e,
innerWidth:d,slideshow:!0,loadPosition:"loadTop"})};d.openGiftBag=function(a,d,e){b(this,{css:"giftBagOverlay",href:a,open:!0,innerHeight:e,innerWidth:d,slideshow:!0,loadPosition:"loadTop"})};d.close=function(){a.colorbox.close()};d.resize=function(b,d){a.colorbox.resize({innerWidth:b,innerHeight:d})}}ESPYS2011.extend(OverlayController,Controller);function ESPYSUtils(){}ESPYSUtils.getMediaVOByMetaData=function(a){var d;(a=a.metadata({type:"attr",name:"data"}))&&(d=new MediaVO(a.id,a.title,a.caption,a.imgSrc,a.width,a.height,a.url,a.autoStart));return d};function ImageFader(a,d){function b(a){a=a===!0?0:1E3;h.stop().fadeTo(a,0,"easeOutQuint");e.stop().fadeTo(a,1,"easeOutQuint")}function c(a){g.selected||(h.stop().fadeTo(a===!0?0:500,1,"easeOutQuint"),e.stop())}var g=this,e,h;g.selected=!1;e=a(d);(h=e.children("img").first())&&h.hover(b,c);g.select=function(a){g.selected=!0;b(a)};g.deselect=function(a){g.selected=!1;c(a)}};
