/* Start Rotating banner code */

var theImage = new Array()
theImage[0] = 'http://www.inspironlogistics.com/imgs/healthcare_on.gif'
theImage[1] = 'http://www.inspironlogistics.com/imgs/corporate_on.gif'
theImage[2] = 'http://www.inspironlogistics.com/imgs/public_on.gif'
theImage[3] = 'http://www.inspironlogistics.com/imgs/government_on.gif'
theImage[4] = 'http://www.inspironlogistics.com/imgs/education_on.gif'

function orimage()
{
	document.getElementById("myImage1").src="http://www.inspironlogistics.com/imgs/healthcare_off.gif"
	document.getElementById("myImage2").src="http://www.inspironlogistics.com/imgs/corporate_off.gif"
	document.getElementById("myImage3").src="http://www.inspironlogistics.com/imgs/public_off.gif"
	document.getElementById("myImage4").src="http://www.inspironlogistics.com/imgs/government_off.gif"
	document.getElementById("myImage5").src="http://www.inspironlogistics.com/imgs/education_off.gif"
}

active = Math.floor(Math.random()*5);
var arrayLength = 5;
k = 1;
var fadeinTimer,fadeoutTimer,hideTimer;

function animate(i,interaction)
{
	clearTimeout(fadeinTimer);
	clearTimeout(fadeoutTimer);
	clearTimeout(hideTimer);
	if(interaction=="first")
	{
		fadeIn(i);
		active = i;
		k = active;
	    timerID = setInterval("autorotator()",4500);
	}
	if(interaction==true)
	{	
		timerID=clearInterval(timerID);
	}
	orimage();
	if(active!=i)
	{
		fadeOut(active);
		fadeIn(i);
		active = i;
	}
	document.getElementById("myImage" + (i+1)).src=theImage[i];
	if(interaction==true)
	{
		k = active;
		timerID = setInterval("autorotator()",7000);
	}
}

function autorotator()
{
	animate(k,false);
	if(k!=4)
	{
		k=k+1;
	}
	else
	{
		k =0;
	}
}

function getElm(eID) 
{
	return document.getElementById(eID);
}

function show(eID) 
{
	getElm(eID).style.display='block';
}

function hide(eID) 
{
	getElm(eID).style.display='none';
}

function setOpacity(eID, opacityLevel) 
{
	var eStyle = getElm(eID).style;
	eStyle.opacity = opacityLevel / 100;
	eStyle.filter = 'alpha(opacity='+opacityLevel+')';
}

function fadeIn(eID) 
{
	setOpacity(eID, 0); show(eID); var timer = 0;
	for (var i=1; i<=100; i++) {
		fadeinTimer = setTimeout("setOpacity('"+eID+"',"+i+")", timer * 5);
		timer++;
	}
}


function fadeOut(eID) 
{
	var timer = 0;
	for (var i=100; i>=1; i--) {
		fadeoutTimer = setTimeout("setOpacity('"+eID+"',"+i+")", timer * 5);
		timer++;
	}
	hideTimer = setTimeout("hide('"+eID+"')", 500);
}


/* End Rotating banner code */
