var width1 = '171px' //image width1
var height1 = '129px' //image height1
var seconds1 = 3 //number of seconds1 before next image
var pause1 = seconds1 * 1000

var fadeimages1 = new Array()

//["image location", "a url link", "a target(ie. _blank)" ]
// the link and the target strings are optional
fadeimages1[0] = ["image/home/img_lab2.gif", "", ""]
fadeimages1[1] = ["image/home/img_lab3.gif", "", ""]
fadeimages1[2] = ["image/home/img_lab4.gif", "", ""]
fadeimages1[3] = ["image/home/img_lab5.gif", "", ""]

var preloadedimages1 = new Array()

for (c=0; c<fadeimages1.length; c++)
{
	preloadedimages1[c] = new Image()
	preloadedimages1[c].src = fadeimages1[c]
}

var ie41=document.all
var dom1=document.getElementById

if (ie41||dom1)
	document.write('<div style="position:relative;width:' + width1 + '; height:' + height1 + '; overflow:hidden;"><div id="canvasA" style="position:absolute; width:' + width1 + '; height:' + height1 + '; top:0; left:0; filter:alpha(opacity=10); -moz-opacity:10"></div><div id="canvasB" style="position:absolute; width:' + width1 + '; height:' + height1 + '; top:0; left:0; filter:alpha(opacity=10); -moz-opacity:10; visibility:hidden"></div></div>')
else
	document.write('<img name="defaultslide" src="'  + fadeimages1[Math.random()*fadeimages1.length-1][Math.random()*fadeimages1.length-1] + '">')

var curpos1 = 3
var degree1 = 10
var curcanvasB = "canvasA"
var curimageindex1 = Math.floor(Math.random()*fadeimages1.length)
var nextimageindex1 = Math.floor(Math.random()*fadeimages1.length)

/*
this method produces the fading effect of the image.
the curpos1 variable is set to the opacity level of the fading.
*/
function fadepic1()
{
	if (curpos1 < 100)
	{
		curpos1 += 3
		if (temp1obj1.filters)
			temp1obj1.filters.alpha.opacity = curpos1
		else if (temp1obj1.style.MozOpacity)
			temp1obj1.style.MozOpacity = curpos1/101
		}
	else
	{
		clearInterval(dropslide1)
		nextcanvas1 = (curcanvasB == "canvasA")? "canvasA" : "canvasB"
		temp1obj1=ie41? eval("document.all." + nextcanvas1) : document.getElementById(nextcanvas1)
		temp1obj1.innerHTML = insertimage1(nextimageindex1)
		nextimageindex1 = (nextimageindex1<fadeimages1.length-1)? nextimageindex1 + 1 : 0
		var temp1obj12=ie41? eval("document.all." + nextcanvas1) : document.getElementById(nextcanvas1)
		temp1obj12.style.visibility = "hidden"
		
		setTimeout("rotateimage1()",pause1)
	}
}

function insertimage1(i)
{
	var temp1container1 = fadeimages1[i][1] != ""? '<a href="' + fadeimages1[i][1] + '" target="'+fadeimages1[i][2] + '">' : ""
	temp1container1 += '<img src="'+fadeimages1[i][0]+'" border="0">'
	temp1container1 = fadeimages1[i][1]!=""? temp1container1+'</a>' : temp1container1
	return temp1container1
}

function rotateimage1()
{
	if (ie41||dom1)
	{
		resetit1(curcanvasB)
		var crossobj1 = temp1obj1=ie41? eval("document.all." + curcanvasB) : document.getElementById(curcanvasB)
		crossobj1.style.zIndex++
		temp1obj1.style.visibility = "visible"
		var temp1 = 'setInterval("fadepic1()",50)'
		dropslide1 = eval(temp1)
		curcanvasB = (curcanvasB == "canvasA")? "canvasB" : "canvasA"
	}
	else
		document.images.defaultslide.src = fadeimages1[curimageindex1][1]
		curimageindex1 = (curimageindex1 < fadeimages1.length-1)? curimageindex1 + Math.floor(Math.random()*fadeimages1.length-1) : 0
}

/*
this allows for a smoth transition when the new 
image is loaded, so the image doesn't blink.
*/
function resetit1(what1)
{
	curpos1 = 4
	var crossobj1=ie41? eval("document.all." + what1) : document.getElementById(what1)
		if (crossobj1.filters)
			crossobj1.filters.alpha.opacity = curpos1
		else if (crossobj1.style.MozOpacity)
			crossobj1.style.MozOpacity = curpos1/101
}

function startit1()
{
	var crossobj1=ie41? eval("document.all." + curcanvasB) : document.getElementById(curcanvasB)
	crossobj1.innerHTML = insertimage1(curimageindex1)
	rotateimage1()
}

if (ie41||dom1)
	window.onload=startit1
else
	setInterval("rotateimage1()",pause1)