var videoFields="id,name,thumbnailURL,referenceId,shortDescription,longDescription,tags,length,linkURL,linkText";var customFields="relatedtopics,itunesurl";var updateVideo=function(m,y){var c=function(D,G){D.addClass("loading");var E=$('<ul class="videoList"/>');var F=generateSecondaryContent(D,G);E.append(F);D.append(E);if(D.parent().find(".pagination li:first").hasClass("selected")){E.find("img").lazyload({effect:"fadeIn"})}};var j=y.customFields&&y.customFields.relatedtopics?y.customFields.relatedtopics.split(","):y.tags;var d=j?j.length:0;var C=y.name?y.name:y.displayName;var i=y.referenceId?y.referenceId:0;var A=m;var q="http://www.time.com/video/player/0,32068,"+A+"_"+i+",00.html";var s=encodeURI(q);var u=y.shortDescription?y.shortDescription:"";var z="";var h=y.linkURL;var w=y.linkText;document.title=C+" - Video - TIME.com";var o=$("#mainVideoTitle");var e=$("#videoDescription");var b=$("#videoContainer");var k=$("#relatedTopics").length?$("#relatedTopics").show():b.before('<div id="relatedTopics"/>').parent().find("#relatedTopics");var f=$("#relatedArticle").length?$("#relatedArticle").show():e.after('<p id="relatedArticle"/>').parent().find("#relatedArticle");var p=$("#itunes").length?$("#itunes").show():$("#videoTools .emailThis").after('<li id="itunes"/>').parent().find("#itunes");var t=y.customFields&&y.customFields.itunesurl?y.customFields.itunesurl:null;if(t){p.html('<a href="'+t+'" target="_blank">Download</a>')}else{p.hide()}if(!modVP){if(!o.text()){o.text(C)}if(!e.text()){e.text(u)}}else{o.text(C);e.text(u)}if(d>0){var B="";var l="";$.each(j,function(D,E){E=$.trim(E);B+=E+",";l+='<li><a href="/time/video/search/0,,,00.html?cmd=tags&q='+E.replace(/&/,"%26")+'">'+E+"</a></li>"});k.html("<strong>RELATED TOPICS:</strong> <ul>"+l+"</ul>")}else{k.hide()}if(h){f.html('<strong>RELATED</strong> <a href="'+h+'">'+w+"</a>")}else{f.hide()}var v=$("#videoTopic").empty();v.append("<h3>Similar Videos for: "+C+"</h3>");B=B?B.substr(0,B.length-1):"";var n=B.replace(/&/,"%26");var r="find_videos_by_tags";var g="&or_tags=";if(n.length>0){var a=bcRequestUrl(r,g+n+"&get_item_count=true&page_size=10&page_number=0&sort_order=DESC&sort_by=plays_total&video_fields="+videoFields+"&callback=?");$.getJSON(a,function(H){var F=H.total_count<100?H.total_count:100;var D=Math.ceil(F/10);var L=$('<ul class="pagination"/>');var O="";for(var I=0;I<D;I++){var P=bcRequestUrl(r,g+n+"&page_number="+I+"&page_size=10&sort_order=DESC&sort_by=plays_total&video_fields="+videoFields+"&callback=?");O+='<li><a href="'+P+'">'+(I+1)+"</a></li>"}L.append(O);var Q=function(R){R.addClass("loading");R.parent().find("h3").after(R)};var M=function(R){R.removeClass("loading").addClass("content")};v.append(L);var N=$('<div class="content"><ul class="videoList">'+generateSecondaryContent($("<div/>"),H)+"</ul></div>");var K=L.find("li:first a").attr("href");var G={};G[K]=N;v.timeJSONTabs({panels:G,generateContent:c,prevAjaxFun:Q,postAjaxFun:M});L.before(N);N.find("img").lazyload({effect:"fadeIn"});if(D>1){L.append('<li class="prev notActive"><a href="#prev">&laquo; PREV</a></li>');L.append('<li class="next"><a href="#next">NEXT &raquo;</a></li>');var J=L.find(".next").bind("click",nextFun);var E=L.find(".prev").bind("click",prevFun);L.find("li").click(function(){L.find(".notActive").removeClass("notActive");var S=-1;var T=$(this).find("a");var R=parseInt(T.text(),"10");if((T).parent().hasClass("next")){S=1}var U=R?R:parseInt(L.find(".selected a").text(),"10")+S;if(U<1||R==1){E.addClass("notActive")}if(U>D||R==D){J.addClass("notActive")}})}})}if(modVP||window.location.href.match(/_0,00\.html/)){var x=$("#videoTools");x.find("a").unbind("click");x.find(".emailThis a").attr("href","http://pathfinder.com/r0/venue/partner/out?/cgi-bin/mail/mailurl2friend.cgi?path=/time/emailFriend&url="+s+"&amp;group=time&amp;title="+encodeURI(C)).timePopUp({url:this.href,height:730,width:750});x.find(".digg a").attr("href","http://digg.com/submit?url="+s+"?iid=digg_share&amp;title="+C+"&amp;bodytext="+encodeURI(u)).timePopUp({url:this.href,height:450,width:970});x.find(".facebook a").attr("href","http://www.facebook.com/sharer.php?u="+s+"?&amp;t="+encodeURI(C)).timePopUp({url:this.href,height:436,width:626});x.find(".twitter a").attr("href","http://twitter.com/home?status=watching from @time "+s);x.find(".yahooBuzz").html('<span id="yahooBuzzBadge-form" class="yahooBuzzBadge-form"><a href="http://buzz.yahoo.com/buzz?publisherurn=time&guid='+s+'&targetUrl=" target="_blank"><span style="cursor: pointer; position: relative; padding-left: 20px; line-height: 16px;"><span style="background: transparent url(http://l.yimg.com/ds/orion/1.0.5/img/badge-logo.png) no-repeat scroll left top; cursor: pointer; display: block; position: absolute; top: 0pt; left: 0pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; height: 16px; width: 16px;"/>Yahoo! Buzz</span></a></span>')}};(function(g){var j=function(m,p){m.addClass("loading");if(typeof(p)!="object"){m.parent().find(".selected").after(m);g.get(p,function(r,s,q){m.html(g(r).find(".videoList").parent().html());m.removeClass("loading").addClass("content")})}else{var n=g('<ul class="videoList"/>');p.videos=p.videos.slice(0,5);var o=generateSecondaryContent(m,p);n.append(o);m.append(n);m.parent().find(".selected").after(m)}};var d=function(m){m.slideUp("slow")};var a=function(m){m.slideDown("slow")};var e=bcRequestUrl("find_playlist_by_id","&playlist_id=1342094282&sort_order=DESC&sort_by=publish_date&video_fields="+videoFields+"&callback=?");var f=function(m){m.addClass("loading")};var c=function(m){m.removeClass("loading").addClass("content")};$moreVideo=g("#moreVideo");$moreVideo.find(".moreVideoUl").append('<li id="mostRecent"><h4><a href="'+e+'">Most Recent</a></h4></li></ul>');var h=Math.random()*2;var l=Math.floor(h);var b=$moreVideo.find("h4");$moreVideo.timeJSONTabs({generateContent:j,first:l,tabs:b,hideFn:d,showFn:a,prevAjaxFun:f,postAjaxFun:c});var i=g("meta[name='videoId']").attr("content").length?g("meta[name='videoId']").attr("content"):gup("bctid");var k=bcRequestUrl("find_video_by_id","&video_id="+i+"&video_fields="+videoFields+"&custom_fields="+customFields+"&callback=?");g.getJSON(k,function(m){updateVideo(i,m)})})(jQuery);var BC_ID_OF_BANNER_AD="topBanner";var bcExp="";var modVP="";var modExp="";var modCon="";var modAd="";var modCP="";var videoListKey=0;var playlist=[];function onTemplateLoaded(a){bcExp=brightcove.getExperience(a);modVP=bcExp.getModule(APIModules.VIDEO_PLAYER);modExp=bcExp.getModule(APIModules.EXPERIENCE);modCon=bcExp.getModule(APIModules.CONTENT);modAd=bcExp.getModule(APIModules.ADVERTISING);modAd.enableExternalAds(true);modCP=bcExp.getModule(APIModules.CUE_POINTS);modExp.addEventListener(BCExperienceEvent.CONTENT_LOAD,onContentLoad);modExp.addEventListener(BCExperienceEvent.TEMPLATE_READY,onTemplateReady);modAd.addEventListener("adComplete",bc_adComplete);modAd.addEventListener("externalAd",playAd);modCon.addEventListener(BCContentEvent.VIDEO_LOAD,onVideoLoad);modVP.addEventListener(BCMediaEvent.COMPLETE,onMediaComplete);modVP.addEventListener(BCMediaEvent.BEGIN,onMediaBegin)}function onExternalAd(a){}function onTemplateReady(b){var d=0;var e=$("#moreVideo").find(".selected").next().find("li h5 a");var c;var a=modVP.getCurrentVideo().id;$.each(e,function(f,g){c=g.href.replace(/.*\,(.*)_.*/g,"$1");if(c!=a){playlist.push(c)}})}function onContentLoad(a){updateAdPolicy();if(!modVP.isPlaying()){modVP.play()}}function onMediaBegin(a){$("#bc_adOverlay,#bc_adContainer").hide();if(videoListKey>0){var b=modVP.getCurrentVideo();updateVideo(b.id,b)}if(videoListKey<playlist.length){document.getElementById("myExperience").setNextId(playlist[videoListKey])}else{document.getElementById("myExperience").setNextId(-1)}}function onMediaComplete(a){videoListKey++}function onVideoLoad(a){updateAdPolicy()}function onCuePoint(a){}function updateAdPolicy(){var e=modVP.getCurrentVideo();var i=e.tags?e.tags:"";var f=e.referenceId?e.referenceId:0;var a=e.id;var g="http://www.time.com/video/player/0,32068,"+a+"_"+f+",00.html";var d=e.referenceId;var c=e.id;var h=modAd.getAdPolicy();if(h){h.prerollAds=true;var b=escape(i.join(";cont=")).replace(/[\s]/g,"").replace(/%3b/gi,";").replace(/%3d/gi,"=");h.prerollAdKeys=";cont="+b;modAd.setAdPolicy(h)}}function playAd(adEvent){var IE6=false
/*@cc_on || @_jscript_version < 5.7 @*/
;if(IE6){var $overLay=$("#bc_adOverlay");var offSetHeight=$overLay.parent().innerHeight();$overLay.css("height",offSetHeight)}$("#bc_adOverlay,#bc_adContainer").show();pXML=adEvent.ad;try{pXML=bc_replaceChars(pXML,"&","%26");bc_gAdPlaying=true;if(window.ActiveXObject){var adXML=new ActiveXObject("Microsoft.XMLDOM");adXML.async=false;adXML.loadXML(pXML)}else{if(window.XMLHttpRequest){var adXML=(new DOMParser()).parseFromString(pXML,"text/xml")}}var ad=new Object();var nodeItems=adXML.firstChild.childNodes.length;var currentNode=adXML.firstChild.firstChild;if(adXML.firstChild.getAttribute("duration")!==""){ad.duration=adXML.firstChild.getAttribute("duration")}if(adXML.firstChild.getAttribute("trackStartURLs")!==""){var trackStr=adXML.firstChild.getAttribute("trackStartURLs");var urls=trackStr.split(",");ad.trackStartURLs=urls}var expandedBannerURL=null;var expandedBannerClickURL=null;var collapsedBannerURL=null;var collapsedBannerClickURL=null;for(var i=0;i<nodeItems;i++){if(currentNode.nodeName=="videoURL"){ad.videoURL=currentNode.firstChild.nodeValue}else{if(currentNode.nodeName=="videoClickURL"){ad.videoClickURL=currentNode.firstChild.nodeValue}else{if(currentNode.nodeName=="expandedBannerURL"){expandedBannerURL=currentNode.firstChild.nodeValue}else{if(currentNode.nodeName=="expandedBannerClickURL"){expandedBannerClickURL=currentNode.firstChild.nodeValue}else{if(currentNode.nodeName=="collapsedBannerURL"){collapsedBannerURL=currentNode.firstChild.nodeValue}else{if(currentNode.nodeName=="collapsedBannerClickURL"){collapsedBannerClickURL=currentNode.firstChild.nodeValue}}}}}}currentNode=currentNode.nextSibling}bc_show300Ad(expandedBannerURL,expandedBannerClickURL);bc_updateBannerAd(collapsedBannerURL,collapsedBannerClickURL);ad.type="videoAd";modAd.showAd(ad);bc_adPlayedBeforeVideo=true}catch(e){modAd.resumeAfterExternalAd();bc_adComplete()}}function bc_replaceChars(d,a,b){while(d.indexOf(a)>-1){var c=d.indexOf(a);d=""+(d.substring(0,c)+b+d.substring((c+a.length),d.length))}return d}function bc_adComplete(a){bc_gAdPlaying=false;document.getElementById("bc_adOverlay").style.zIndex=-1;document.getElementById("bc_adContainer").style.zIndex=-1;document.getElementById("bc_adContainer").innerHTML="";if(navigator.platform=="Mac"){for(var b=0;b<bc_gLineUpArray.length-1;b++){try{document.getElementById(bc_gLineUpArray[b].id).style.overflow="auto"}catch(c){}}}}function bc_show300Ad(b,g){if(navigator.platform=="Mac"){for(var c=0;c<bc_gLineUpArray.length-1;c++){try{document.getElementById(bc_gLineUpArray[c].id).style.overflow="hidden"}catch(f){}}}document.getElementById("bc_adOverlay").style.zIndex=99;document.getElementById("bc_adContainer").style.zIndex=100;var d=document.getElementById("bc_adContainer");if(b.substr((b.length-3),3)=="swf"){var a='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="300" height="250" id="expandedBanner" align="middle">';a+='<param name="allowScriptAccess" value="always" />';a+='<param name="movie" value="'+b+'" />';a+='<param name="quality" value="high" />';a+='<param name="bgcolor" value="#ffffff" />';a+='<param name="FlashVars" value="clickTag='+g+'" />';a+='<embed src="'+b+'" quality="high" bgcolor="#ffffff" width="300" height="250" name="expandedBanner" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" FlashVars="clickTag='+g+'" />';a+="</object>";d.innerHTML=a}else{d.innerHTML="<a href='"+g+"' target='_blank' ><img src='"+b+"' /></a>"}}function bc_updateBannerAd(a,b){document.getElementById(BC_ID_OF_BANNER_AD).innerHTML="<a target='_blank' href='"+b+"'><img border=0 src='"+a+"'/></a>"}if(!FlashDetect.installed){$("#videoPlayer").html('<p class="getFlash">This content requires the Adobe Flash Player. <a href="http://www.adobe.com/go/getflash/" target="_blank">Get Flash</a></p>')};