var conf_reflection_p=1.2;var conf_focus=3;var conf_images_cursor="pointer";var conf_slider_cursor="default";var conf_imageflow="imageflow";var conf_loading="loading";var conf_images="images";var caption_id=0;var new_caption_id=0;var current=0;var target=0;var mem_target=0;var timer=0;var array_images=new Array();var posx=0;var new_posx=0;var fps=50;var angle_bas=0.6;var image_y_delta=0;var image_depart_num=1;var imageflow_height=250;var xstep=80;var landscape_format=100;var imgWidthOrigine=146;var imgHeightOrigine=220;function step(){switch(target<current-1||target>current+1){case true:moveTo(current+(target-current)/3);window.setTimeout(step,fps);timer=1;break;default:timer=0;break}}function glideTo(x,new_caption_id){target=x;mem_target=x;if(timer==0){window.setTimeout(step,50);timer=1}caption_id=new_caption_id}function moveTo(x){current=x;var zIndex=max;for(var index=0;index<max;index++){var image=img_div.childNodes.item(array_images[index]);var current_image=index*-xstep;if((current_image+max_conf_focus)<mem_target||(current_image-max_conf_focus)>mem_target){image.style.visibility="hidden";image.style.display="none"}else{var z=Math.sqrt(10000+x*x)+100;var xs=x/z*size+size;image.style.display="block";var new_img_h=(image.height/image.width*image.pc)/z*size;if(new_img_h>max_height){new_img_h=max_height}new_img_w=new_img_h*(imgWidthOrigine/imgHeightOrigine);var new_img_top=(images_width*0.34-new_img_h)+((new_img_h/(conf_reflection_p+angle_bas))*conf_reflection_p)+images_top+image_y_delta;image.style.left=xs-(image.pc/2)/z*size+images_left+"px";if(new_img_w&&new_img_h){image.style.height=new_img_h+"px";image.style.width=new_img_w+"px";image.style.top=new_img_top+"px"}image.style.visibility="visible";switch(x<0){case true:zIndex++;break;default:zIndex=zIndex-1;break}switch(image.i==caption_id){case false:try{if(typeof(image.onclick)!="object"){image.removeEvents("click")}}catch(e){}image.onclick=function(){glideTo(this.x_pos,this.i)};break;default:zIndex=zIndex+1;var source=new String(image.src);var reg=new RegExp("(.png)","g");var imageURL=source.replace(reg,".jpg");image.onclick=function(){showLightbox(imageURL,img_div.childNodes.item(array_images[caption_id]).getAttribute("longdesc"))};break}image.style.zIndex=zIndex}x+=xstep}}function refresh(onload){imageflow_div=document.getElementById(conf_imageflow);img_div=document.getElementById(conf_images);images_width=img_div.offsetWidth;images_top=imageflow_div.offsetTop;images_left=0;max_conf_focus=conf_focus*xstep;size=images_width*0.5;max_height=imageflow_height;imageflow_div.style.height=max_height+"px";img_div.style.height=images_width*0.338+"px";max=img_div.childNodes.length;var i=0;for(var index=0;index<max;index++){var image=img_div.childNodes.item(index);if(image.nodeType==1){array_images[i]=index;image.onclick=function(){glideTo(this.x_pos,this.i)};image.x_pos=(-i*xstep);image.i=i;if(onload==true){image.height=imgHeightOrigine;image.width=imgWidthOrigine}switch((image.width+1)>(image.height/(conf_reflection_p+1))){case true:image.pc=landscape_format;break;default:image.pc=100;break}image.style.cursor=conf_images_cursor;i++}}max=array_images.length;if(onload==true){image_depart_num=array_images.length;target=-(image_depart_num-1)*xstep;caption_id=image_depart_num-1}moveTo(target);glideTo(target,caption_id)}function show(id){var element=document.getElementById(id);element.style.visibility="visible"}function hide(id){var element=document.getElementById(id);element.style.visibility="hidden";element.style.display="none"}window.addEvent("domready",function(){if(document.getElementById(conf_imageflow)){$("contenu").style.overflow="visible";hide(conf_loading);refresh(true);initMouseWheel();show(conf_images);newNum=Math.round(array_images.length/2);glideTo(-(newNum-1)*xstep,newNum-1)}});window.onresize=function(){if(document.getElementById(conf_imageflow)){refresh()}};window.onunload=function(){document=null};function handle(delta){var change=false;switch(delta>0){case true:if(caption_id>=1){target=target+xstep;new_caption_id=caption_id-1;change=true}break;default:if(caption_id<(max-1)){target=target-xstep;new_caption_id=caption_id+1;change=true}break}if(change==true){glideTo(target,new_caption_id)}}function wheel(event){var delta=0;if(!event){event=window.event}if(event.wheelDelta){delta=event.wheelDelta/120}else{if(event.detail){delta=-event.detail/3}}if(delta){handle(delta)}if(event.preventDefault){event.preventDefault()}event.returnValue=false}function initMouseWheel(){if(window.addEventListener){imageflow_div.addEventListener("DOMMouseScroll",wheel,false)}imageflow_div.onmousewheel=wheel}function getKeyCode(event){event=event||window.event;return event.keyCode}document.onkeydown=function(event){var charCode=getKeyCode(event);switch(charCode){case 39:handle(-1);break;case 37:handle(1);break}};
