var a_images_slideshow = new Array()
var a_images = new Array()
var image_opacity = 1
var last_call
var slideshow_continue = true
var last_cycle_call
var global_image_index = 0
var global_bg_target
var global_image_target
var fadeIn = 1
var fadeOut = 0

if (navigator.appName.indexOf("Microsoft")!=-1) 
{ 
	var browser = 'IE'
}
else 
{ 
	var browser = 'MZ' 
}

a_images_slideshow[0] = '/_gallery/aug08-15-8-2008/.slideshow/ss7.jpg';
a_images[0] = new Image(347, 261 )
a_images[0].src = '/_gallery/aug08-15-8-2008/ss7.jpg'
a_images[0].alt = 'aug08'
a_images[0].title = 'aug08'
a_images_slideshow[1] = '/_gallery/aug08-15-8-2008/.slideshow/ss4.jpg';
a_images[1] = new Image(347, 261 )
a_images[1].src = '/_gallery/aug08-15-8-2008/ss4.jpg'
a_images[1].alt = 'aug08'
a_images[1].title = 'aug08'
a_images_slideshow[2] = '/_gallery/aug08-15-8-2008/.slideshow/ss6.jpg';
a_images[2] = new Image(347, 261 )
a_images[2].src = '/_gallery/aug08-15-8-2008/ss6.jpg'
a_images[2].alt = 'aug08'
a_images[2].title = 'aug08'
a_images_slideshow[3] = '/_gallery/aug08-15-8-2008/.slideshow/ss5.jpg';
a_images[3] = new Image(347, 261 )
a_images[3].src = '/_gallery/aug08-15-8-2008/ss5.jpg'
a_images[3].alt = 'aug08'
a_images[3].title = 'aug08'
a_images_slideshow[4] = '/_gallery/aug08-15-8-2008/.slideshow/ss3.jpg';
a_images[4] = new Image(347, 261 )
a_images[4].src = '/_gallery/aug08-15-8-2008/ss3.jpg'
a_images[4].alt = 'aug08'
a_images[4].title = 'aug08'
a_images_slideshow[5] = '/_gallery/aug08-15-8-2008/.slideshow/ss2.jpg';
a_images[5] = new Image(347, 261 )
a_images[5].src = '/_gallery/aug08-15-8-2008/ss2.jpg'
a_images[5].alt = 'aug08'
a_images[5].title = 'aug08'
a_images_slideshow[6] = '/_gallery/aug08-15-8-2008/.slideshow/ss8.jpg';
a_images[6] = new Image(347, 261 )
a_images[6].src = '/_gallery/aug08-15-8-2008/ss8.jpg'
a_images[6].alt = 'aug08'
a_images[6].title = 'aug08'


function set_opacity(object,opacity)
{
	if (object.filters)
	{
		object.filters.alpha.opacity = opacity
	}
	else if (object.style.MozOpacity)
	{
		object.style.MozOpacity = opacity/100
	}
	else if (object.style.opacity)
	{
		object.style.opacity = opacity/100
	}
	else if (object.style.Opacity)
	{
		object.style.Opacity = opacity/100
	}
	else if (object.style.KhtmlOpacity)
	{
		object.style.KhtmlOpacity = opacity/100
	
	}
	
}

function fade_in()
{
	
	set_opacity(global_image_target,image_opacity)
	
	if (fadeIn != 1)
	{
		setTimeout( "fade_in()", 70 )
	}
	else if ( image_opacity < 100 )
	{
		
		image_opacity = image_opacity + 3
		last_call = setTimeout( "fade_in()", 70 )
	}
	else
	{
		setTimeout( "global_bg_target.src = global_image_target.src", 100 )

		image_opacity =  100
		fadeIn = 0;
		fadeOut = 1
		
	}
	
}

function fade_out()
{
	set_opacity(global_image_target,image_opacity)
	
	if (fadeOut != 1)
	{
		setTimeout( "fade_out()", 50 )
	
	}
	else if ( image_opacity > 25 )
	{
		
		image_opacity = image_opacity - 3
		
		last_call = setTimeout( "fade_out()", 50 )
	}
	else
	{
		image_opacity = 25	
		fadeIn = 1
		fadeOut = 0
		global_image_target.src = a_images_slideshow[global_image_index]
		fade_in()
	}
	
}

function extinguish()
{
	image_opacity = 1
	fadeIn = 1

	if ( last_call != '' )
	{
		clearTimeout( last_call )
	}

	if ( browser == 'IE' )
	{
		global_image_target.filters.alpha.opacity = 1
	}
	else
	{
		global_image_target.style.MozOpacity= 1/100
	}

}

function clear_last_call()
{
	if ( last_call != '' )
	{
		clearTimeout( last_call )
	}
}

function image_next()
{
	
	if ( image_opacity > 0 && image_opacity < 100 )
	{
		
		setTimeout( "image_next()", 500 )
	}
	else
	{
		global_image_index++


		if ( global_image_index >= a_images_slideshow.length )
		{
			global_image_index = 0	
		}
		
		clear_last_call();
		//fade_out()
		extinguish();
		setTimeout( "global_image_target.src = a_images_slideshow[global_image_index];global_image_target.alt = a_images[global_image_index].alt;global_image_target.title = a_images[global_image_index].title", 50 );
		setTimeout( "fade_in()", 100 );
	}

}

function cyle_thru_images()
{
	
	image_next();


	if ( slideshow_continue )
	{
		last_cycle_call = setTimeout( "cyle_thru_images()", 5*1000 ); 
	}	
}

function start_slideshow()
{

	global_bg_target = document.getElementById("image_bg");

	global_image_target = document.getElementById("image_fg");
	
	extinguish();
	global_image_target.src = a_images_slideshow[global_image_index];
	fade_in();

	if ( a_images_slideshow.length > 1 )
	{
		setTimeout( "cyle_thru_images()", 4*1000 );
	}

}
