//code for YouTube Video Popup player ////Add to link with .pop class and "ref" attribute with YouTube video ID //////EXAMPLE: video pop //////OR use onclick event:
$j(document).ready(function () { $j("head").append(""); $j("body").append("
"); overlay(); $j(".playBtn").css("opacity", ".6"); $j(".playBtn").mouseenter(function() { $j(this).stop().animate({"opacity": 1}, "fast") }); $j(".playBtn").mouseleave(function() { $j(this).stop().animate({"opacity": .6}, "slow") }); }); var mobile = false; function getMobile() { var window_width = window.innerWidth; var orientation = window.orientation; if (window_width < 760) { $j("body").addClass('mobile_video'); $j("head").append(""); mobile = true; } } function overlay() { var playID; $j("#overlay, .close_btn").click(function () { $j("#overlay").hide(); $j(".close_btn").hide("fast"); $j("#overlay_video").remove(); $j("#gallery").trigger("mouseleave"); }); $j(".pop").click(function () { playID = $j(this).attr("ref"); pop(playID); return false; }); } function closeYT() { $j("#overlay").hide(); $j(".close_btn").hide("fast"); $j("#overlay_video").remove(); $j("#gallery").trigger("mouseleave"); } function pop(playID) { if ($j("#overlay_video").size() == 0) { $j("body").append("
"); getMobile(); } if ($j.browser.msie && parseInt($j.browser.version, 10) == 6) { $j("#overlay").height($j(document).height()); $j("#overlay_video").css({ "top": ($j(window).height() / 2) }); scroll(0, 0); } $j("#overlay").show(); $j("#overlay_video").show(0, function () { if (mobile) { if (swfobject.hasFlashPlayerVersion("8.0.0")) { swfobject.embedSWF(("http://www.youtube.com/e/" + playID + "?enablejsapi=1&playerapiid=myytplayer&autoplay=1&rel=0"), "youtube_video", "300", "200", "8", null, null, { allowScriptAccess: "always", wmode: 'transparent', allowFullScreen: "true" }, { id: "youtube_video" }); } else { $j("#youtube_video").html(''); } } else { if (swfobject.hasFlashPlayerVersion("8.0.0")) { swfobject.embedSWF(("http://www.youtube.com/e/" + playID + "?enablejsapi=1&playerapiid=myytplayer&autoplay=1&rel=0"), "youtube_video", "600", "400", "8", null, null, { allowScriptAccess: "always", wmode: 'transparent', allowFullScreen: "true" }, { id: "youtube_video" }); } else { $j("#youtube_video").html(''); } } }); }