/* SETUP */
	
			/* basic */
			var durationTime = 7000; // 	Duration per slide									[duration per slide in miliseconds: 1000 = 1 second]
			var fadingTime = 1000 // "slow"; Time of the fading, this can crossover as well		[duration in miliseconds: 1000 = 1 second, "slow" for slow, "fast" for fast]
			var fadingOverlay	= 0; 		// percentage of overflow in the fading				[ 100 = no overlay. 0 is maximum overlay]
			
			var startFrame = 0; //			Start Slideshow from frame X						[0 is begin]
			
			var loopSlideshow = "yes";//	Loop the slideshow? 								[To loop, fill in: "yes", otherwise "" ]
			var loopDelay	= 0;//	When the loop starts again
			
			
			/* Speeding up frames */
			var speedUpDuration = 500; // 	Duration per slide in speeded up version			[duration per slide in miliseconds: 1000 - 1 second]
			var speedUpFromSlide = 22; // 	Startframe of the speeded up version				[First frame is '0', second frame is '1', etc]
			var speedUpToSlide = 26; // 		Endframe of the speeded up version				[End frame is frame plus 1 ]
		

		
		/* Declarations*/
		var c=0;
		var t;
		var timer_is_on=0;
		

		// initiatlize current fade times: 
		var currFadeTime = 0;
		var fading =  (fadingTime*fadingOverlay)/100;

		// decide the times in advance
		var timerArray = new Array();
		var timerDurationArray = new Array();	
	
		
		function slideShow()
		{

			var duration =1;
			// the slideshow isetlf
			for (var i = 1; i < $("#imageHolder ul").children('li').length+1; i++) 
			{
				
				if(i != duration)
				{
					$("#imageHolder ul").children('li:nth-child('+ i +')').delay(timerArray[i]-timerArray[1]).fadeTo(fadingTime,  1.00);
				}
				else
				{
					$("#imageHolder ul").children('li:nth-child(1)').fadeTo(fadingTime,  1.00);
				}
				
				
				// if there is one smaller then slide:zero; make it fadeout,...and if there is only one picture, make it never fadeout
				if(i > 0 && $("#imageHolder ul").children('li').length > 1)
				{
					
					if(i!=$("#imageHolder ul").children('li').length)
					{
						$("#imageHolder ul").children('li:nth-child('+ i +')').delay(timerDurationArray[i+1]-fading).fadeTo(fadingTime,  0.00);
					}
					else
					{						
						$("#imageHolder ul").children('li:nth-child('+ i +')').delay(timerDurationArray[i]-fading).fadeTo(fadingTime,  0.00);
					}
					
				}
				
				
			}

				
		}
		
		function clearSlideShow()
		{
			// check if there is more then just one image
			if($("#imageHolder ul").children('li').length > 1)
			{
				for (var j = 0; j < ($("#imageHolder ul").children('li').length+1); j++) 
				{
						$("#imageHolder ul").children('li:nth-child('+ j +')').fadeTo(0,  0.00);	
				}
			}
		}


		function timedCount()
		{
			clearSlideShow();		
			// start slideshow
			slideShow();
			

			
			// restart slideshow
			if(loopSlideshow == "yes")
			{
				t=setTimeout("timedCount()",( timerArray[timerArray.length-1]+loopDelay ));
			}
		}


	function correctPNG()
			  {
				 
			  	for(var i=0; i<document.images.length; i++)
				 {
					 var img = document.images[i]
					 var imgName = img.src.toUpperCase()					 
					 if (imgName.indexOf('ANIMATION') != -1)
					{
						var imgID = (img.id) ? "id='" + img.id + "' " : ""
						var imgClass = (img.className) ? "class='" + img.className + "' " : ""
						var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
						var imgStyle = "display:inline-block;" + img.style.cssText
							if (img.align == "left") imgStyle = "float:left;" + imgStyle
							if (img.align == "right") imgStyle = "float:right;" + imgStyle
							if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
						var strNewHTML = "<span " + imgID + imgClass + imgTitle
						+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
							+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
						+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
						img.outerHTML = strNewHTML
						i = i-1
					}
				 }
			  }

		
		// Start the Slideshow
		$(document).ready(function() 
		{
			// check if there is a slideshow available
			if($("#imageHolder") != undefined)
			{
				// initialize the timing
				
			
				for (var x = 0; x < $("#imageHolder ul").children('li').length+1; x++)
				{
						if ((x > speedUpFromSlide) && (x < speedUpToSlide))
						{
							currFadeTime =  currFadeTime + speedUpDuration;
							timerArray[x] = currFadeTime;
							timerDurationArray[x] = speedUpDuration;
							
							
						}
						else
						{
							currFadeTime  =  currFadeTime + durationTime ;
							timerArray[x] = currFadeTime;
							timerDurationArray[x] = durationTime;
						}				
				}		
		
				
				// start the slideshow
				if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) 
				{
					correctPNG();
				}
				timedCount();
			}
		});
		
		
		/* ********* Correct PNG in Internet Explorer AFTER opacitating ***********/
		
		
