
function getUrlVars(){var vars=[],hash;var hashes=window.location.href.slice(window.location.href.indexOf('?')+1).split('&');for(var i=0;i<hashes.length;i++){hash=hashes[i].split('=');vars.push(hash[0]);vars[hash[0]]=hash[1];}
return vars;}
var loopInterval;function playerReady(playerObj){player=window.document[playerObj.id];player.addViewListener('play','playerPlay');}
function playerPlay(obj){state=obj.state;if(state){clearInterval(loopInterval);}}
$(function(){$('.video-player').each(function(i,item){var spotlightId=parseInt($(item).findParent('li').stripId())-1;if(DataBridge.spotlights[spotlightId]){$(item).player({file:DataBridge.spotlights[spotlightId].clip.video.path,image:DataBridge.spotlights[spotlightId].clip.picture.bigThumb,width:618,height:346});}});setTimeout(function(){jq_VideoObjects=$('video.video-player');jq_VideoObjects.each(function(){var This=$(this);This.bind('play',function(ev){clearInterval(loopInterval);});});},500);var currentBanner=1;var defBanner=$('#banners-container li.banner-content:first');var countBanners=$('#banners-container li.banner-content').length;var bannerWidth=parseInt(defBanner.width())
+parseInt(defBanner.css('padding-left'))+parseInt(defBanner.css('padding-right'))
+parseInt(defBanner.css('margin-left'))+parseInt(defBanner.css('margin-right'));$('#banners-container ul').css('width',bannerWidth*countBanners);function loadBanner(item){currentBanner=item;thisBanner=$('#banner-'+currentBanner);$('#banner-select li').removeClass('active');$('#banner-select #slide-'+currentBanner).addClass('active');var newLeft=-1*$('.banner-content').index(thisBanner)*bannerWidth;$('#banners-container ul').animate({left:+newLeft+'px'},2000);}
function startInterval(){return setInterval(function(){currentBanner=(currentBanner==countBanners)?1:currentBanner+1;loadBanner(currentBanner);},25000);}
if(countBanners>1){loopInterval=startInterval();}
$('#banner-select li').click(function(ev){ev.preventDefault();ev.target.blur();var item=parseInt($(this).stripId());loadBanner(item);clearInterval(loopInterval);loopInterval=startInterval();});$('#js-newsletter-form').submit(function(ev){ev.preventDefault();Evisua.makeRequest({url:'/ajax/newsletter/',form:'js-newsletter-form',handler:function(success,data){if(success){$('#js-newsletter-click').click();}else{$('#js-newsletter-error-click').click();}}});return false;});var msg=getUrlVars()['msg'];if(msg!=undefined&&msg!=''){$('#js-newsletter-'+msg+'').click();}});
