var temps=0;
var timerID = null;
var timerRunning = 2;
var delay = 4000;
var idx=0;

function StopTheTimer()
{
    if(timerRunning== 1)
        clearTimeout(timerID)
    if(timerRunning== 2)
        clearTimeout(timerID)    
    timerRunning = 0;
}

function StartTheTimer()
{
	ChangeContent();
	delay = 5500;
   timerRunning = 1;        
   timerID = self.setTimeout("StartTheTimer()", delay);
}

function ChangeContent()
{
   $("#myphoto").fadeOut("slow",function(){
	  $('img#myphoto').attr({ src: "./img/diaporama1/"+tabid[idx]});
   });
   idx=idx+1;
      if(tabid[idx]=='dontshowme'){
		 idx=1;
	   }
	var img=new Image;
	img.src="/img/diaporama1/"+tabid[idx+1];
   $("#myphoto").fadeIn("slow");
}

function switchdiapo(){
	if (timerRunning==2)
		{
		    StopTheTimer();
    	    StartTheTimer();
 		}
	else if(timerRunning==0)
		{
			StartTheTimer();
 		}
	else
		{
			StopTheTimer();
 		}
}
