//---------------------------------------------------
//All for the image slideshow
//---------------------------------------------------
	
	var nPlus = 5;  //the % of fading for each step, default 5
    var speed = 100; //the speed in ms default 100
    var pause = 10000; //how long should the current image stay without fading, default 5000
	var nOpac = 0; //start opacity and the last opacity
	var opacity = 0; // value for the opacity from 0 - 100
	
	var direction = -1; // -1 is fade out 1 = fade in
	
	var currentTimeout = 0; //the current timeout...
	
	var imgtop;

	function startShow(){
		//test for new browsers
		if (document.getElementById){
			initShow();	
			imgtop = document.getElementById("imgtop");
			timePause();
		}
	}

    //Set the opacity to 100
    function initShow(){
		nOpac = 100;
		opacity = nOpac;
    }
    	
       	
    function fadeImg()
	{
	var stopped = 0
		//If reached opacity 0
    	if (opacity <= 0)
		{
			if (direction == -1) 
			{
				direction = 1; //Reverse direction
				timePause();
				stopped = 1;
			}
		}
	
		
		//If reached opacity 0
    	if (opacity >= 100)
		{
			if (direction == 1) 
			{
				direction = -1; //Reverse direction
				timePause();
				stopped = 1;
			}
 	    }
 	    	
 	    if (stopped == 0){
 	    	//Set the opacity of the image	
			setOpacity (imgtop);
			setTimeout('fadeImg()', speed);
 	    }

 	    
	}
		
	
	//Set the time to pause the fade
	function timePause()
	{
		setTimeout('fadeImg()', pause);
	}
	       

    function setOpacity (obj){
		opacity = nOpac + (nPlus * direction);
        nOpac = opacity;
        obj.style.opacity = opacity / 100;
        obj.style.MozOpacity = opacity / 100;
        obj.style.filter = "alpha(opacity=" + opacity + ")"; 
    }
    
		
