var NikeOS=NikeOS||{};(function(){var is_iPad=navigator.userAgent.match(/iPad/i)!=null;var is_iPod=navigator.userAgent.match(/iPod/i)!=null;var is_iPhone=navigator.userAgent.match(/iPnone/i)!=null;NikeOS.VideoOverlayController={init:function(){this._create_container();this._bindObservers()},play:function(id,alt_url,labels){this.$featured_inner.empty();this.$featured_inner.append('<div id="brightcove_container"></div>');if(is_iPad||is_iPhone){var regexp=/^.*((youtu.be\/)|(v\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;var yId=alt_url.match(regexp);JQ("#brightcove_container").html('<iframe width="768" height="514" src="http://www.youtube.com/embed/'+yId[6]+'" frameborder="0" allowfullscreen></iframe>')}else{labels=labels||"http://assets.nikevideo.nike.com/video_player/xml/translate/2.1/"+Nav_Config.locale+"_Labels.xml";VC.create_player({videoId:id,"@videoId":id,autoStart:"true",width:"910",locale:Nav_Config.locale,labels:labels,linkBaseURL:alt_url})}this.$featured.show();this.$shadow.show();JQ("body").scrollTop(0)},close:function(){if(typeof VC!=="undefined"&&VC.current_video){VC.bc_video_stop()}this.$featured.hide();this.$shadow.hide()},_bindObservers:function(){var me=this;JQ("#close-video").click(function(e){e.preventDefault();me.close();return false});JQ("[data-play-video]").click(function(e){var $elem=JQ(this);e.preventDefault();var guid=$elem.attr("data-play-video"),youtube_link=$elem.attr("href");me.play(guid,youtube_link)})},_create_container:function(){if(is_iPad){this.$shadow_container=JQ("#page-container")}else{this.$shadow_container=JQ("#shadow-container")}this.$shadow_container.append('<div id="overlay-shadow"></div>');this.$shadow_container.prepend('<div class="feature" id="featured"><div class="inner" id="featured_inner"><div id="brightcove_container"></div></div><a href="#" id="close-video"></a></div>');this.$shadow=JQ("#overlay-shadow");if(is_iPad){this.$shadow.height(JQ(document).height())}this.$featured=JQ("#featured"),this.$featured_inner=JQ("#featured_inner"),this.$featured.css({left:"15px",top:"101px"});if(!is_iPad){this.$shadow.css({left:"15px",width:"910px"})}this.$shadow_container.css({position:"relative"})}};JQ(function(){NikeOS.VideoOverlayController.init()})})();function onVideoComplete(){NikeOS.VideoOverlayController.close()};
