var isIpad=false;if(navigator.userAgent.indexOf("iPad")!=-1){isIpad=true}$(function(){$.fn.dVideoFullscreen=function(a){var c={theme:"pacorabanne",childtheme:"",controls:true,loop:false};var a=$.extend(c,a);var b=true;return this.each(function(){var J=$(this).find("video");var u=$(window).width();var e=$(window).height();var r=(u-400)/1.78;if(J.hasClass("dago_video_player_fullscreen")){$(this).addClass(a.theme).addClass(a.childtheme)}J.css({positon:"absolute","z-index":"10000"});var t='<ul class="dago_controls">';t+='<li><a class="bt_play bt mouse-hover pause"></a></li>';t+='<li><div class="bt seek"></div></li>';if(!isIpad){t+='<li><a class="bt mouse-hover bt_volume"></a></li>'}t+='<li><a class="bt mouse-hover bt_fullscreen"></a></li>';t+="</ul>";var F=$(".dago_video_player_fullscreen");F.append(t);var E=$(".dago_controls",F);var d=$(".bt_play",F);var H=$(".bt_volume",F);var j=$(".seek",F);var h=$(".bt_fullscreen",F);var I=$(window).width();var o=$(window).height();var l=I/o;var w=J.attr("width");var v=J.attr("height");var D=w/v;var g=I/w;if(l>=D){g=o/v}var z=g*v;var p=g*w;J.height(z);J.width(p);F.width(I-20);E.css({position:"fixed",bottom:"0"});J.css({position:"absolute",bottom:"0",left:"50%","margin-left":(-J.width()/2)+"px"});j.css({width:$(window).width()-120});E.css({width:$(window).width()-40,"z-index":"10000",right:10});$("#ready_vid").css("background-color","#000000");$(window).bind("resize",function(){G()});if(!a.controls){E.hide()}var C=function(){if(J[0].paused==false){J[0].pause();d.removeClass("pause")}else{J[0].play();d.addClass("pause")}};var i=function(){if(J[0].muted){J[0].muted=false;H.removeClass("mute")}else{J[0].muted=true;H.addClass("mute")}};var A=function(){$("#close_fs").trigger("click")};var B=function(){var M=$(window).width();var K=$(window).height();var P=M/K;var Q=J.attr("width");var S=J.attr("height");var R=Q/S;var O=M/Q;if(P>=R){O=K/S}var L=O*S;var N=O*Q;J.height(L);J.width(N);J.css("margin-left",(-N/2)+"px")};var G=function(M){var L=$(window).width();var K=$(window).height();B();F.width(L);E.css({width:(L-30)+"px",right:"10px"},500,"easeOutCirc").find(".seek").css({width:(L-220)+"px"})};var y;var n=function(){var K=J[0].duration;j.slider({range:"min",min:0,max:K,step:0.01,stop:function(M,L){y=false;J[0].currentTime=L.value},slide:function(){y=true}})};J.bind("loadedmetadata",n);var q=function(){var K=J[0].currentTime;if(!y){j.slider("value",K.toFixed(1))}};var m=function(){var K=($(window).width());valeurMoins=110;j.css("width",(K-valeurMoins)+"px");E.css("margin-left",0)};var k=function(){d.bind("click",function(){C()});J.click(C);h.click(A);H.click(i);$(J).keyup(function(K){if(b&&K.keyCode==27){A()}});$(J).keyup(function(K){if(K.keyCode==32){C()}})};var x=function(){J.bind("play",function(){d.addClass("pause");if(a.useCuePoints){f()}});J.bind("pause",function(){d.removeClass("pause");if(a.useCuePoints){s()}});J.bind("ended",function(){d.removeClass("pause");if(a.useCuePoints){s()}});J.bind("timeupdate",q);$(window).resize(function(){m()})};k();x();if(J.paused==true){d.removeClass("pause")}var s=function(){window.clearInterval(J.timer)};var f=function(){J.timer=window.setInterval(function(){modelsUpdate.update(J[0].currentTime)},1000)}})}});
