/*
* @file magnet.popups.js
* @author Paul Bronshteyn
* @comment Built by a geek loaded on caffeine ...
* @copyright (c) Conde Nast Digital
*/
if(typeof CN==="undefined"||!CN){var CN={}}CN.popups=(function(g){var i=true,r=true,A=false,f=false,l=false,y={scrollbars:0,location:0,directories:0,status:0,menubar:0,toolbar:0,resizable:0},h={name:"arrivalpop",cookie:"ArrivalCookie",path:"/nolayout/arrival",width:460,height:295,top:-50,left:-50},s={name:"exitingpop",cookie:"ExitingCookie",path:"/nolayout/exit",width:460,height:295,top:50,left:50},p=24,e=3,t,d=location.pathname,q=CN.site.domain,m=["/sweeps","/registration","/services/newsletters"],v=[],j=["buysub.com","condenastdirect.com","clk.atdmt.com","magazinestoresubscriptions.com"],o=["mbid"],u={arriving:{},exiting:{}},a=function(E,C){for(var D=0,B=C.length;D<B;D++){if(E.indexOf(C[D])!==-1){return true}}return false},n=function(D,B){for(var C in B){if(B[C].strict){if(D===C){return B[C].options}}else{if(D.indexOf(C)!==-1){return B[C].options}}}return false},b=function(E,C){for(var D=0,B=E.length;D<B;D++){if(g.inArray(E[D],C)===-1){C.push(E[D])}}},z=function(F,D){var E=0,B=F.length,C;for(;E<B;E++){C=g.inArray(F[E],D);if(C>-1){D.remove(C,1)}}},k=function(B){var C,D="",E;if(B.cookie){CN.cookie.set(B.cookie,B.cookie,{expires:B.cookieLife||p,path:"/",domain:q})}B.args=g.extend({},y,B.args||{});for(C in B.args){D+=","+C+"="+B.args[C]}E=window.open(B.path,B.name,"height="+(B.height||screen.height)+",width="+(B.width||screen.width)+",top="+parseInt(screen.height/2-(B.height||screen.height)/2+B.top)+",left="+parseInt(screen.width/2-(B.width||screen.width)/2+B.left)+D);return(E)?(true,E.focus()):false},w=function(){if(A||(!k(h)&&f)){if(CN.ecom&&CN.ecom.floatingAd){CN.cookie.set(h.cookie,h.cookie,{expires:h.cookieLife||p,path:"/",domain:q});CN.ecom.floatingAd.init()}}},c=function(D){var B=n(d,u.exiting),E="",C="";if(B){g(window).unbind("unload",c);if(D.type==="click"){E=(D.target.parentNode.pathname||D.target.pathname||"").replace(/(^[^/])/,"/$1")}if((B.cookie&&!CN.cookie.get(B.cookie))&&(B.excludePath&&!a(E,B.excludePath))){k(B)}return}if(!r||a(d,v)||CN.cookie.get(s.cookie)){return}if(D.type==="click"){g(window).unbind("unload",c);if(/^(#|javascript:)/.test(this.href)){return}C=D.target.hostname||g(D.target).parents("a:eq(0)")[0].hostname||""}C=(C)?CN.url.domain(C):"";if(C===q||a(C,j)){return}k(s)},x=function(B){var C=this.movie||CN.url.domain(this.data);if(C[0]==="/"||C===q){g(window).unbind("unload",c)}};return{init:function(){var C=0,B=o.length,D=CN.url.params();for(;C<B;C++){if(D[o[C]]){return this}}g("a,area").live("click",c);g(window).bind("unload",c);g(function(){g("form").bind("submit",function(){g(window).unbind("unload",c)})});g("object").live("mousedown",x);if(CN.site.env==="DEV"){p=1}if(!i||CN.cookie.get(h.cookie)||a(d,m)){return this}t=setTimeout(w,e*1000);return this},setArriving:function(C,B){i=C===true;g.extend(h,(B||{}));return this},setExiting:function(C,B){r=C===true;g.extend(s,(B||{}));return this},setLayer:function(B){A=B===true;return this},setForceLayer:function(B){f=B===true;return this},isLayer:function(){return true},setCookieLife:function(B){p=CN.utils.intval(B)||p;return this},setPopDelay:function(B){e=CN.utils.intval(B)||e;return this},setPopArguments:function(B){g.extend(y,(B||{}));return this},setCustomExitPath:function(D,C,B){if(!D){return this}if(CN.isBoolean(C)){B=C;C=s}u.exiting[D]={strict:B||false,options:C||s};return this},excludePath:function(){b(arguments,m);b(arguments,v);return this},excludeArrivalPath:function(){b(arguments,m);return this},removeArrivalPath:function(){z(arguments,m);return this},excludeExitPath:function(){b(arguments,v);return this},removeExitPath:function(){z(arguments,v);return this},excludeExitDomain:function(){b(arguments,j);return this},removeExitDomain:function(){z(arguments,j);return this},excludeUrlParam:function(){b(arguments,o);return this},removeUrlParam:function(){z(arguments,o);return this},setATGArriving:function(C,B){if(!l){i=C===true;if(!i){t=clearTimeout(t)}else{if(!t){setTimeout(w,e*1000)}}g.extend(h,(B||{}));CN.debug.info("ATG set arriving:",[i])}return this},setATGExiting:function(C,B){if(!l){r=C===true;g.extend(s,(B||{}));CN.debug.info("ATG set exiting:",[r])}return this},setATGLayer:function(B){if(!l){A=B===true;CN.debug.info("ATG set layer:",[A])}return this},setSiteOverride:function(B){l=B===true;return this}}})(jQuery);if(typeof CN==="undefined"||!CN){var CN={}}CN.mobile=CN.mobile||{};CN.mobile=(function(f){var d={},b=navigator.userAgent.toLowerCase(),g={bcBlogObject:'object[id^=flashObj]:has(param[value*="brightcove"])',bcBlogEmbed:'embed[base*="brightcove"]'},a=function(i,h){return f("<audio/>").attr({controls:"controls",src:i}).addClass("audio")},e=function(m){var j=(this.config)?this.config:this.context.config,o=j.index,n=f("file",f(m).find("song")[0]).text(),i='<div class="caption">'+f("name",f(m).find("song")[0]).text()+"</div>",k=a(n,j),l=d[o],h=l.parentNode;if(!nextAdjacentNode.length){f(k).appendTo(d[o]).wrap('<div class="audio-container" />').parent().prepend(i)}else{f(k).insertBefore(d[o]).wrap('<div class="audio-container" />').parent().prepend(i)}return this},c=function(h){if(!h.xml){return}f.ajax({url:h.xml,cache:true,context:{config:h},success:e})};return{init:function(){if(CN.mobile.detectDevicesSupported()&&CN.site.mobilecompatible!==undefined){f("body").addClass("mobile")}return this},createHtml5Audios:function(m,k){var i=f("#"+m),l=i.next(),h=i.parent(),j={xml:k.flashvars.replace("xmlFile=",""),width:k.width,height:k.height,index:m};d[m]=(!l.length)?h:l;c(j);return this},removeFlashContent:function(){f("body.mobile  embed[type=application/x-shockwave-flash],body.mobile  object[type=application/x-shockwave-flash]").not(g.bcBlogObject+","+g.bcBlogEmbed).parent().remove();return this},removeSwf:function(i,h){i.remove();f(window).trigger("CN.customEvents.swfRemoved");CN.debug.info("swf object is removed",[h.src]);return this},removeIframeFlashContent:function(){f("body.mobile iframe[src^='/sandbox']").each(function(){var i=f(this)[0],h=i.contentWindow.document.body;f(window).bind("CN.customEvents.swfRemoved",function(){CN.frame.resize(i);f(window).unbind("CN.customEvents.swfRemoved")});CN.mobile.removeSwf(f(h.getElementsByTagName("embed"),h.getElementsByTagName("object")),i)});return this},removeBlogVideos:function(){f(g.bcBlogObject).each(function(h){var i=jQuery(this).attr("id");jQuery(this).attr("id",i+h);CN.brightcove.mobile.init(jQuery(this).attr("id"))});f(g.bcBlogEmbed).each(function(h){CN.brightcove.mobile.embedBlogVideos(jQuery(this))});return this},detectIPad:function(){return(b.search("ipad")>-1?true:false)},detectIPhone:function(){return(b.search("iphone")>-1?true:false)},detectBlackBerry:function(){return(b.search("blackberry")>-1?true:false)},detectAndroid:function(){return((b.search("android")>-1||b.search("droid")>-1)?true:false)},detectDevicesSupported:function(){return(CN.mobile.detectIPhone()||CN.mobile.detectIPad()||CN.mobile.detectBlackBerry()||CN.mobile.detectAndroid())},updateOrientation:function(){f("body").removeClass((window.orientation==0)?"landscape":"portrait").addClass((window.orientation==0)?"portrait":"landscape")}}})(jQuery);jQuery(document).ready(function(){CN.mobile.init().removeBlogVideos().removeFlashContent().removeIframeFlashContent()});if(typeof CN==="undefined"||!CN){var CN={}}CN.brightcove=CN.brightcove||{};CN.brightcove.mobile=(function(c){var d=true,a=0,b="http://api.brightcove.com/services/library";pagePlacementInfo={},vidObj={},nextAdjacentNode={},currentVideo={activetab:1},strObjID="",totalTabs=(!CN.mobile.detectIPad())?3:6,totalVideoItems=5,videoDTO={},sharemodules=["email","link","add"],hasDctContent=false,bcDct={},videoWidth=0,videoHeight=0,clicked=0,cplayerType="standard",isMobify=(window.location.href.search("mobify.me")>-1||window.location.href.search("http://m.")>-1),makeMobileCompatible=function(f){var g="",h=c("#"+f),e="";cplayerType=(f.indexOf("cplayer")>-1)?"custom":"standard";g=(f.indexOf("myExperience")>-1)?getParamValue(h,"playerID"):((f.indexOf("flashObj")>-1)?CN.utils.parseStr(getParamValue(h,"flashVars"),"query")["playerID"]:(f.indexOf("cplayer")>-1)?CN.site.channelplayerId:CN.site.oneclipplayerId);e=(f.indexOf("myExperience")>-1)?(f.indexOf("myExperienceChannel")>-1)?(getParamValue(h,"@videoList.featured")?getParamValue(h,"@videoList.featured"):""):getParamValue(h,"@videoPlayer"):((f.indexOf("flashObj")>-1)?CN.utils.parseStr(getParamValue(h,"flashVars"),"query")["@videoPlayer"]:((f.indexOf("cplayer")>-1)?c("div").filter("div.video-content").attr("id").replace("content_",""):f.split("_")[f.split("_").length-1]));BCReadAPIToken=CN.site.videoReadToken;getParamValue(h,"flashvars");if(g===null||typeof g==="undefined"){return false}nextAdjacentNode=h.next();parentAdjacentNode=h.parent();pagePlacementInfo[f]=(!nextAdjacentNode.length)?parentAdjacentNode:nextAdjacentNode;h.remove();initiateMobileVideoRetrieval(g,e,BCReadAPIToken,f)},addShareButton=function(f){c("<img/>").attr({src:"images/videos/channel/images/share.png",width:53,height:16,border:0,id:"share"}).appendTo(c("<div/>").attr("id","share").appendTo(".video-utilities"))},getParamValue=function(f,e){return f.children("param[name|="+e+"]").attr("value")},initiateMobileVideoRetrieval=function(h,g,f,k){var j,e,i,l="handleJSONResponseForID"+new Date().getTime();if(k.indexOf("cplayer")===-1&&k.indexOf("myExperienceChannel")===-1){if(k.indexOf("videoplayer")>-1){videoWidth=300;videoHeight=260}else{videoWidth=460;videoHeight=390}j=(g.indexOf("ref:")!=-1)?b+"?command=find_video_by_reference_id&media_delivery=http&reference_id="+g.substring(4)+"&fields=name,renditions&token="+encodeURIComponent(f):b+"?command=find_video_by_id&media_delivery=http&video_id="+g+"&token="+encodeURIComponent(f)+"&callback=?";c.ajax({type:"GET",cache:false,dataType:"jsonp",glabal:false,url:j,context:{playerID:h,strObjID:k,videoWidth:videoWidth,videoHeight:videoHeight},success:onSuccess})}else{if(!CN.mobile.detectIPad()){c("#videoscreen").hide()}videoWidth=(CN.brightcove.mobilechannelwidth!==undefined)?CN.brightcove.mobilechannelwidth:640;videoHeight=(CN.brightcove.mobilechannelheight!==undefined)?CN.brightcove.mobilechannelheight:360;c(window).bind("CN.customEvents.playlistCreated",function(n,m){seeMoreToggle(m)});j=b+"?command=find_playlists_for_player_id&sort_by=publish_date&sort_order=ASC&media_delivery=http&player_id="+h+"&token="+encodeURIComponent(f)+"&callback=?";c.getJSON(j,function(m){handlePlaylistResponse(m,h,k,g)});if(cplayerType=="custom"){getXMLContent(g)}CN.dart.refresh()}a=videoWidth},onSuccess=function(f){var e=(this.playerID)?this:this.context;embedHTML5PlayerForVideo(f,e.playerID,e.strObjID,e.videoWidth,e.videoHeight)},getVisibleKeywords=function(e){var h=[],f=[];if(e&&e.keywords){if(c.isArray(e.keywords.keyword)){h=e.keywords.keyword}else{h.push(e.keywords.keyword)}for(var g=0;g<h.length;g++){if(h[g].visible=="Y"){f.push(h[g].word)}}}return f||[]},getXMLContent=function(e){var f="/services/ajax?videoId="+e;c.ajax({url:f,type:"GET",dataType:"json",success:function(i){if(i.mainContent.video_v2===undefined){CN.brightcove.updateMetaData(bcDct.name||"","","","","",bcDct.longDescription||"","","",(bcDct.tags.length>0)?bcDct.tags:new Array(),"",{})}else{hasDctContent=true;var g=i.mainContent.video_v2,h=CN.schemaParser.getInstance().parse(g),l=(g.header&&g.header.html)?g.html.text:"",k=h.subHeaders()||"",j=h.rubric()||"";caption=g.videoFile.caption||"",bodyLead=h.bodyLead()||"",bodyText=h.bodyText()||"",footerText=(g.footer&&g.footer.text)?g.footer.text:"",photoCredits=(g.videoFile.credit)?g.videoFile.credit:"",visibleKeywords=getVisibleKeywords(g.metaData),bodyIntro=h.bodyIntroduction()||"",unitMetaData=g.unitMetaData||{};CN.brightcove.updateMetaData(l,k,j,caption,bodyLead,bodyText,footerText,photoCredits,visibleKeywords,bodyIntro,unitMetaData)}}})},seeMoreToggle=function(e){c("#features-tab-"+e.tab+" li.see-more a.next").live("click",function(){getMoreVideos(e);return false})},togglePlaylist=function(e){var f=c("#features-tab-"+e+" li.see-more");f.siblings().not(".firstten").toggle(400);c("a",f).text((c("#features-tab-"+e+" li.see-more a").text().indexOf("see more")>-1)?"x close":"see more")},getCurrentVideo=function(l,f,k,e){for(var h=0;h<l.items.length;h++){for(var g=0;g<l.items[h].videos.length;g++){if(parseInt(e)===parseInt(l.items[h].videos[g].id)){currentVideo.activetab=h+1;currentVideo.dto=l.items[h].videos[g];bcDct=currentVideo.dto;break}}}embedHTML5PlayerForVideo(currentVideo.dto,f,k);createPlaylistsTab(l,e);if(!hasDctContent&&cplayerType=="custom"){CN.brightcove.updateMetaData(bcDct.name||"","","","","",bcDct.longDescription||"","","",(bcDct.tags.length>0)?bcDct.tags:new Array(),"",{})}},handlePlaylistResponse=function(h,f,g,e){if(e===""){embedHTML5PlayerForVideo(h.items[0].videos[0],f,g);createPlaylistsTab(h,e);bcDct=h.items[0].videos[0]}else{getCurrentVideo(h,f,g,e)}},anchorDefautVideo=function(g,e,h){for(var f=0;f<g.length;f++){if(parseInt(e)===parseInt(g[f].id)){clicked=(f%totalVideoItems>0)?parseInt(f/totalVideoItems)+1:0}}},getVideoList=function(j,g,f){var n="",o=2,p=1,m=(j.length<=totalVideoItems?j.length:totalVideoItems),e={tab:f,id:g,dto:j,start:0,end:parseInt(m-1)};for(var k=0;k<m;k++){var l=(parseInt(g)===parseInt(j[k].id))?"active":"",h=(isMobify)?(CN.mobile.detectIPad())?"/video?videoID="+j[k].id:getBestRenitions(j[k]):"/video?videoID="+j[k].id;l=(k<=parseInt(totalVideoItems-1))?((l!=="")?l+" firstten":"firstten"):l;n=n+((k===0?"<ol>":"")+'<li class="'+l+"\"><a href='"+h+"'><img src=\""+j[k].thumbnailURL+'" width="120" height="67" border="0" /></a><a href=\''+h+"'>"+j[k].name+"</a></li>");if(k==parseInt(m-1)){n=(j.length>parseInt(m))?n+"<li class='see-more'><a href='#' class='previous'>< previous</a><a href='#' class='next'>next ></a></li></ol>":n+"</ol>"}}if(j.length>totalVideoItems){c(window).trigger("CN.customEvents.playlistCreated",[e])}return n},displayCurrentSet=function(i,l,e,j,k){var f=c("#features-tab-"+i+" li.see-more"),g=(j>e+totalVideoItems?e+totalVideoItems:j),h=f.siblings().length;f.siblings().css("display","none").slice(l,e).css("display","block");c("a.previous",f).unbind("click");if(l===0){c("a.previous",f).css("display","none");c("a.next",f).css("display","block")}else{if(e===j){c("a.previous",f).css("display","block").bind("click",function(){displayCurrentSet(i,l-totalVideoItems,l,j,k);return false});c("a.next",f).css("display","none")}else{c("a.previous",f).css("display","block").bind("click",function(){displayCurrentSet(i,l-totalVideoItems,l,j,k);return false});c("a.next",f).css("display","block")}}if(h>=g){c("a.next",f).unbind("click").bind("click",function(){displayCurrentSet(i,l+totalVideoItems,g,j,k);return false})}else{c("a.next",f).unbind("click");c("#features-tab-"+i+" li.see-more a.next").bind("click",function(){getMoreVideos(k);return false})}},getMoreVideos=function(g){var l=g.end,o="",k=g.dto,e=g.id,h=g.tab,f=parseInt(g.end+1);moreVideos=(k.length-1>parseInt(f+totalVideoItems-1)?parseInt(f+totalVideoItems-1):k.length-1);for(var m=l+1;m<=moreVideos;m++){var n=(parseInt(e)===parseInt(k[m].id))?" class=active":"",j=(isMobify)?(CN.mobile.detectIPad())?"/video?videoID="+k[m].id:getBestRenitions(k[m]):"/video?videoID="+k[m].id;o=o+((m===0?"<ol>":"")+"<li"+n+"><a href='"+j+"'><img src=\""+k[m].thumbnailURL+'" width="120" height="67" border="0" /></a><a href=\''+j+"'>"+k[m].name+"</a></li>")}c(o).insertBefore(c("#features-tab-"+g.tab+" div.tab-content ol li.see-more"));g.start=f;g.end=moreVideos;displayCurrentSet(g.tab,f,moreVideos+1,k.length,g)},createShareModule=function(h,e){c('<div class="feature share-module"/>').appendTo(c(".player"));for(var f=0;f<h.length;f++){var g=parseInt(f+1).toString();c('<h3 class="tab" id="tab-'+h[f]+'">'+h[f]+'</h3><div id="'+h[f]+'">my content</div>').appendTo(c(".feature.share-module"))}c("div.share-module").tab().addClass("sharemodule-ready");c(window).trigger("CN.customEvents.shareModuleCreated")},createPlaylistsTab=function(h,e){var j=c('<div class="features tabs playlist"><div class="feature feature-tabs"></div></div>').insertAfter(c(".player"));for(var f=0;f<h.items.length;f++){var g=parseInt(f+1).toString();c('<h2 class="tab" id="features-tab-'+g+'">'+h.items[f].name+'</h2><div class="tab-content">'+getVideoList(h.items[f].videos,e,g)+"</div>").appendTo(c(".playlist .feature-tabs"));if(currentVideo.activetab==g){anchorDefautVideo(h.items[f].videos,e,g)}}c(function(){try{c("div.tabs.playlist").addClass("tabs-initialized");c("div.features.playlist").find("div.feature-tabs").tab(currentVideo.activetab);var k=c(".playlist > div.feature-tabs > ul > li"),i=c(".playlist > div.feature-tabs > ul").width()-parseInt(c(k[0]).css("margin-right"),10)*k.length,m=i/k.length;k.each(function(n){if(n>totalTabs-1){c(this).addClass("hidetab")}});if(h.items.length>totalTabs){createMoreVideos(h,e);updateTabList(h)}for(f=1;f<clicked;f++){c("#features-tab-"+currentVideo.activetab+" li.see-more a.next").trigger("click")}c(window).trigger("CN.customEvents.channelPlayerCreated")}catch(l){CN.debug.error("Error setting up tabs features. Perhaps the defaultTab index is not 1-based, or the jQuery tab plugin is not available.")}})},closeMoreVideos=function(){c("div#more-list").removeClass("showtab").addClass("hidetab")},showMoreVideos=function(){c("div#more-list").removeClass("hidetab").addClass("showtab")},createMoreVideos=function(h,e){var g='<li id="closemenu"><a href="#">x close</a></li>';for(var f=0;f<h.items.length;f++){g=g+'<li class="more-'+parseInt(f+1)+'"><a href="#">'+h.items[f].name+"</a></li>"}c('<div id="more-list"><ol>'+g+"</ol>").appendTo(".playlist .feature.feature-tabs").addClass("hidetab");c('<li id="more-menu"><a href="#">more videos</a></li>').appendTo(".playlist .tab-list");c("li#more-menu").bind("mouseover click",function(){showMoreVideos();c("div#more-list, li#more-menu").live("mouseover",function(){showMoreVideos();c("li#more-menu").unbind("mouseover click");c("div#more-list").live("mouseout",function(){closeMoreVideos();c("li#more-menu").bind("mouseover click",showMoreVideos)})})});c("ul.tab-list li").not("ul.tab-list li#more-menu").bind("mouseover",closeMoreVideos);c("div#more-list a").not("#closemenu a").click(function(){currentVideo.activetab=c(this).parent().attr("class").split("-")[1];c("li#tab-features-tab-"+currentVideo.activetab+" a").trigger("click");updateTabList(h);return false});c(".playlist a").not(".playlist #more-menu a").click(closeMoreVideos);c(".playlist #closemenu a").click(function(){closeMoreVideos();return false})},updateTabList=function(g){var f=0;c("ul.tab-list li[id^=tab-features-tab]").removeClass("showtab").addClass("hidetab");for(var e=currentVideo.activetab;e>=1;e--){if(f<totalTabs){c("li#tab-features-tab-"+e).removeClass("hidetab").addClass("showtab");f++}}for(var e=currentVideo.activetab;e<=g.items.length;e++){if(f<totalTabs){c("li#tab-features-tab-"+e).removeClass("hidetab").addClass("showtab");f++}}return this},formVideoTagFromInfo=function(e){return(CN.mobile.detectBlackBerry())?c(c("<a href='"+e.bestRenditionURL+"'></a>")).append(c(c("<img/>").attr({src:e.vidStillURL,width:e.vidWidth,height:e.vidHeight,border:0}))):c("<video/>").attr({poster:e.vidStillURL,width:e.vidWidth,height:e.vidHeight,controls:"controls",src:e.bestRenditionURL})},lightMarkupTreatment=function(){c("#videoscreen").show()},getBestRenitions=function(j){var h=j.renditions,g=-1,e=-1;for(var f=0;f<h.length;f=f+1){if(h[f].videoCodec!="H264"){continue}if(g==-1){g=f;e=h[f].encodingRate}else{if(((Math.abs(h[f].encodingRate-256000)<=Math.abs(e-256000))?h[f].encodingRate:e)==h[f].encodingRate){g=f;e=h[f].encodingRate}}}return(g==-1)?j.videoFullLength.url:h[g].url},betterEncodingForMobile=function(f,e){return(Math.abs(f-a)>0&&(Math.abs(f-a)<=Math.abs(e-a))?f:e)},embedHTML5PlayerForVideo=function(l,f,k){var j=l.renditions,h=-1,e=-1;for(var g=0;g<j.length;g=g+1){if(j[g].videoCodec!="H264"){continue}if(h==-1){h=g;e=j[g].frameWidth}else{if(betterEncodingForMobile(j[g].frameWidth,e)==j[g].frameWidth){h=g;e=j[g].frameWidth}}}bestRendition=(h==-1)?l.videoFullLength:j[h];videoDTO={bestRenditionURL:bestRendition.url,vidName:l.name,vidHeight:videoHeight,vidWidth:videoWidth,vidStillURL:l.videoStillURL};videoScriptTag=formVideoTagFromInfo(videoDTO),nextSiblingOfVideo=pagePlacementInfo[k],videoTagParent=nextSiblingOfVideo.parentNode;if(!nextAdjacentNode.length){c(videoScriptTag).appendTo(pagePlacementInfo[k]).wrap('<div class="player-container" />').end().wrap('<div class="player"/>')}else{c(videoScriptTag).insertBefore(pagePlacementInfo[k]).wrap('<div class="player-container" />').end().wrap('<div class="player"/>')}if(CN.brightcove.videoheader!==undefined){var m=c("<h1>"+videoDTO.vidName+"</h1>");if(CN.brightcove.videoheader==="top"){m.insertBefore(c(".player"))}else{m.appendTo(c(".player-container"))}}c(window).bind("CN.customEvents.channelPlayerCreated",lightMarkupTreatment)};return{init:function(e){if(!CN.mobile.detectDevicesSupported()){return}makeMobileCompatible(e.id||e)},embedBlogVideos:function(h){if(!CN.mobile.detectDevicesSupported()){return}var i=CN.utils.parseStr(h.attr("flashvars"),"query"),f=i["@videoPlayer"],j=460,e=360,g=i.playerID;strObjID="MyExperience"+f;h.attr("id","MyExperience"+f);nextAdjacentNode=h.next();parentAdjacentNode=h.parent();pagePlacementInfo[strObjID]=(!nextAdjacentNode.length)?parentAdjacentNode:nextAdjacentNode;h.remove();initiateMobileVideoRetrieval(g,f,CN.site.videoReadToken,strObjID)}}})(jQuery);
/*
* @file magnet.ecom.js
* @author Paul Bronshteyn
* @comment Built by a geek loaded on caffeine ...
* @copyright (c) Conde Nast Digital
*/
if(typeof CN==="undefined"||!CN){var CN={}}CN.ecom=CN.ecom||{};CN.ecom.rolloverAd=(function(k){var m=true,j="rolloverAd",b={},h={},n=10,c,l={rolloverAd:false},f=0,i=0,e=function(p,r){if(l[r]){return}l[r]=true;h[r]=k(p.target);var q=h[r].offset();b[r].css({top:(q.top+h[r].height()+f),left:(q.left+i)}).show();c=setTimeout(function(){g(p,r)},n*1000);k(window).bind("resize",{id:r},a)},a=function(p){var q=h[p.data.id].offset();b[p.data.id].css({top:(q.top+h[p.data.id].height()+f),left:(q.left+i)})},g=function(p,q){q=q||p.data.id;b[q].hide();d();l[q]=false},o=function(p){g(p);if(!p.target.href||p.target.href.indexOf("#")>-1){p.stopImmediatePropagation();return false}},d=function(p){clearTimeout(c)};return{init:function(q){q=q||j;if(m){k("#"+q+"_show,#logo-link-a,.showForm,#global_navBar a,#header-subscribe a").live("mouseover",function(r){e(r,q)});b[q]=k("#"+q);l[q]=false;var p=b[q].bind("click mousedown keypress",d).find("form");b[q].find("#"+q+"_header,#"+q+"_footer").bind("mousedown",d).find("a").bind("click",{id:q},o);if(p.length){p.bind("reset",{id:q},g)}else{b[q].find("#"+q+"_content a").bind("click",{id:q},g)}}return this},setRollover:function(p){m=p===true;return this},setOffset:function(q,p){f=CN.utils.intval(q);i=CN.utils.intval(p);return this},timeout:function(p){n=CN.utils.intval(p)||n;return this}}})(jQuery);CN.ecom.videoRolloverAd=(function(c){var j=true,a,g,k=10,b,i=false,e=0,h=0,d=function(){if(i){return}i=!i;g=jQuery(this);var m=g.offset();a.show("slow");b=setTimeout(f,k*1000)},f=function(){a.hide("slow");clearTimeout(b);i=!i},l=function(m){f();if(!this.href||this.href.indexOf("#")>-1){m.stopImmediatePropagation();return false}};return{init:function(){if(j){jQuery("#video_utilities").live("mouseover",d);a=jQuery("#videoRolloverAd");var m=a.bind("click mousedown keypress",function(){clearTimeout(b)}).find("form");jQuery("#videoRolloverAd_header,#videoRolloverAd_footer",a).bind("mousedown",function(){clearTimeout(b)}).find("a").bind("click",l);if(m.length){m.bind("reset",f)}else{jQuery("#videoRolloverAd_content a",a).bind("click",l)}}return this},setRollover:function(m){j=m;return this},setOffset:function(n,m){e=c.utils.intval(n);h=c.utils.intval(m);return this},timeout:function(m){k=c.utils.intval(m)||k;return this}}})(CN);CN.ecom.floatingAd=(function(b){var a,e=15,g,d=function(){a.show();g=setTimeout(f,e*1000)},f=function(){a.hide();clearTimeout(g)},c=function(h){f();if(!this.href||this.href.indexOf("#")>-1){h.stopImmediatePropagation();return false}};return{init:function(){jQuery(function(){a=jQuery("#floatingAd");if(!a.length){return this}var h=a.bind("click mousedown keypress",function(){clearTimeout(g)}).find("form");jQuery("#floatingAd_header",a).bind("mousedown",function(){clearTimeout(g)}).find("a").bind("click",c);if(h.length){h.bind("reset",f)}else{jQuery("#floatingAd_content a",a).bind("click",function(i){i.stopImmediatePropagation();f()})}d()});return this},timeout:function(h){e=b.utils.intval(h)||e;return this}}})(CN);var UFO={req:["movie","width","height","majorversion","build"],opt:["play","loop","menu","quality","scale","salign","wmode","bgcolor","base","flashvars","devicefont","allowscriptaccess","seamlesstabbing"],optAtt:["id","name","align"],optExc:["swliveconnect","allowFullScreen"],ximovie:"ufo.swf",xiwidth:"215",xiheight:"138",ua:navigator.userAgent.toLowerCase(),pluginType:"",fv:[0,0],foList:[],create:function(a,b){if(!UFO.uaHas("w3cdom")||UFO.uaHas("ieMac")){return}UFO.getFlashVersion();UFO.foList[b]=UFO.updateFO(a);UFO.createCSS("#"+b,"visibility:hidden;");UFO.domLoad(b)},updateFO:function(a){if(typeof a.xi!="undefined"&&a.xi=="true"){if(typeof a.ximovie=="undefined"){a.ximovie=UFO.ximovie}if(typeof a.xiwidth=="undefined"){a.xiwidth=UFO.xiwidth}if(typeof a.xiheight=="undefined"){a.xiheight=UFO.xiheight}}a.mainCalled=false;return a},domLoad:function(b){var a=setInterval(function(){if((document.getElementsByTagName("body")[0]!=null||document.body!=null)&&document.getElementById(b)!=null){UFO.main(b);clearInterval(a)}},250);if(typeof document.addEventListener!="undefined"){document.addEventListener("DOMContentLoaded",function(){UFO.main(b);clearInterval(a)},null)}},main:function(c){var b=UFO.foList[c];var a={id:c,swfobj:b};if(b.mainCalled){return}UFO.foList[c].mainCalled=true;visibility="hidden";if(UFO.hasRequired(c)){if(UFO.hasFlashVersion(parseInt(b.majorversion,10),parseInt(b.build,10))){if(typeof b.setcontainercss!="undefined"&&b.setcontainercss=="true"){UFO.setContainerCSS(c)}UFO.writeSWF(c);document.getElementById(c).style.visibility="visible"}else{if(b.xi=="true"&&UFO.hasFlashVersion(6,65)){UFO.createDialog(c);document.getElementById(c).style.visibility="visible"}else{jQuery(window).trigger("CN.customEvents.noFlashInstalled",[a])}}}if(document.getElementById(c).style.visibility!=="hidden"){document.getElementById(c).style.visibility="visible"}},createCSS:function(a,e){var d=document.getElementsByTagName("head")[0];var c=UFO.createElement("style");if(!UFO.uaHas("ieWin")){c.appendChild(document.createTextNode(a+" {"+e+"}"))}c.setAttribute("type","text/css");c.setAttribute("media","screen");d.appendChild(c);if(UFO.uaHas("ieWin")&&document.styleSheets&&document.styleSheets.length>0){var b=document.styleSheets[document.styleSheets.length-1];b.innerTEXT+=a+" {"+e+"}"}},setContainerCSS:function(d){var c=UFO.foList[d];var a=/%/.test(c.width)?"":"px";var b=/%/.test(c.height)?"":"px";UFO.createCSS("#"+d,"width:"+c.width+a+"; height:"+c.height+b+";");if(c.width=="100%"){UFO.createCSS("body","margin-left:0; margin-right:0; padding-left:0; padding-right:0;")}if(c.height=="100%"){UFO.createCSS("html","height:100%; overflow:hidden;");UFO.createCSS("body","margin-top:0; margin-bottom:0; padding-top:0; padding-bottom:0; height:100%;")}},createElement:function(a){return(UFO.uaHas("xml")&&typeof document.createElementNS!="undefined")?document.createElementNS("http://www.w3.org/1999/xhtml",a):document.createElement(a)},createObjParam:function(b,d,c){var a=UFO.createElement("param");a.setAttribute("name",d);a.setAttribute("value",c);b.appendChild(a)},uaHas:function(e){var d=UFO.ua;switch(e){case"w3cdom":return(typeof document.getElementById!="undefined"&&typeof document.getElementsByTagName!="undefined"&&(typeof document.createElement!="undefined"||typeof document.createElementNS!="undefined"));case"xml":var a=document.getElementsByTagName("meta");var c=a.length;for(var b=0;b<c;b++){if(/content-type/i.test(a[b].getAttribute("http-equiv"))&&/xml/i.test(a[b].getAttribute("content"))){return true}}return false;case"ieMac":return/msie/.test(d)&&!/opera/.test(d)&&/mac/.test(d);case"ieWin":return/msie/.test(d)&&!/opera/.test(d)&&/win/.test(d);case"gecko":return/gecko/.test(d)&&!/applewebkit/.test(d);case"opera":return/opera/.test(d);case"safari":return/applewebkit/.test(d);default:return false}},getFlashVersion:function(){if(UFO.fv[0]!=0){return}if(navigator.plugins&&typeof navigator.plugins["Shockwave Flash"]=="object"){UFO.pluginType="npapi";var a=navigator.plugins["Shockwave Flash"].description;if(typeof a!="undefined"){a=a.replace(/^.*\s+(\S+\s+\S+$)/,"$1");var b=parseInt(a.replace(/^(.*)\..*$/,"$1"),10);var f=/r/.test(a)?parseInt(a.replace(/^.*r(.*)$/,"$1"),10):0;UFO.fv=[b,f]}}else{if(window.ActiveXObject){UFO.pluginType="ax";try{var c=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(d){try{var c=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");UFO.fv=[6,0];c.AllowScriptAccess="always"}catch(d){if(UFO.fv[0]==6){return}}try{var c=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(d){}}if(typeof c=="object"){var a=c.GetVariable("$version");if(typeof a!="undefined"){a=a.replace(/^\S+\s+(.*)$/,"$1").split(",");UFO.fv=[parseInt(a[0],10),parseInt(a[2],10)]}}}}},hasRequired:function(c){var b=UFO.req.length;for(var a=0;a<b;a++){if(typeof UFO.foList[c][UFO.req[a]]=="undefined"){return false}}return true},hasFlashVersion:function(b,a){return(UFO.fv[0]>b||(UFO.fv[0]==b&&UFO.fv[1]>=a))?true:false},writeSWF:function(d){var g=UFO.foList[d];var j=document.getElementById(d);if(UFO.pluginType=="npapi"){if(UFO.uaHas("gecko")||UFO.uaHas("xml")){while(j.hasChildNodes()){j.removeChild(j.firstChild)}var k=UFO.createElement("object");k.setAttribute("type","application/x-shockwave-flash");k.setAttribute("data",g.movie);k.setAttribute("width",g.width);k.setAttribute("height",g.height);var f=UFO.optAtt.length;for(var h=0;h<f;h++){if(typeof g[UFO.optAtt[h]]!="undefined"){k.setAttribute(UFO.optAtt[h],g[UFO.optAtt[h]])}}var e=UFO.opt.concat(UFO.optExc);var f=e.length;for(var h=0;h<f;h++){if(typeof g[e[h]]!="undefined"){UFO.createObjParam(k,e[h],g[e[h]])}}j.appendChild(k)}else{var l="";var e=UFO.opt.concat(UFO.optAtt).concat(UFO.optExc);var f=e.length;for(var h=0;h<f;h++){if(typeof g[e[h]]!="undefined"){l+=" "+e[h]+'="'+g[e[h]]+'"'}}j.innerHTML='<embed type="application/x-shockwave-flash" src="'+g.movie+'" width="'+g.width+'" height="'+g.height+'" pluginspage="http://www.macromedia.com/go/getflashplayer"'+l+"></embed>"}}else{if(UFO.pluginType=="ax"){var c="";var f=UFO.optAtt.length;for(var h=0;h<f;h++){if(typeof g[UFO.optAtt[h]]!="undefined"){c+=" "+UFO.optAtt[h]+'="'+g[UFO.optAtt[h]]+'"'}}var a="";var f=UFO.opt.length;for(var h=0;h<f;h++){if(typeof g[UFO.opt[h]]!="undefined"){a+='<param name="'+UFO.opt[h]+'" value="'+g[UFO.opt[h]]+'" />'}}var b=window.location.protocol=="https:"?"https:":"http:";j.innerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+c+' width="'+g.width+'" height="'+g.height+'" codebase="'+b+"//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+g.majorversion+",0,"+g.build+',0"><param name="movie" value="'+g.movie+'" />'+a+"</object>"}}},createDialog:function(a){var c=UFO.foList[a];UFO.createCSS("html","height:100%; overflow:hidden;");UFO.createCSS("body","height:100%; overflow:hidden;");UFO.createCSS("#xi-con","position:absolute; left:0; top:0; z-index:1000; width:100%; height:100%; background-color:#fff; filter:alpha(opacity:75); opacity:0.75;");UFO.createCSS("#xi-dia","position:absolute; left:50%; top:50%; margin-left: -"+Math.round(parseInt(c.xiwidth,10)/2)+"px; margin-top: -"+Math.round(parseInt(c.xiheight,10)/2)+"px; width:"+c.xiwidth+"px; height:"+c.xiheight+"px;");var i=document.getElementsByTagName("body")[0];var g=UFO.createElement("div");g.setAttribute("id","xi-con");var e=UFO.createElement("div");e.setAttribute("id","xi-dia");g.appendChild(e);i.appendChild(g);var j=window.location;if(UFO.uaHas("xml")&&UFO.uaHas("safari")){var h=document.getElementsByTagName("title")[0].firstChild.nodeValue=document.getElementsByTagName("title")[0].firstChild.nodeValue.slice(0,47)+" - Flash Player Installation"}else{var h=document.title=document.title.slice(0,47)+" - Flash Player Installation"}var b=UFO.pluginType=="ax"?"ActiveX":"PlugIn";var f=typeof c.xiurlcancel!="undefined"?"&xiUrlCancel="+c.xiurlcancel:"";var d=typeof c.xiurlfailed!="undefined"?"&xiUrlFailed="+c.xiurlfailed:"";UFO.foList["xi-dia"]={movie:c.ximovie,width:c.xiwidth,height:c.xiheight,majorversion:"6",build:"65",flashvars:"MMredirectURL="+j+"&MMplayerType="+b+"&MMdoctitle="+h+f+d};UFO.writeSWF("xi-dia")},expressInstallCallback:function(){var b=document.getElementsByTagName("body")[0];var a=document.getElementById("xi-con");b.removeChild(a);UFO.createCSS("body","height:auto; overflow:auto;");UFO.createCSS("html","height:auto; overflow:auto;")},cleanupIELeaks:function(){var b=document.getElementsByTagName("object");var d=b.length;for(var c=0;c<d;c++){b[c].style.display="none";for(var a in b[c]){if(typeof b[c][a]=="function"){b[c][a]=null}}}}};if(typeof window.attachEvent!="undefined"&&UFO.uaHas("ieWin")){window.attachEvent("onunload",UFO.cleanupIELeaks);
/*
 * @file cn.stylemanager.js
 * @version 1.0.0
 * @author Paul Bronshteyn
 * @comment Built by a geek loaded on caffeine ...
 * @copyright (c) Conde Nast Digital
 */
}if(typeof CN==="undefined"||!CN||typeof jQuery==="undefined"||!jQuery){throw ("CN and/or jQuery library is missing!")}CN.styleManager=(function(c){var f="fontSize",d=c("#default-size").attr("title"),b=CN.cookie.get(f)||d,a=function(){var g=c(this).parent().attr("class");if(g!==b){e(g)}return false},e=function(g){c('link[title="'+b+'"]').attr({disabled:true});c('link[title="'+g+'"]').attr({disabled:false});b=g;CN.cookie.set(f,g)};c(".utility-textsize a").live("click",a);if(b!==d){e(b)}return{setSize:function(g){c(".utility-textsize").find("."+g+" a").trigger("click");return this},getSize:function(){return b},resetSize:function(){e(d);return this}}})(jQuery);CN.site.videoReadToken="5i49twTEPhduFGrf1ZHWSJL8tIlSunYje0Ka5j_x310.";CN.site.channelplayerId="5182058001";CN.brightcove=CN.brightcove||{};CN.brightcove.singlewidth=486;CN.brightcove.singleheight=455;CN.brightcove.videoheader="bottom";jQuery(window).bind("CN.customEvents.noFlashInstalled",function(b,a){jQuery("#"+a.id+" .featureimg").hide()});
