//test
var banner;bannersScrollImage=function(n,p1,p2,p3,p4,p5){var infosElement=document.getElementById('infos');this.test=n;var container;var bannersContainer;var contentScrollIndicator;var scrollIndicator;var banners=[];var constants=[];var properties=[];var mouse=[];var diff=[];var move=0;var currentImage=0;var cptDisplay=0;var scrollItem;constants['IE']=(navigator.appVersion.indexOf('MSIE')==-1)?false:true;constants['IE6']=(navigator.appVersion.indexOf('MSIE 6')==-1)?false:true;constants['safari']=(navigator.appVersion.indexOf('Safari')==-1)?false:true;constants['FF']=(navigator.appName=='Netscape')?false:true;properties['bannerWidth']='auto';properties['bannerHeight']='auto';properties['delay']=(p1)?p1:0;properties['maxSpeed']=40;properties['acceleration']=2;properties['marginImages']=2;properties['delayimageMovement']=25;properties['imagesDisplay']=(p2&&p2>0)?p2:3;properties['imagesMove']=(p3&&p3>0)?p3:properties['imagesDisplay'];properties['buttonsWidth']=(p4&&p4>0)?p4:32;properties['buttonsColor']=(p5)?p5:'white';if(properties['buttonsColor']=='blanc')properties['buttonsColor']='white';if(properties['buttonsColor']=='noir')properties['buttonsColor']='black';if(properties['buttonsColor']!='white'&&properties['buttonsColor']!='black')properties['buttonsColor']='white';this.imageConstruct=function(n){if(!n)scrollItem='';else scrollItem=n;if(!document.getElementById('tsrBannersScroll'+scrollItem))return false;container=document.getElementById('tsrBannersScroll'+scrollItem);if(properties['bannerWidth']=='auto')properties['bannerWidth']=parseInt(container.parentNode.offsetWidth);container.style.width=properties['bannerWidth']+'px';if(properties['bannerHeight']=='auto')container.style.height='0px';else container.style.height=properties['bannerHeight']+'px';setTimeout('imageInsertElements()',5);};imageInsertElements=function(){var posArrowLeft=properties['buttonsWidth']/2-8;var posArrowRight=properties['buttonsWidth']/2-7;var newItem=document.createElement('link');newItem.setAttribute('rel','stylesheet');newItem.setAttribute('type','text/css');newItem.setAttribute('href','/css/lightbox.css');document.getElementsByTagName('head')[0].appendChild(newItem);newItem=document.getElementById('tsrScrollLeftButton'+scrollItem);newItem.style.styleFloat='left';newItem.setAttribute('style','float:left;');newItem.style.width=properties['buttonsWidth']+'px';newItem.style.height='57px';newItem.style.cursor='pointer';if(constants['IE6']){newItem.style.backgroundImage='url(/images/icons/galleries/arrow-left-'+properties['buttonsColor']+'-normal.gif)';}else newItem.style.backgroundImage='url(/images/icons/galleries/arrow-left-'+properties['buttonsColor']+'-normal.png)';newItem.style.backgroundPosition=posArrowLeft+'px 50%';newItem.style.backgroundRepeat='no-repeat';newItem.onmouseover=imageMouseOverButton;newItem.onmouseout=imageMouseOutButton;newItem.onclick=imageClickLeft;newItem=document.getElementById('tsrContainerBannerOverflow'+scrollItem);newItem.style.styleFloat='left';newItem.setAttribute('style','float:left;');newItem.style.width='802px';newItem.style.overflow='hidden';newItem.style.marginLeft='0px';newItem.id='tsrContainerBannerOverflow'+scrollItem;newItem=document.getElementById('tsrBannerOverflow'+scrollItem);bannersContainer=document.getElementById('tsrBannerOverflow'+scrollItem);newItem=document.getElementById('tsrScrollRightButton'+scrollItem);newItem.style.styleFloat='left';newItem.setAttribute('style','float:left;');newItem.style.width=properties['buttonsWidth']+'px';newItem.style.height='1px';newItem.style.cursor='pointer';if(constants['IE6'])newItem.style.backgroundImage='url(/images/icons/galleries/arrow-right-'+properties['buttonsColor']+'-normal.gif)';else newItem.style.backgroundImage='url(/images/icons/galleries/arrow-right-'+properties['buttonsColor']+'-normal.png)';newItem.style.backgroundPosition=posArrowRight+'px 50%';newItem.style.backgroundRepeat='no-repeat';newItem.setAttribute('style','width:'+properties['buttonsWidth']+'px; height:57px; float:left; cursor:pointer; background-image:url(/images/icons/galleries/arrow-right-'+properties['buttonsColor']+'-normal.png); background-position:'+posArrowRight+'px 50%; background-repeat:no-repeat;');newItem.onmouseover=imageMouseOverButton;newItem.onmouseout=imageMouseOutButton;newItem.onclick=imageClickRight;imageSetProperties();};imageSetProperties=function(){if(parseInt(bannersContainer.childNodes[0].childNodes[0].width)==0){setTimeout('imageSetProperties()',10);return;}constants['imagesWidth']=parseInt(bannersContainer.childNodes[0].childNodes[0].width);constants['imagesHeight']=parseInt(bannersContainer.childNodes[0].childNodes[0].height);constants['imagesWidth']=120;if(properties['bannerHeight']=='auto')properties['bannerHeight']=constants['imagesHeight'];constants['imagesWithMargin']=(parseInt(constants['imagesWidth'])+properties['marginImages']);constants['nbImages']=bannersContainer.getElementsByTagName('img').length;constants['bannersContainerWidth']=constants['imagesWithMargin']*constants['nbImages'];constants['maxMarginLeft']=constants['bannersContainerWidth']-(constants['imagesWithMargin']*properties['imagesDisplay']);container.style.width=properties['bannerWidth']+'px';container.style.height=(properties['bannerHeight'])+'px';container.style.overflow='hidden';container.onmouseover=imageStopMove;container.onmouseout=imageStartMove;container.style.display='block';bannersContainer.style.width=(constants['bannersContainerWidth']-properties['marginImages'])+'px';bannersContainer.style.height=properties['bannerHeight']+'px';bannersContainer.style.marginLeft='0px';container.style.width=(constants['imagesWithMargin']*properties['imagesDisplay'])+(properties['buttonsWidth']*2)-properties['marginImages']+"px";document.getElementById('tsrContainerBannerOverflow'+scrollItem).style.width=(constants['imagesWithMargin']*properties['imagesDisplay'])-properties['marginImages']+"px";document.getElementById('tsrScrollLeftButton'+scrollItem).style.height=properties['bannerHeight']+'px';document.getElementById('tsrScrollRightButton'+scrollItem).style.height=properties['bannerHeight']+'px';imageStartMove();};preInitLightbox=function(){var imgs=bannersContainer.getElementsByTagName('img');if(imgs.length>0){initLightbox();}else setTimeout('preInitLightbox()',100);};imageMovement=function(cpt){if(move==0)return;if(cptDisplay!=cpt)return;if(document.getElementById('lightbox')&&document.getElementById('lightbox').style.display!='none'){setTimeout('imageMovement('+cptDisplay+')',properties['delay']);return;}if(currentImage>=constants['nbImages']-(properties['imagesDisplay'])){currentImage+=1000;}else{currentImage+=properties['imagesMove'];if(currentImage>constants['nbImages']-(properties['imagesDisplay']-1))currentImage=constants['nbImages']-(properties['imagesDisplay']);};cptDisplay++;if(currentImage<=constants['nbImages']-(properties['imagesDisplay']-1)){var temp=(constants['imagesWithMargin']*currentImage)*-1;if((temp*-1)>constants['maxMarginLeft'])temp=constants['maxMarginLeft']*-1;imageMoveRight(parseInt(bannersContainer.style.marginLeft),temp,1);}else{currentImage=0;imageMoveLeft(parseInt(bannersContainer.style.marginLeft),0,1);}};imageMoveRight=function(px,maxPx,speed){if((maxPx*-1)>constants['maxMarginLeft'])maxPx=constants['maxMarginLeft'];speed=imageDefineSpeed(speed);px=px-speed;if(px<maxPx)px=maxPx;bannersContainer.style.marginLeft=px+'px';if(px>maxPx)setTimeout('imageMoveRight('+px+','+maxPx+','+speed+')',properties['delayimageMovement']);else setTimeout('imageMovement('+cptDisplay+')',properties['delay']);};imageMoveLeft=function(px,maxPx,speed){speed=imageDefineSpeed(speed);px=px+speed;if(px>maxPx)px=maxPx;bannersContainer.style.marginLeft=px+'px';if(px<maxPx)setTimeout('imageMoveLeft('+px+','+maxPx+','+speed+')',properties['delayimageMovement']);else setTimeout('imageMovement('+cptDisplay+')',properties['delay']);};imageDefineSpeed=function(speed){if(speed<properties['maxSpeed']){if(properties['acceleration']=='^')if(speed==1)speed++;else speed=speed*speed;else speed=speed+properties['acceleration'];if(speed>properties['maxSpeed'])speed=properties['maxSpeed'];}return speed;};imageStartMove=function(){if(properties['delay']==0)return;move=1;cptDisplay++;setTimeout('imageMovement('+cptDisplay+')',properties['delay']);};imageStopMove=function(){move=0;};imageClickLeft=function(){if(currentImage>0){currentImage-=properties['imagesMove'];if(currentImage<0)currentImage=0;}else currentImage-=1000;cptDisplay++;if(currentImage>=0){imageMoveLeft(parseInt(bannersContainer.style.marginLeft),(constants['imagesWithMargin']*currentImage)*-1,1);}else{currentImage=constants['nbImages']-(properties['imagesDisplay']);var temp=(constants['imagesWithMargin']*currentImage)*-1;if((temp*-1)>constants['maxMarginLeft'])temp=constants['maxMarginLeft']*-1;imageMoveRight(parseInt(bannersContainer.style.marginLeft),(constants['imagesWithMargin']*currentImage)*-1,1);}};imageClickRight=function(){if(currentImage>=constants['nbImages']-(properties['imagesDisplay'])){currentImage+=1000;}else{currentImage+=properties['imagesMove'];if(currentImage>constants['nbImages']-(properties['imagesDisplay']))currentImage=constants['nbImages']-(properties['imagesDisplay']);};cptDisplay++;if(currentImage<=constants['nbImages']-(properties['imagesDisplay']-1)){imageMoveRight(parseInt(bannersContainer.style.marginLeft),(constants['imagesWithMargin']*currentImage)*-1,1);}else{currentImage=0;imageMoveLeft(parseInt(bannersContainer.style.marginLeft),0,1);}};imageMouseOverButton=function(e){if(!e){e=window.event;var button=e.srcElement;}else var button=e.target;button.style.backgroundImage=button.style.backgroundImage.replace(/normal/,'over');};imageMouseOutButton=function(e){if(!e){e=window.event;var button=e.srcElement;}else var button=e.target;button.style.backgroundImage=button.style.backgroundImage.replace(/over/,'normal');};this.imageConstruct(n);};
