$(function(){$('.button-arrow-left').click(function(){if(allowClick)newsboxPrevious()});$('.button-arrow-right').click(function(){if(allowClick)newsboxNext()});domLoaded=true;allowClick=true;startAt=0;currentArticle=3;previousArticle=0;newsImagesCount=3;imageWrapper=$('.news-image');textWrapper=$('#news-story');containerHeight=imageWrapper.css('height');speed=600;changeInterval=18;timetoInterval=0;newsChange();function newsChange(){if(timetoInterval<=0){newsboxNext()}else timetoInterval--}function newsboxPrevious(){timetoInterval=changeInterval;previousArticle=currentArticle;if(currentArticle<=startAt)currentArticle=newsImagesCount;else currentArticle--;showArticle(currentArticle)}function showArticle(imageNum,down){allowClick=false;var currImg=$('img:eq('+currentArticle+')',imageWrapper);var prevImg=$('img:eq('+previousArticle+')',imageWrapper);var currTxt=$('div.news-article:eq('+currentArticle+')',textWrapper);var prevTxt=$('div.news-article:eq('+previousArticle+')',textWrapper);if(!$.browser.msie){var h1=$('h1',currTxt);var h2=$('h2',currTxt);var p=$('p',currTxt);var but=$('.button-more',currTxt)}else{var h1=$('');var h2=$('');var p=$('');var but=$('')}contHeight=264;contWidth=500;coef=1;if(down){contHeight=contHeight*-1;contWidth=contWidth*-1}currImg.css('top',contHeight+'px');currImg.css('display','block');prevImg.animate({top:-1*contHeight},speed,null,function(){prevImg.hide();allowClick=true});h1.css('marginLeft',contWidth);h1.animate({marginLeft:0},speed);h2.css('marginLeft',contWidth);h2.animate({marginLeft:0},speed*1.6);p.css('marginLeft',contWidth);p.animate({marginLeft:0},speed*2);but.css('marginRight',contWidth*-1);but.animate({marginRight:0},speed*2.2);currImg.animate({top:0},speed);currTxt.css('display','block');currTxt.css('left',contWidth);currTxt.css('top','0');prevTxt.animate({left:-1*contWidth,opacity:0},speed);currTxt.animate({left:0,opacity:1},speed)}function newsboxNext(){timetoInterval=changeInterval;previousArticle=currentArticle;if(currentArticle>=newsImagesCount)currentArticle=startAt;else currentArticle++;showArticle(currentArticle,true)}$('body').everyTime(1000,function(i){newsChange()})});
