﻿
	
	
	var slideshow4_noFading = false;
	var slideshow4_timeBetweenSlides = 1500;	// Amount of time between each image(1000 = 1 second)
	var slideshow4_fadingSpeed = 10;	// Speed of fading	(Lower value = faster)
	
	var slideshow4_galleryContainer;	// Reference to the gallery div
	var slideshow4_galleryWidth;	// Width of gallery
	var slideshow4_galleryHeight;	// Height of galery
	var slideshow4_slideIndex = -1;	// Index of current image shown
	var slideshow4_slideIndexNext = false;	// Index of next image shown
	var slideshow4_imageDivs = new Array();	// Array of image divs(Created dynamically)
	var slideshow4_currentOpacity = 100;	// Initial opacity
	var slideshow4_imagesInGallery = false;	// Number of images in gallery
	var Opera = navigator.userAgent.indexOf('Opera')>=0?true:false;
	function createParentDivs4(imageIndex4)
	{
		if(imageIndex4==slideshow4_imagesInGallery){			
			showGallery4();
		}else{
			var imgObj4 = document.getElementById('galleryImage' + imageIndex4);	
			if(Opera)imgObj4.style.position = 'static';
			slideshow4_imageDivs[slideshow4_imageDivs.length] =  imgObj4;
			imgObj4.style.visibility = 'hidden';	
			imageIndex4++;
			createParentDivs4(imageIndex4);	
		}		
	}
	
	function showGallery4()
	{
		if(slideshow4_slideIndex==-1)slideshow4_slideIndex=0; else slideshow4_slideIndex++;	// Index of next image to show
		if(slideshow4_slideIndex==slideshow4_imageDivs.length)slideshow4_slideIndex=0;
		slideshow4_slideIndexNext = slideshow4_slideIndex+1;	// Index of the next next image
		if(slideshow4_slideIndexNext==slideshow4_imageDivs.length)slideshow4_slideIndexNext = 0;
		
		slideshow4_currentOpacity=100;	// Reset current opacity

		// Displaying image divs
		slideshow4_imageDivs[slideshow4_slideIndex].style.visibility = 'visible';
		if(Opera)slideshow4_imageDivs[slideshow4_slideIndex].style.display = 'inline';
		if(navigator.userAgent.indexOf('Opera')<0){
			slideshow4_imageDivs[slideshow4_slideIndexNext].style.visibility = 'visible';
		}
		
		if(document.all){	// IE rules
			slideshow4_imageDivs[slideshow4_slideIndex].style.filter = 'alpha(opacity=100)';
			slideshow4_imageDivs[slideshow4_slideIndexNext].style.filter = 'alpha(opacity=1)';
		}else{
			slideshow4_imageDivs[slideshow4_slideIndex].style.opacity = 0.99;	// Can't use 1 and 0 because of screen flickering in FF
			slideshow4_imageDivs[slideshow4_slideIndexNext].style.opacity = 0.01;
		}		
		

		setTimeout('revealImage4()',slideshow4_timeBetweenSlides);		
	}
	
	function revealImage4()
	{
		if(slideshow4_noFading){
			slideshow4_imageDivs[slideshow4_slideIndex].style.visibility = 'hidden';
			if(Opera)slideshow4_imageDivs[slideshow4_slideIndex].style.display = 'none';
			showGallery4();
			return;
		}
		slideshow4_currentOpacity--;
		if(document.all){
			slideshow4_imageDivs[slideshow4_slideIndex].style.filter = 'alpha(opacity='+slideshow4_currentOpacity+')';
			slideshow4_imageDivs[slideshow4_slideIndexNext].style.filter = 'alpha(opacity='+(100-slideshow4_currentOpacity)+')';
		}else{
			slideshow4_imageDivs[slideshow4_slideIndex].style.opacity = Math.max(0.01,slideshow4_currentOpacity/100);	// Can't use 1 and 0 because of screen flickering in FF
			slideshow4_imageDivs[slideshow4_slideIndexNext].style.opacity = Math.min(0.99,(1 - (slideshow4_currentOpacity/100)));
		}
		if(slideshow4_currentOpacity>0){
			setTimeout('revealImage4()',slideshow4_fadingSpeed);
		}else{
			slideshow4_imageDivs[slideshow4_slideIndex].style.visibility = 'hidden';	
			if(Opera)slideshow4_imageDivs[slideshow4_slideIndex].style.display = 'none';		
			showGallery4();
		}
	}
	
	function initImageGallery4()
	{
		slideshow4_galleryContainer = document.getElementById('imageSlideshowHolder4');
		slideshow4_galleryWidth = slideshow4_galleryContainer.clientWidth;
		slideshow4_galleryHeight = slideshow4_galleryContainer.clientHeight;
		galleryImgArray1 = slideshow4_galleryContainer.getElementsByTagName('IMG');
		for(var no=0;no<galleryImgArray1.length;no++){
			galleryImgArray1[no].id = 'galleryImage' + no;
		}
		slideshow4_imagesInGallery = galleryImgArray1.length;
		createParentDivs4(0);		
		
	}
	



