/*jquery.mb.vimeo_player 11-05-2017
_ jquery.mb.components
_ email: matteo@open-lab.com
_ Copyright (c) 2001-2017. Matteo Bicocchi (Pupunzi);
_ blog: http://pupunzi.open-lab.com
_ Open Lab s.r.l., Florence - Italy
*/
function isTouchSupported(){var a=nAgt.msMaxTouchPoints,b="ontouchstart"in document.createElement("div");return!(!a&&!b)}var get_vimeo_videoID=function(a){var b;return b=a.indexOf("vimeo.com")>0?a.substr(a.lastIndexOf("/")+1,a.length):a.length>15?null:a};!function($){jQuery.vimeo_player={name:"jquery.mb.vimeo_player",author:"Matteo Bicocchi (pupunzi)",version:"1.0.10",build:"414",defaults:{containment:"body",ratio:"16/9",videoURL:null,startAt:0,stopAt:0,autoPlay:!0,fadeTime:1e3,vol:50,addRaster:!1,opacity:1,mute:!0,loop:!0,showControls:!0,show_vimeo_logo:!0,stopMovieOnBlur:!0,realfullscreen:!0,mobileFallbackImage:null,gaTrack:!1,optimizeDisplay:!0,mask:!1,align:"center,center",onReady:function(a){}},controls:{play:"P",pause:"p",mute:"M",unmute:"A",fullscreen:"O",showSite:"R",logo:"V"},buildPlayer:function(options){var isIframe=function(){var a=!1;try{self.location.href!=top.location.href&&(a=!0)}catch(b){a=!0}return a},script=document.createElement("script");return script.src="//player.vimeo.com/api/player.js",script.onload=function(){jQuery(document).trigger("vimeo_api_loaded")},document.head.appendChild(script),this.each(function(){var vimeo_player=this,$vimeo_player=jQuery(vimeo_player);vimeo_player.loop=0,vimeo_player.opt={},vimeo_player.state={},vimeo_player.id=vimeo_player.id||"YTP_"+(new Date).getTime(),$vimeo_player.addClass("vimeo_player");var property=$vimeo_player.data("property")&&"string"==typeof $vimeo_player.data("property")?eval("("+$vimeo_player.data("property")+")"):$vimeo_player.data("property");if(jQuery.extend(vimeo_player.opt,jQuery.vimeo_player.defaults,options,property),vimeo_player.opt.ratio="auto"==vimeo_player.opt.ratio?"16/9":vimeo_player.opt.ratio,eval(vimeo_player.opt.loop)&&(vimeo_player.opt.loop=9999),vimeo_player.isRetina=window.retina||window.devicePixelRatio>1,vimeo_player.canGoFullScreen=!(jQuery.browser.msie||jQuery.browser.opera||isIframe()),vimeo_player.canGoFullScreen||(vimeo_player.opt.realfullscreen=!1),vimeo_player.isAlone=!1,vimeo_player.hasFocus=!0,vimeo_player.videoID=this.opt.videoURL?get_vimeo_videoID(this.opt.videoURL):!!$vimeo_player.attr("href")&&get_vimeo_videoID($vimeo_player.attr("href")),vimeo_player.isSelf="self"==vimeo_player.opt.containment,vimeo_player.opt.containment="self"==vimeo_player.opt.containment?jQuery(this):jQuery(vimeo_player.opt.containment),vimeo_player.isBackground=vimeo_player.opt.containment.is("body"),!vimeo_player.isBackground||!vimeo_player.backgroundIsInited){vimeo_player.canPlayOnMobile=vimeo_player.isSelf&&0===jQuery(this).children().length,vimeo_player.isSelf||$vimeo_player.hide();var overlay=jQuery("
").css({position:"absolute",top:0,left:0,width:"100%",height:"100%"}).addClass("vimeo_player_overlay");vimeo_player.isSelf&&overlay.on("click",function(){$vimeo_player.togglePlay()});var playerID="vimeo_player_"+vimeo_player.id,wrapper=jQuery("").addClass("vimeo_player_wrapper").attr("id","vimeo_player_wrapper_"+playerID);if(wrapper.css({position:"absolute",zIndex:0,minWidth:"100%",minHeight:"100%",left:0,top:0,overflow:"hidden",opacity:0}),vimeo_player.playerBox=jQuery("").attr("id",playerID).addClass("playerBox"),vimeo_player.playerBox.css({position:"absolute",zIndex:0,width:"100%",height:"100%",top:-10,frameBorder:0,overflow:"hidden",left:0}).attr({src:"//player.vimeo.com/video/"+vimeo_player.videoID+"?background=1"}),vimeo_player.opt.containment.prepend(wrapper),jQuery.browser.mobile&&!vimeo_player.canPlayOnMobile)return vimeo_player.opt.mobileFallbackImage&&wrapper.css({backgroundImage:"url("+vimeo_player.opt.mobileFallbackImage+")",backgroundPosition:"center center",backgroundSize:"cover",backgroundRepeat:"no-repeat",opacity:1}),setTimeout(function(){var a=jQuery.Event("VPFallback");$vimeo_player.trigger(a)},1e3),$vimeo_player.hide(),$vimeo_player;wrapper.append(vimeo_player.playerBox),vimeo_player.opt.containment.children().not("script, style").each(function(){"static"==jQuery(this).css("position")&&jQuery(this).css("position","relative")}),vimeo_player.isBackground?(jQuery("body").css({boxSizing:"border-box"}),wrapper.css({position:"fixed",top:0,left:0,zIndex:0})):"static"==vimeo_player.opt.containment.css("position")&&vimeo_player.opt.containment.css({position:"relative"}),vimeo_player.wrapper=wrapper,vimeo_player.playerBox.css({opacity:1}),jQuery.browser.mobile||(vimeo_player.playerBox.after(overlay),vimeo_player.overlay=overlay),vimeo_player.isBackground||overlay.on("mouseenter",function(){vimeo_player.controlBar&&vimeo_player.controlBar.length&&vimeo_player.controlBar.addClass("visible")}).on("mouseleave",function(){vimeo_player.controlBar&&vimeo_player.controlBar.length&&vimeo_player.controlBar.removeClass("visible")}),jQuery(document).on("vimeo_api_loaded",function(){vimeo_player.player=new Vimeo.Player(playerID,options),vimeo_player.player.ready().then(function(){function start(){vimeo_player.isReady=!0,vimeo_player.opt.mute&&setTimeout(function(){$vimeo_player.v_mute()},1),vimeo_player.opt.showControls&&jQuery.vimeo_player.buildControls(vimeo_player),vimeo_player.opt.autoPlay?setTimeout(function(){$vimeo_player.v_play(),setTimeout(function(){VEvent=jQuery.Event("VPStart"),$vimeo_player.trigger(VEvent)},vimeo_player.opt.fadeTime)},1):$vimeo_player.v_pause(),VEvent=jQuery.Event("VPReady"),$vimeo_player.trigger(VEvent)}var VEvent;vimeo_player.opt.startAt?(vimeo_player.player.play().then(function(){vimeo_player.player.pause()}),$vimeo_player.v_seekTo(vimeo_player.opt.startAt,function(){start()})):start(),$vimeo_player.v_optimize_display(),jQuery(window).off("resize.vimeo_player_"+vimeo_player.id).on("resize.vimeo_player_"+vimeo_player.id,function(){$vimeo_player.v_optimize_display()}),vimeo_player.player.on("progress",function(a){VEvent=jQuery.Event("VPProgress"),VEvent.data=a,$vimeo_player.trigger(VEvent)}),vimeo_player.player.on("error",function(a){vimeo_player.state=-1,VEvent=jQuery.Event("VPError"),VEvent.error=a,$vimeo_player.trigger(VEvent)}),vimeo_player.player.on("play",function(data){vimeo_player.state=1,$vimeo_player.trigger("change_state"),vimeo_player.controlBar&&vimeo_player.controlBar.length&&vimeo_player.controlBar.find(".vimeo_player_pause").html(jQuery.vimeo_player.controls.pause),"undefined"!=typeof _gaq&&eval(vimeo_player.opt.gaTrack)&&_gaq.push(["_trackEvent","vimeo_player","Play",vimeo_player.videoID]),"undefined"!=typeof ga&&eval(vimeo_player.opt.gaTrack)&&ga("send","event","vimeo_player","play",vimeo_player.videoID),VEvent=jQuery.Event("VPPlay"),VEvent.error=data,$vimeo_player.trigger(VEvent)}),vimeo_player.player.on("pause",function(a){vimeo_player.state=2,$vimeo_player.trigger("change_state"),vimeo_player.controlBar&&vimeo_player.controlBar.length&&vimeo_player.controlBar.find(".vimeo_player_pause").html(jQuery.vimeo_player.controls.play),VEvent=jQuery.Event("VPPause"),VEvent.time=a,$vimeo_player.trigger(VEvent)}),vimeo_player.player.on("seeked",function(a){vimeo_player.state=3,$vimeo_player.trigger("change_state")}),vimeo_player.player.on("ended",function(a){vimeo_player.state=0,$vimeo_player.trigger("change_state"),VEvent=jQuery.Event("VPEnd"),VEvent.time=a,$vimeo_player.trigger(VEvent)}),vimeo_player.player.on("timeupdate",function(a){if(vimeo_player.duration=a.duration,vimeo_player.percent=a.percent,vimeo_player.seconds=a.seconds,vimeo_player.state=1,vimeo_player.player.getPaused().then(function(a){a&&(vimeo_player.state=2)}),vimeo_player.opt.stopMovieOnBlur&&(document.hasFocus()||1==vimeo_player.state&&(vimeo_player.hasFocus=!1,$vimeo_player.v_pause(),vimeo_player.document_focus=setInterval(function(){document.hasFocus()&&!vimeo_player.hasFocus&&(vimeo_player.hasFocus=!0,$vimeo_player.v_play(),clearInterval(vimeo_player.document_focus))},300))),vimeo_player.opt.showControls){var b=jQuery("#controlBar_"+vimeo_player.id),c=b.find(".vimeo_player_pogress"),d=b.find(".vimeo_player_loaded"),e=b.find(".vimeo_player_seek_bar"),f=c.outerWidth(),g=Math.floor(a.seconds),h=Math.floor(a.duration),i=g*f/h,j=0,k=100*a.percent;d.css({left:j,width:k+"%"}),e.css({left:0,width:i}),a.duration?vimeo_player.controlBar.find(".vimeo_player_time").html(jQuery.vimeo_player.formatTime(a.seconds)+" / "+jQuery.vimeo_player.formatTime(a.duration)):vimeo_player.controlBar.find(".vimeo_player_time").html("-- : -- / -- : --")}if(vimeo_player.opt.addRaster){var l="dot"==vimeo_player.opt.addRaster?"raster-dot":"raster";vimeo_player.overlay.addClass(vimeo_player.isRetina?l+" retina":l)}else vimeo_player.overlay.removeClass(function(a,b){var c=b.split(" "),d=[];return jQuery.each(c,function(a,b){/raster.*/.test(b)&&d.push(b)}),d.push("retina"),d.join(" ")});vimeo_player.opt.stopAt=vimeo_player.opt.stopAt>a.duration?a.duration-.5:vimeo_player.opt.stopAt;var m=vimeo_player.opt.stopAt||a.duration-.5;a.seconds>=m&&(vimeo_player.loop=vimeo_player.loop||0,vimeo_player.opt.loop&&vimeo_player.loop=c.opt.stopAt?c.opt.stopAt-.5:a;return c.player.setCurrentTime(d).then(function(a){"function"==typeof b&&b(a)}),this},setVolume:function(a){var b=this.get(0);return a||b.opt.vol||!b.isMute?!a&&!b.isMute||a&&b.opt.vol==a?b.isMute?jQuery(b).v_mute():jQuery(b).v_unmute():(b.opt.vol=a,b.player.setVolume(b.opt.vol),b.volumeBar&&b.volumeBar.length&&b.volumeBar.updateSliderVal(100*a)):jQuery(b).v_unmute(),this},toggleVolume:function(){var a=this.get(0);if(a)return a.isMute?(jQuery(a).v_unmute(),!0):(jQuery(a).v_mute(),!1)},mute:function(){var a=this.get(0);if(!a.isMute){a.isMute=!0,a.player.setVolume(0),a.volumeBar&&a.volumeBar.length&&a.volumeBar.width()>10&&a.volumeBar.updateSliderVal(0);var b=jQuery("#controlBar_"+a.id),c=b.find(".vimeo_player_muteUnmute");return c.html(jQuery.vimeo_player.controls.unmute),jQuery(a).addClass("isMuted"),a.volumeBar&&a.volumeBar.length&&a.volumeBar.addClass("muted"),this}},unmute:function(){var a=this.get(0);if(a.isMute){a.isMute=!1,jQuery(a).v_set_volume(a.opt.vol),a.volumeBar&&a.volumeBar.length&&a.volumeBar.updateSliderVal(a.opt.vol>.1?a.opt.vol:.1);var b=jQuery("#controlBar_"+a.id),c=b.find(".vimeo_player_muteUnmute");return c.html(jQuery.vimeo_player.controls.mute),jQuery(a).removeClass("isMuted"),a.volumeBar&&a.volumeBar.length&&a.volumeBar.removeClass("muted"),this}},changeMovie:function(a){var b=this.get(0);b.player.loadVideo(a.url).then(function(a){jQuery(b).v_setState()})},buildControls:function(vimeo_player){var data=vimeo_player.opt;if(!jQuery("#controlBar_"+vimeo_player.id).length){vimeo_player.controlBar=jQuery("").attr("id","controlBar_"+vimeo_player.id).addClass("vimeo_player_bar").css({whiteSpace:"noWrap",position:vimeo_player.isBackground?"fixed":"absolute",zIndex:vimeo_player.isBackground?1e4:1e3});var buttonBar=jQuery("").addClass("buttonBar"),playpause=jQuery(""+jQuery.vimeo_player.controls.play+"").addClass("vimeo_player_pause vimeo_icon").click(function(){1==vimeo_player.state?jQuery(vimeo_player).v_pause():jQuery(vimeo_player).v_play()}),MuteUnmute=jQuery(""+jQuery.vimeo_player.controls.mute+"").addClass("vimeo_player_muteUnmute vimeo_icon").click(function(){vimeo_player.isMute?jQuery(vimeo_player).v_unmute():jQuery(vimeo_player).v_mute()}),volumeBar=jQuery("").addClass("vimeo_player_volume_bar").css({display:"inline-block"});vimeo_player.volumeBar=volumeBar;var idx=jQuery("").addClass("vimeo_player_time"),vURL="https://vimeo.com/"+vimeo_player.videoID,movieUrl=jQuery("").html(jQuery.vimeo_player.controls.logo).addClass("vimeo_url vimeo_icon").attr("title","view on Vimeo").on("click",function(){window.open(vURL,"viewOnVimeo")}),fullscreen=jQuery("").html(jQuery.vimeo_player.controls.fullscreen).addClass("vimeo_fullscreen vimeo_icon").on("click",function(){jQuery(vimeo_player).v_fullscreen(data.realfullscreen)}),progressBar=jQuery("").addClass("vimeo_player_pogress").css("position","absolute").click(function(a){timeBar.css({width:a.clientX-timeBar.offset().left}),vimeo_player.timeW=a.clientX-timeBar.offset().left,vimeo_player.controlBar.find(".vimeo_player_loaded").css({width:0});var b=Math.floor(vimeo_player.duration);vimeo_player.goto=timeBar.outerWidth()*b/progressBar.outerWidth(),jQuery(vimeo_player).v_seekTo(parseFloat(vimeo_player.goto)),vimeo_player.controlBar.find(".vimeo_player_loaded").css({width:0})}),loadedBar=jQuery("").addClass("vimeo_player_loaded").css("position","absolute"),timeBar=jQuery("").addClass("vimeo_player_seek_bar").css("position","absolute");progressBar.append(loadedBar).append(timeBar),buttonBar.append(playpause).append(MuteUnmute).append(volumeBar).append(idx),data.show_vimeo_logo&&buttonBar.append(movieUrl),(vimeo_player.isBackground||eval(vimeo_player.opt.realfullscreen)&&!vimeo_player.isBackground)&&buttonBar.append(fullscreen),vimeo_player.controlBar.append(buttonBar).append(progressBar),vimeo_player.isBackground?jQuery("body").after(vimeo_player.controlBar):vimeo_player.wrapper.before(vimeo_player.controlBar),volumeBar.simpleSlider({initialval:vimeo_player.opt.vol,scale:100,orientation:"h",callback:function(a){0==a.value?jQuery(vimeo_player).v_mute():jQuery(vimeo_player).v_unmute(),vimeo_player.player.setVolume(a.value/100),vimeo_player.isMute||(vimeo_player.opt.vol=a.value)}})}},optimizeVimeoDisplay:function(align){var vimeo_player=this.get(0),vid={};vimeo_player.opt.align=align||vimeo_player.opt.align,vimeo_player.opt.align="undefined "!=typeof vimeo_player.opt.align?vimeo_player.opt.align:"center,center";var YTPAlign=vimeo_player.opt.align.split(",");if(vimeo_player.opt.optimizeDisplay){var abundance=vimeo_player.isPlayer?0:80,win={},el=vimeo_player.wrapper;win.width=el.outerWidth(),win.height=el.outerHeight()+abundance,vid.width=win.width,vimeo_player.opt.ratio=eval(vimeo_player.opt.ratio),vid.height=Math.ceil(vid.width/vimeo_player.opt.ratio),vid.marginTop=-((vid.height-win.height)/2),vid.marginLeft=0;var lowest=vid.heightwin.width&&(vid.marginLeft=-((vid.width-win.width)/2))}}}else vid.width="100%",vid.height="100%",vid.marginTop=0,vid.marginLeft=0;vimeo_player.playerBox.css({width:vid.width,height:vid.height,marginTop:vid.marginTop,marginLeft:vid.marginLeft,maxWidth:"initial"})},setAlign:function(a){var b=this;b.v_optimize_display(a)},getAlign:function(){var a=this.get(0);return a.opt.align},fullscreen:function(real){function hideMouse(){vimeo_player.overlay.css({cursor:"none"})}function RunPrefixMethod(a,b){for(var c,d,e=["webkit","moz","ms","o",""],f=0;fnavigator.appVersion.indexOf("Mobile")&&(a.name="Mac"),-1!=navigator.appVersion.indexOf("Linux")&&(a.name="Linux"),/Mac OS X/.test(nAgt)&&!/Mobile/.test(nAgt)&&(a.version=/Mac OS X (10[\.\_\d]+)/.exec(nAgt)[1],a.version=a.version.replace(/_/g,".").substring(0,5)),/Windows/.test(nAgt)&&(a.version="Unknown.Unknown"),/Windows NT 5.1/.test(nAgt)&&(a.version="5.1"),/Windows NT 6.0/.test(nAgt)&&(a.version="6.0"),/Windows NT 6.1/.test(nAgt)&&(a.version="6.1"),/Windows NT 6.2/.test(nAgt)&&(a.version="6.2"),/Windows NT 10.0/.test(nAgt)&&(a.version="10.0"),/Linux/.test(nAgt)&&/Linux/.test(nAgt)&&(a.version="Unknown.Unknown"),a.name=a.name.toLowerCase(),a.major_version="Unknown",a.minor_version="Unknown","Unknown.Unknown"!=a.version&&(a.major_version=parseFloat(a.version.split(".")[0]),a.minor_version=parseFloat(a.version.split(".")[1])),a};jQuery.browser.os=getOS(),jQuery.browser.hasTouch=isTouchSupported(),jQuery.browser.name=navigator.appName,jQuery.browser.fullVersion=""+parseFloat(navigator.appVersion),jQuery.browser.majorVersion=parseInt(navigator.appVersion,10);var nameOffset,verOffset,ix;if(-1!=(verOffset=nAgt.indexOf("Opera")))jQuery.browser.opera=!0,jQuery.browser.name="Opera",jQuery.browser.fullVersion=nAgt.substring(verOffset+6),-1!=(verOffset=nAgt.indexOf("Version"))&&(jQuery.browser.fullVersion=nAgt.substring(verOffset+8));else if(-1!=(verOffset=nAgt.indexOf("OPR")))jQuery.browser.opera=!0,jQuery.browser.name="Opera",jQuery.browser.fullVersion=nAgt.substring(verOffset+4);else if(-1!=(verOffset=nAgt.indexOf("MSIE")))jQuery.browser.msie=!0,jQuery.browser.name="Microsoft Internet Explorer",jQuery.browser.fullVersion=nAgt.substring(verOffset+5);else if(-1!=nAgt.indexOf("Trident")){jQuery.browser.msie=!0,jQuery.browser.name="Microsoft Internet Explorer";var start=nAgt.indexOf("rv:")+3,end=start+4;jQuery.browser.fullVersion=nAgt.substring(start,end)}else-1!=(verOffset=nAgt.indexOf("Edge"))?(jQuery.browser.edge=!0,jQuery.browser.name="Microsoft Edge",jQuery.browser.fullVersion=nAgt.substring(verOffset+5)):-1!=(verOffset=nAgt.indexOf("Chrome"))?(jQuery.browser.webkit=!0,jQuery.browser.chrome=!0,jQuery.browser.name="Chrome",jQuery.browser.fullVersion=nAgt.substring(verOffset+7)):-1parseInt(d[e]))return 1;if(d[e]&&!c[e]&&0").addClass("level").addClass(e);d.prepend(e),c.level=e,d.css({cursor:"default"}),"auto"==c.opt.scale&&(c.opt.scale=a(c).outerWidth()),d.updateSliderVal(),c.opt.readonly||(d.on(a.simpleSlider.events.start,function(b){a.browser.mobile&&(b=b.changedTouches[0]),c.canSlide=!0,d.updateSliderVal(b),"h"==c.opt.orientation?d.css({cursor:"col-resize"}):d.css({cursor:"row-resize"}),b.preventDefault(),b.stopPropagation()}),a(document).on(a.simpleSlider.events.move,function(b){a.browser.mobile&&(b=b.changedTouches[0]),c.canSlide&&(a(document).css({cursor:"default"}),d.updateSliderVal(b),b.preventDefault(),b.stopPropagation())}).on(a.simpleSlider.events.end,function(){a(document).css({cursor:"auto"}),c.canSlide=!1,d.css({cursor:"auto"})}))})},updateSliderVal:function(b){var c=this.get(0);if(c.opt){c.opt.initialval="number"==typeof c.opt.initialval?c.opt.initialval:c.opt.initialval(c);var d=a(c).outerWidth(),e=a(c).outerHeight();c.x="object"==typeof b?b.clientX+document.body.scrollLeft-this.offset().left:"number"==typeof b?b*d/c.opt.scale:c.opt.initialval*d/c.opt.scale,c.y="object"==typeof b?b.clientY+document.body.scrollTop-this.offset().top:"number"==typeof b?(c.opt.scale-c.opt.initialval-b)*e/c.opt.scale:c.opt.initialval*e/c.opt.scale,c.y=this.outerHeight()-c.y,c.scaleX=c.x*c.opt.scale/d,c.scaleY=c.y*c.opt.scale/e,c.outOfRangeX=c.scaleX>c.opt.scale?c.scaleX-c.opt.scale:0>c.scaleX?c.scaleX:0,c.outOfRangeY=c.scaleY>c.opt.scale?c.scaleY-c.opt.scale:0>c.scaleY?c.scaleY:0,c.outOfRange="h"==c.opt.orientation?c.outOfRangeX:c.outOfRangeY,c.value="undefined"!=typeof b?"h"==c.opt.orientation?c.x>=this.outerWidth()?c.opt.scale:0>=c.x?0:c.scaleX:c.y>=this.outerHeight()?c.opt.scale:0>=c.y?0:c.scaleY:"h"==c.opt.orientation?c.scaleX:c.scaleY,"h"==c.opt.orientation?c.level.width(Math.floor(100*c.x/d)+"%"):c.level.height(Math.floor(100*c.y/e)),"function"==typeof c.opt.callback&&c.opt.callback(c)}}},a.fn.simpleSlider=a.simpleSlider.init,a.fn.updateSliderVal=a.simpleSlider.updateSliderVal}(jQuery);