(function(b){function oa(){ha.attr({width:k.width(),height:k.height()})}function pa(){ia=k.width();y=ia-237+M;N&&(p.css("width",y),D.css("width",y),X());f.width(ia);f.height(k.height())}function qa(a){f=b("").addClass("cj-video");c=f[0];b("").attr("type","video/webm").attr("src",a+".webm").prependTo(f);b("").attr("type","video/mp4").attr("src",a+".mp4").prependTo(f)}function Y(a,b){0!==a?(b&&(t.show(),u.hide()),t.hide(),u.show(),v.data("isOn",!0)):(b&&(u.show(),t.hide()), u.hide(),t.show(),v.data("isOn",!1),E&&l.css("width",0))}function ra(a){a&&a.stopPropagation();c.removeEventListener("canplay",ra,!1);c.pause();F=b(".cj-vid-full");q=b(".cj-vid-play");m=b(".cj-vid-pause");t=b(".cj-vid-mute");D=b(".cj-vid-total");G=b(".cj-vid-normal");u=b(".cj-vid-volume");p=b(".cj-vid-lines");H=b(".cj-vid-time");z=b(".cj-vid-progress");O=b(".cj-vid-vol-total");l=b(".cj-vid-vol-current");v=b(".cj-vid-vol-buttons");A=b(".cj-vid-vol-lines");P=b(".cj-vid-fullscreen");Q=b(".cj-vid-play-pause"); r=b("").addClass("cj-vid-play-btn").appendTo(h);I=Q.length&&q.length&&m.length;ja=v.length&&u.length&&t.length;E=A.length&&l.length&&O.length;sa=P.length&&F.length&&G.length;N=p.length&&z.length&&D.length;R=H.length;I?(S?(q.hide(),m.show()):(m.hide(),q.show()),Q.click(Z)):Q.length?Q.hide():(q.length&&q.hide(),m.length&&m.hide());ja?(Y(s,!0),v.click(Ca)):v.length?v.hide():(u.length&&u.hide(),t.length&&t.hide());E?(ta=parseInt(A.css("padding-left"),10)||9,ka=parseInt(O.css("width"),10)||55, l.css("width",ka*s),A.click(Da)):(E=!1,A.length?A.hide():(l.length&&l.hide(),O.length&&O.hide()));sa&&("webkitSupportsFullscreen"in c||"mozFullScreenEnabled"in g)?(P.click(Ea),T=!1,M=0):(M=22,P.length?P.hide():(F.length&&F.hide(),G.length&&G.hide()));N?(p.css("width",y+M),D.css("width",y+M),z.css("width",0),p.click(Fa)):p.length?p.hide():(z.length&&z.hide(),D.length&&D.hide());R&&(d=c.duration/60,w=parseInt(60*(d-parseInt(d,10)),10),d=parseInt(d,10),U="/"+(10>d?"0"+d:d)+":"+(10>w?"0"+w:w),H.text("00:00"+ U));V=!1;c.addEventListener("ended",Ga,!1);x.mouseenter(Ha).mouseleave(Ia);f.click(Z);r.click(Z);J=!1;c.pause();c.volume=s;parent.hasOwnProperty("jackboxFrameReady")?(aa=!0,parent.jackboxFrameReady()):b.jackboxVideo.fullyLoaded()}function Ja(){c.play()}function ua(){J=!0;null!==e&&clearTimeout(e);e=setTimeout(W,3E3);h.mousemove(ba).mouseleave(W)}function Ha(){V=!0}function Ia(){V=!1}function ba(a){a&&a.stopPropagation();null!==e&&clearTimeout(e);B?x.css("opacity",1):x.animate({opacity:1},300);if(C&& !V&&J&&(!T||ca))e=setTimeout(W,3E3)}function W(){null!==e&&clearTimeout(e);B?x.css("opacity",0):x.animate({opacity:0},300)}function Ga(a){a.stopPropagation();null!==j&&(clearInterval(j),j=null);null!==e&&(clearTimeout(e),e=null);null!==n&&(clearTimeout(n),n=null);c.pause();J=!1;c.currentTime=0;H.text("00:00"+U);h.unbind("mousemove",ba).unbind("mouseleave",W);N&&z.css("width",0);I&&(m.hide(),q.show());B?(x.css("opacity",1),r.css({cursor:"pointer",opacity:1})):(x.animate({opacity:1},300),r.css("cursor", "pointer").animate({opacity:1},300))}function Z(){c.paused?(c.play(),I&&(q.hide(),m.show()),J||ua(),N&&(j=setInterval(X,250)),B?r.css({cursor:"auto",opacity:0}):r.css("cursor","auto").animate({opacity:0},300)):(c.pause(),I&&(m.hide(),q.show()),null!==j&&(clearInterval(j),j=null),B?r.css({cursor:"pointer",opacity:1}):r.css("cursor","pointer").animate({opacity:1},300));ba()}function Da(a){a.stopPropagation();a=a.pageX-A.offset().left-ta;var b=a/ka;l.css("width",a);c.volume=b;ja&&Y(b,!1)}function Ca(){v.data("isOn")? (E&&(va=parseInt(l.css("width"),10),l.css("width",0)),la=c.volume,c.volume=0,Y(0,!1)):(E&&l.css("width",va),c.volume=la,Y(1,!1))}function Fa(a){a.stopPropagation();null!==j&&(clearInterval(j),j=null);null===ma&&(ma=parseInt(p.css("padding-left"),10));c.pause();c.currentTime=c.duration*((a.pageX-p.offset().left-ma)/y);X();Z()}function X(){wa=c.currentTime/c.duration;z.css("width",y*wa|0);R&&(d=c.currentTime/60,w=parseInt(60*(d-parseInt(d,10)),10),d=parseInt(d,10),H.text((10>d?"0"+d:d)+":"+(10>w?"0"+ w:w)+U))}function Ka(){T=!1;n=null}function Ea(){C?da():g.mozFullScreenEnabled?(g.addEventListener("mozfullscreenchange",xa,!1),h[0].mozRequestFullScreen()):c.webkitSupportsFullscreen&&(null!==n&&clearTimeout(n),T=!0,n=setTimeout(Ka,4E3),g.addEventListener("webkitfullscreenchange",ea,!1),h[0].webkitRequestFullScreen());C=!C}function xa(){g.mozFullScreen?(C=!0,ya()):da(!0)}function ea(){g.webkitIsFullScreen?(g.removeEventListener("webkitfullscreenchange",ea,!1),C=!0,setTimeout(ya,50)):da(!0)}function ya(){F.hide(); G.show();ba();V=!1;k.off("resize.cj").on("resize.cj",La);c.webkitSupportsFullscreen&&g.addEventListener("webkitfullscreenchange",ea,!1)}function La(){k.off("resize.cj");da()}function da(a){if(g.mozFullScreenEnabled){g.removeEventListener("mozfullscreenchange",xa,!1);if(a)return;g.mozCancelFullScreen()}else c.webkitSupportsFullscreen&&(g.removeEventListener("webkitfullscreenchange",ea,!1),null!==n&&(clearTimeout(n),T=!1,n=null),a||g.webkitCancelFullScreen());F.show();G.hide();C=!1;J&&W()}var s=75, ma=null,ha=null,C=!1,n=null,e=null,j=null,ca=!1,I,E,J,T,H,V,B,h,U,ja,Q,ta,va,la,R,fa,M,x,p,z,A,P,O,ka,ia,N,aa,za,f,r,sa,t,u,K,Aa,y,Ba,D,l,v,G,na,c,wa,m,L,S,d,w,q,F,k,ga,g;b.jackboxVideo=function(){"undefined"!==typeof Modernizr?(K=Modernizr.touch,fa=Modernizr.video,B=Modernizr.csstransitions):fa=K=B=!1;g=document;k=b(window);b(g);Ba=b("body");L=navigator.userAgent.toLowerCase();h=b("
").addClass("cj-video-container").appendTo(Ba);s*=0.01;ca=-1!==L.search("firefox");(na=-1!==L.search("msie"))&& (na=9>parseFloat(L.substr(L.indexOf("msie")+4)));var a=g.URL.split("?")[1],d=a.indexOf("poster="),e=a.substring(d+7,a.indexOf("&firefox"));S=-1!==a.search("autoplay=true");ga=a.substring(a.indexOf("video=")+6,a.indexOf("&autoplay")).split(".mp4")[0];ca&&(!K&&"true"===a.substring(a.indexOf("firefox=")+8,a.length))&&(fa=!1);fa&&"false"===a.substring(a.indexOf("flashing=")+9,a.indexOf("&width"))&&!na?(qa(ga),K?("false"!==e&&f.attr("poster",e),S&&f.attr("autoplay","autoplay"),f.attr("controls","controls").prependTo(h), parent.hasOwnProperty("jackboxFrameReady")?(aa=!0,parent.jackboxFrameReady()):b.jackboxVideo.fullyLoaded()):(x=b("").addClass("cj-vid-controls").html('
00:00/00:00
').appendTo(h), f.prependTo(h),c.volume=0,0===s&&(s=1),la=s,c.addEventListener("canplay",ra,!1),c.play())):K?(qa(ga),"false"!==e&&f.attr("poster",e),f.attr("controls","controls").prependTo(h),parent.hasOwnProperty("jackboxFrameReady")?(aa=!0,parent.jackboxFrameReady()):b.jackboxVideo.fullyLoaded()):(e=a.indexOf("height="),Aa=a.substring(a.indexOf("width=")+6,e),za=a.substring(e+7,d),"jackboxFrameReady"in parent?parent.jackboxFrameReady(!0):b.jackboxVideo.fullyLoaded())};b.jackboxVideo.videoReady=function(){oa(); k.resize(oa);try{(-1===L.search("msie")?g.myflash:k[0].myflash).videoResized()}catch(a){}h.css("background-image","none");f.css("opacity",1)};b.jackboxVideo.fullyLoaded=function(){f?(pa(),k.resize(pa),h.css("background-image","none"),f.css("visibility","visible"),R&&H.text("00:00"+U),aa&&ca&&h.addClass("cj-video-fix"),S&&!K&&(setTimeout(Ja,100),R&&(j=setInterval(X,250)),ua(),r.css({cursor:"auto",opacity:0}),I&&m.show())):(ha=b(''),f=b("").css("opacity",0).prependTo(h).append(ha))};b(document).ready(function(){b.jackboxVideo()})})(jQuery);function videoReady(){$.jackboxVideo.videoReady()}function cjInit(){$.jackboxVideo.fullyLoaded()};