
/***********************************************
* Advanced Gallery script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice must stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

if (document.getElementById){
document.write('<style type="text/css">\n')
document.write('.gallerycontent{display:none;}\n')
document.write('</style>\n')
}

var selectedDiv=0
var totalDivs=0


function getElementbyClass(classname){
partscollect=new Array()
var inc=0
var alltags=document.all? document.all.tags("DIV") : document.getElementsByTagName("*")
for (i=0; i<alltags.length; i++){
if (alltags[i].className==classname)
partscollect[inc++]=alltags[i]
}
}

function contractall(){
var inc=0
while (partscollect[inc]){
partscollect[inc].style.display="none"
inc++
}
}

function setOpacity(obj, opacity) {
	opacity = (opacity == 100)?99.999:opacity;
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = opacity/100;
	// Older Mozilla and Firefox
	obj.style.MozOpacity = opacity/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = opacity/100;
}

function fadeIn(selectedDiv,opacity) {
var selectedDivObj=partscollect[selectedDiv]
	if (opacity <= 100) {
		setOpacity(selectedDivObj, opacity);
		increment = 5;
		if (opacity < 20) increment = .5;
		if (opacity < 40) increment = 1;
		if (opacity < 60) increment = 2;
		if (opacity < 80) increment = 4;
		opacity += increment;
		window.setTimeout("fadeIn('"+selectedDiv+"',"+opacity+")", 100);
	}
}

function navHighlights(selection){ 
	selectedDiv=selection;
	clearTimeout(autocontrolvar)
	clearTimeout(fadeoutcontrolvar)
	expandOneAtaTime(0);
}

function fadeOut(selectedDiv,opacity) {
	
var selectedDivObj=partscollect[selectedDiv]
	if (opacity >= 0) {
		setOpacity(selectedDivObj, opacity);
		opacity += -5;
		fadeoutcontrolvar=setTimeout("fadeOut('"+selectedDiv+"',"+opacity+")", 100);
	}
}

function expandOneAtaTime(fade){
var selectedDivObj=partscollect[selectedDiv]
	
contractall()
selectedDivObj.style.display="block"
if (fade == 1)
{
fadeIn(selectedDiv,10)
}
if (fade == 0)
{
fadeIn(selectedDiv,100)
}
fadeoutcontrolvar=setTimeout("fadeOut('"+selectedDiv+"',100)", 8000);
selectedDiv=(selectedDiv<totalDivs-1)? selectedDiv+1 : 0
autocontrolvar=setTimeout("expandOneAtaTime(1)",9000)
}

function startgallery(){
if (document.getElementById("controldiv")) //if it exists
document.getElementById("controldiv").style.display="block"
getElementbyClass("gallerycontent")
totalDivs=partscollect.length
expandOneAtaTime(1)
}

