function noEffect(pOld,pNew){if(pOld){pOld.style.display='none';}
if(pNew){pNew.style.display='block';}}
function crossFade(pOld,pNew,pSpeed){if(pNew){new Effect.Appear(pNew.id,{duration:pSpeed});}
if(pOld){new Effect.Fade(pOld.id,{duration:pSpeed});}}
function blindDown(pOld,pNew,pSpeed){if(pNew){pNew.style.zIndex='2';}
if(pOld){pOld.style.zIndex='1';}
if(pNew){new Effect.BlindDown(pNew.id,{duration:pSpeed});}
if(pOld){new Effect.Fade(pOld.id,{duration:pSpeed});}}
function blindUp(pOld,pNew,pSpeed){if(pNew){pNew.style.zIndex='1';}
if(pOld){pOld.style.zIndex='2';}
if(pNew){new Effect.Appear(pNew.id,{duration:pSpeed});}
if(pOld){new Effect.BlindUp(pOld.id,{duration:pSpeed});}}
function InteraktingSlider(){this.slides=new Array();this.delay=5;this.chrono=0;this.currentSlide=0;this.previousSlide=null;this.mode='mixte';this.transition='none';this.speed=1;this.height=100;this.width=200;return this;}
InteraktingSlider.prototype.setDelay=function(pDelay){if(pDelay>0){this.delay=pDelay;}}
InteraktingSlider.prototype.setMode=function(ps_Mode){this.mode=ps_Mode;}
InteraktingSlider.prototype.isAutoMode=function(){if(this.mode!='manual'){return true;}
return false;}
InteraktingSlider.prototype.isManualMode=function(){if(this.countSlides()<1){return false;}
if(this.mode!='auto'){return true;}
return false;}
InteraktingSlider.prototype.setChrono=function(pSec){this.chrono=pSec;}
InteraktingSlider.prototype.setTransition=function(pTrans){this.transition=pTrans;}
InteraktingSlider.prototype.setSpeed=function(pSpeed){if(pSpeed>0){this.speed=pSpeed/1000;}}
InteraktingSlider.prototype.addSlide=function(pCms){var div=document.getElementById('slide-content');if(div){var i=this.countSlides();var content="<div id='slide-"+i+"' class='slide' style='display:none;position:absolute;'>"+pCms+"</div>";div.innerHTML+=content;}
this.slides.push(i);}
InteraktingSlider.prototype.countSlides=function(){return this.slides.length;}
InteraktingSlider.prototype.getCurrentSlide=function(){return this.slides[this.currentSlide];}
InteraktingSlider.prototype.setCurrentSlide=function(pId){this.previousSlide=this.currentSlide;this.currentSlide=pId;}
InteraktingSlider.prototype.isCurrentSlide=function(pId){return(this.currentSlide==pId);}
InteraktingSlider.prototype.setCurrentSlideUp=function(){this.previousSlide=this.currentSlide;this.currentSlide++;}
InteraktingSlider.prototype.setCurrentSlideDown=function(){this.previousSlide=this.currentSlide;this.currentSlide--;}
InteraktingSlider.prototype.turnLeft=function(){var nb=this.countSlides();if(this.currentSlide==0){this.goTo(nb-1);}
else{this.setCurrentSlideDown();}
this.refresh();}
InteraktingSlider.prototype.turnRight=function(){var nb=this.countSlides();if(this.currentSlide==(nb-1)){this.goTo(0);}
else{this.setCurrentSlideUp();}
this.refresh();}
InteraktingSlider.prototype.goTo=function(pId){if(pId!=this.currentSlide){this.setCurrentSlide(pId);this.refresh();}}
InteraktingSlider.prototype.getCommande=function(){var html='';html+="<a href='#' id='prev' class='normal' onclick='interaktingslider.turnLeft();return false;'><span>&lt;</span></a>";for(i=0;i<this.countSlides();i++){html+="<a href='#' id='button"+i+"' onclick='interaktingslider.goTo("+i+");return false;'><span>"+(i+1)+"</span></a>";}
html+="<a href='#' id='next' class='normal' onclick='interaktingslider.turnRight();return false;'><span>&gt;</span></a>";return html;}
InteraktingSlider.prototype.setCurrentButton=function(){for(i=0;i<this.countSlides();i++){var button=document.getElementById('button'+i);if(this.isCurrentSlide(i)){button.setAttribute("class","active");button.setAttribute("className","active");}
else{button.setAttribute("class","normal");button.setAttribute("className","normal");}}}
InteraktingSlider.prototype.show=function(){if(this.isManualMode()){div=document.getElementById('middle-center');if(div){div.innerHTML+='<div id="slide-commands">'+this.getCommande()+'</div>';}}
if(this.countSlides()>0){this.refresh();this.run();}}
InteraktingSlider.prototype.changeSlide=function(){if(this.isManualMode()){this.setCurrentButton();}
if(this.transition=='random'){this.makeTransition(this.getRandomTransition());}
else{this.makeTransition(this.transition);}}
InteraktingSlider.prototype.makeTransition=function(pTransition){var oldSlide=document.getElementById('slide-'+this.previousSlide);var newSlide=document.getElementById('slide-'+this.currentSlide);switch(pTransition)
{case's':blindUp(oldSlide,newSlide,this.speed);break;case'down':blindDown(oldSlide,newSlide,this.speed);break;case'fade':crossFade(oldSlide,newSlide,this.speed);break;case'none':default:noEffect(oldSlide,newSlide,this.speed);}}
InteraktingSlider.prototype.refresh=function(){this.changeSlide();this.setChrono(this.delay);}
InteraktingSlider.prototype.run=function(){if(this.chrono==0){this.turnRight();}
else{this.chrono--;}
if(this.isAutoMode()){setTimeout("interaktingslider.run()",1000);}}
