﻿
	
	
	var slideshow1_noFading = false;
	var slideshow1_timeBetweenSlides = 1500;	// Amount of time between each image(1000 = 1 second)
	var slideshow1_fadingSpeed = 10;	// Speed of fading	(Lower value = faster)
	
	var slideshow1_galleryContainer;	// Reference to the gallery div
	var slideshow1_galleryWidth;	// Width of gallery
	var slideshow1_galleryHeight;	// Height of galery
	var slideshow1_slideIndex = -1;	// Index of current image shown
	var slideshow1_slideIndexNext = false;	// Index of next image shown
	var slideshow1_imageDivs = new Array();	// Array of image divs(Created dynamically)
	var slideshow1_currentOpacity = 100;	// Initial opacity
	var slideshow1_imagesInGallery = false;	// Number of images in gallery
	var Opera = navigator.userAgent.indexOf('Opera')>=0?true:false;
	function createParentDivs1(imageIndex1)
	{
		if(imageIndex1==slideshow1_imagesInGallery){			
			showGallery1();
		}else{
			var imgObj1 = document.getElementById('galleryImage' + imageIndex1);	
			if(Opera)imgObj1.style.position = 'static';
			slideshow1_imageDivs[slideshow1_imageDivs.length] =  imgObj1;
			imgObj1.style.visibility = 'hidden';	
			imageIndex1++;
			createParentDivs1(imageIndex1);	
		}		
	}
	
	function showGallery1()
	{
		if(slideshow1_slideIndex==-1)slideshow1_slideIndex=0; else slideshow1_slideIndex++;	// Index of next image to show
		if(slideshow1_slideIndex==slideshow1_imageDivs.length)slideshow1_slideIndex=0;
		slideshow1_slideIndexNext = slideshow1_slideIndex+1;	// Index of the next next image
		if(slideshow1_slideIndexNext==slideshow1_imageDivs.length)slideshow1_slideIndexNext = 0;
		
		slideshow1_currentOpacity=100;	// Reset current opacity

		// Displaying image divs
		slideshow1_imageDivs[slideshow1_slideIndex].style.visibility = 'visible';
		if(Opera)slideshow1_imageDivs[slideshow1_slideIndex].style.display = 'inline';
		if(navigator.userAgent.indexOf('Opera')<0){
			slideshow1_imageDivs[slideshow1_slideIndexNext].style.visibility = 'visible';
		}
		
		if(document.all){	// IE rules
			slideshow1_imageDivs[slideshow1_slideIndex].style.filter = 'alpha(opacity=100)';
			slideshow1_imageDivs[slideshow1_slideIndexNext].style.filter = 'alpha(opacity=1)';
		}else{
			slideshow1_imageDivs[slideshow1_slideIndex].style.opacity = 0.99;	// Can't use 1 and 0 because of screen flickering in FF
			slideshow1_imageDivs[slideshow1_slideIndexNext].style.opacity = 0.01;
		}		
		

		setTimeout('revealImage1()',slideshow1_timeBetweenSlides);		
	}
	
	function revealImage1()
	{
		if(slideshow1_noFading){
			slideshow1_imageDivs[slideshow1_slideIndex].style.visibility = 'hidden';
			if(Opera)slideshow1_imageDivs[slideshow1_slideIndex].style.display = 'none';
			showGallery1();
			return;
		}
		slideshow1_currentOpacity--;
		if(document.all){
			slideshow1_imageDivs[slideshow1_slideIndex].style.filter = 'alpha(opacity='+slideshow1_currentOpacity+')';
			slideshow1_imageDivs[slideshow1_slideIndexNext].style.filter = 'alpha(opacity='+(100-slideshow1_currentOpacity)+')';
		}else{
			slideshow1_imageDivs[slideshow1_slideIndex].style.opacity = Math.max(0.01,slideshow1_currentOpacity/100);	// Can't use 1 and 0 because of screen flickering in FF
			slideshow1_imageDivs[slideshow1_slideIndexNext].style.opacity = Math.min(0.99,(1 - (slideshow1_currentOpacity/100)));
		}
		if(slideshow1_currentOpacity>0){
			setTimeout('revealImage1()',slideshow1_fadingSpeed);
		}else{
			slideshow1_imageDivs[slideshow1_slideIndex].style.visibility = 'hidden';	
			if(Opera)slideshow1_imageDivs[slideshow1_slideIndex].style.display = 'none';		
			showGallery1();
		}
	}
	
	function initImageGallery1()
	{
		slideshow1_galleryContainer = document.getElementById('imageSlideshowHolder1');
		slideshow1_galleryWidth = slideshow1_galleryContainer.clientWidth;
		slideshow1_galleryHeight = slideshow1_galleryContainer.clientHeight;
		galleryImgArray1 = slideshow1_galleryContainer.getElementsByTagName('IMG');
		for(var no=0;no<galleryImgArray1.length;no++){
			galleryImgArray1[no].id = 'galleryImage' + no;
		}
		slideshow1_imagesInGallery = galleryImgArray1.length;
		createParentDivs1(0);		
		
	}
	



