
$.document=$(document);$(function(){$.document.find('.tile:last').addClass('last').end().find('.tease').bind('click',function(e){var $this=$(this),$tile=$this.next(),index=$.document.find('.tease').index(this),padded=[];if($this.hasClass('active')){return;}
$.document.find('#homepage').stop(true).end().find('.tease').each(function(){var pad=parseInt(this.style.paddingTop||this.style.paddingBottom);if(!isNaN(pad)&&pad!=0){padded.push(this);}}).removeClass('active').eq(index).addClass('active').end().end().find('.tile').removeClass('active').eq(index).addClass('active').end().end().find('#homepage-slide > div').removeClass('active').eq(index).addClass('active').animate({'left':0},300,function(){$.document.find('#homepage-slide > div:not(.active)').css({'left':670});});function step(now,fx){if(now&&fx){var t=179-now;for(var i=0;i<padded.length;i++){var order=$.document.find('.tease').index(padded[i]),padding=['paddingTop','paddingBottom'];if(index<order){padding.reverse();}
padded[i].style[padding[0]]='0px';padded[i].style[padding[1]]=(t/padded.length)+'px';}}
$tile.css({'top':$this.position().top+($this.hasClass('first')?0:1),'height':$this.outerHeight()});}
$this.animate({'padding-top':179},{'duration':300,'easing':'linear','step':step,'complete':step});if(e.originalEvent||$.document.find('.tease:last').hasClass('auto')){if(e.originalEvent){if(typeof($.autoplay)=="number"){cmCreatePageElementTag('Story '+(index+1),'HP Auto Rotation End');}
cmCreatePageElementTag('Story '+(index+1),'HP Manual Navigation');}else{cmCreatePageElementTag('Story 5','HP Auto Rotation End');}
clearTimeout($.autoplay);$.autoplay=false;}else{cmCreatePageElementTag('Story '+(index+1),'HP Auto Rotation');$this.addClass('auto');$.autoplay=setTimeout(function(){var $next=$.document.find('.tease.active').next().next();$next=$next.length?$next:$.document.find('.tease:first');$next.click();},6300);}}).eq(0).addClass('first').click();});
