// Manage tab header image loading

// array of "normal state" images
var normalImages = new Array('/images/nav_01.gif', '/images/nav_02.gif', '/images/nav_03.gif', '/images/nav_04.gif', '/images/nav_05.gif');

// array of "click state" images
var hoverImages = new Array('/images/nav_01-on.gif', '/images/nav_02-on.gif', '/images/nav_03-on.gif', '/images/nav_04-on.gif', '/images/nav_05-on.gif');

// array of "click state" images
var clickImages = new Array('/images/nav_01-on.gif', '/images/nav_02-on.gif', '/images/nav_03-on.gif', '/images/nav_04-on.gif', '/images/nav_05-on.gif');


var i=0;
function preloadTabs() 
{

//	alert( "In preloadTabs" );
	objImage = new Image();

	for	(i=1; i<=hoverImages.length; i++) {
		objImage.src = hoverImages[i];
	}

	for	(i=1; i<=clickImages.length; i++) {
		objImage.src = clickImages[i];
	}

//	obj = eval('document.tab1');
//	obj.src = clickImages[0];
	rotateLogos();
}

// this function rotates the logos at the bottom of the page
				var k = 0;
					function rotateLogos() {
					if(k==0) {
						document.getElementById("home_logos").innerHTML = '<a href="http://www.amsentertainment.com" target="_blank"><img src="images/logos_ams.jpg" width="97" height="40" border="0" /></a>';
						}
					if(k==1) {
						document.getElementById("home_logos").innerHTML = '<a href="http://www.bellezzavita.com" target="_blank"><img src="images/logos_bellezzavita.jpg" width="98" height="40" border="0" /></a>'
						}
					if(k==2) {
						document.getElementById("home_logos").innerHTML = '<a href="http://www.cox.com" target="_blank"><img src="images/logos_cox.jpg" width="98" height="40" border="0" /></a>'
						}
					if(k==3) {
						document.getElementById("home_logos").innerHTML = '<a href="http://www.graphicinksb.com" target="_blank"><img src="images/logos_graphicink.jpg" width="98" height="40" border="0" /></a>'
						}
					if(k==4) {
						document.getElementById("home_logos").innerHTML = '<a href="http://www.makeitwork.com" target="_blank"><img src="images/logos_miw.jpg" width="98" height="40" border="0" /></a>'
						}
					if(k==5) {
						document.getElementById("home_logos").innerHTML = '<a href="http://www.phase3.net" target="_blank"><img src="images/logos_phase3.jpg" width="98" height="40" border="0" /></a>'
						}
					if(k==6) {
						document.getElementById("home_logos").innerHTML = '<a href="http://www.saks.com/" target="_blank"><img src="images/logos_saks.jpg" width="98" height="40" border="0" /></a>'
						}
					if(k==7) {
						document.getElementById("home_logos").innerHTML = '<a href="http://www.sbparent.com" target="_blank"><img src="images/logos_sbparent.jpg" width="98" height="40" border="0" /></a>'
						}
					if(k==8) {
						document.getElementById("home_logos").innerHTML = '<a href="http://thetentmerchant.com" target="_blank"><img src="images/logos_tentmerchant.jpg" width="98" height="40" border="0" /></a>'
						}
					if(k==9) {
						document.getElementById("home_logos").innerHTML = '<a href="http://www.university-movers.com" target="_blank"><img src="images/logos_universitymovers.jpg" width="97" height="40" border="0" /></a>'
						k=0;
						}
					k++
					setTimeout("rotateLogos()", 1500)
					}
					
// this function resets all the images to their "normal" state
// used when clicking on an image, to reset all images 
function resetAll() {

	for	(i=1; i<=normalImages.length; i++) {
		obj = eval('document.tab' + i);
		obj.src = normalImages[i-1];
	}

}

// used on mouseover
// swap the named image into "hover" state
// but only if it is not already in "click" state
function hiliteTab(num) {

//	alert( "In hiliteTab " + num );
	obj = eval('document.tab' + num);
	str = obj.src;
//	alert( "In hiliteTab: " + str );

	if (str.search(clickImages[num-1]) == -1) {
		obj.src = hoverImages[num-1];
	}
}

// swap the named image into "click" state
// previously clicked images must go back to "normal" state first
function changeTab(num) {
//	alert( "In changeTab " + num );
	resetAll();
	obj = eval('document.tab' + num);
	obj.src = clickImages[num-1];
}

// used on mouseout
// swap the named image into "normal" state
// but only if it is not already in "click" state
function restoreTab(num) {
//	alert( "In restoreTab " + num );
	obj = eval('document.tab' + num);
	str = obj.src;
//	alert( "In restoreTab: " + str );

	if (str.search(clickImages[num-1]) == -1) {
		obj.src = normalImages[num-1];
	}
}
