/************************************************************************
		Copyright 2007 Darren Berry (design@darrenberry.co.uk)

		All rights reserved. The information contained in this document
		is confidential and may also be proprietary and trade secret. It
		is the intellectual property of Darren Berry, and without prior
		written approval from Darren Berry no part of this document may be
		reproduced or transmitted in any form or by any means, including
		but not limited to electronic, mechanical, photocopying or stored
		in any retrieval system of whatever nature.
		The use of copyright notice does not imply unrestricted public
		access to any part of this document. 
*************************************************************************/

var pic = new Array();
var slide = 0;
var i = 0;
var timer;

function clearSlideShow()
{
	pic = new Array();
	slide = 0;
	i = 0;
	if (timer)
		clearTimeout(timer);
}

function initSlideShow(first)
{
	slide = first;
	nextSlide(false);
}

function addSlide(file)
{
	pic[i] = new Image();
	pic[i].src = file;
	i++;
}

function CheckBrowser(browser)
{
	agent = navigator.userAgent.toLowerCase();
	return (agent.indexOf(browser) + 1) > 0;
}

function nextSlide(bImmediate)
{
	if (timer)
		clearTimeout(timer);

	if (fader = !bImmediate && CheckBrowser("msie") && !CheckBrowser("opera"))
	{
		document.images.SlideShow.style.filter = "blendTrans(duration=2)";
		document.images.SlideShow.filters.blendTrans.Apply();
	}
	document.images.SlideShow.src = pic[slide].src;
	if (fader)
		document.images.SlideShow.filters.blendTrans.Play();
	
	if (++slide >= pic.length)
		slide = 0;
	timer = setTimeout('nextSlide(false)', 6000);
}


