// JAVASCRIPT IN USE ON GDOT EXTERNAL HOMEPAGE


// The arrays below control the header images, associated links, and associated titles for the home page
		var arrImages = new Array();
		var arrLinks = new Array();
		var arrTitles = new Array();
		var arrTargets = new Array();
		
		var urlPreface = 'http://' + window.location.hostname + '/SiteCollectionImages/HeaderImages/';
		
		
		arrImages[0] = urlPreface + 'KGolden-CommissionerFinalist.jpg';
		arrImages[1] = urlPreface + 'FreightandLogistics.jpg';
		arrImages[2] = urlPreface + 'StateMapPhotoContest.jpg';
		
									
		arrLinks[0] = '/aboutGeorgiaDot/Board/Pages/default.aspx';
		arrLinks[1] = '/informationcenter/programs/georgiafreight/logisticsplan/';
		arrLinks[2] = '/maps/photocontest/';								
	
		arrTitles[0] = 'Board Search Committee Recommends Keith Golden for GDOT Commissioner';
		arrTitles[1] = 'Freight & Logistics Plan - Final Report Now Available';
		arrTitles[2] = 'State Highway Map Photo Contest - GDOT Wants Your Best Photos';		
		
		// Note: only use "_self" (opens in same window, for pages) or "_blank" (opens in new window, for .pdf)
		arrTargets[0] = '_self';
		arrTargets[1] = '_self';
		arrTargets[2] = '_self';
				
		var currentIndex = 99;
			
	
// Rotate the header image every XX seconds
function RotateHeader() {
	var hImage = document.getElementById("headerImage");
	var hLink = document.getElementById("headerLink");
	
	if (currentIndex < arrImages.length - 1)
	{ currentIndex++; }
	else
	{ currentIndex = 0; }
			
	hLink.href = arrLinks[currentIndex];
	hLink.target = arrTargets[currentIndex];
	
	// If the link doesn't point anywhere, add onClick event to keep page from reloading
	if (arrLinks[currentIndex] == '#')
	{ hLink.onclick = function ReturnFalse() { return false; } }
	else
	{ hLink.onclick = function ReturnTrue() { return true; } }
								
	hImage.src = arrImages[currentIndex];
	hImage.title = arrTitles[currentIndex];
	
	setTimeout("RotateHeader()", 5000);
}
	
	
	
// Hover Menu: expand submenu when mousing over a category
function showSub(catIndex) {
	
	var hoverDiv = document.getElementById('submenu' + catIndex);
	var hoverCat = document.getElementById('category' + catIndex);
	
	// find the semi-transparent background layer and increase the height to cover the submenu...
	var hoverBG = document.getElementById('hoverMenuBG');
	
	hoverDiv.style.visibility = 'visible';
	hoverDiv.style.display = 'block';
	
	hoverCat.style.color = '#ffd911';
	hoverBG.style.height = '225px';
	
		
}

// Hover Menu: collapse all submenus when cursor leaves a category
// 				(also collapse submenus when cursor moves from one category to another)
function hideAllSubMenus() {

	var hoverCat;
	var hoverDiv;
	for (var x = 0; x <= 5; x++)
	{	
		hoverDiv = document.getElementById('submenu' + x);
		hoverCat = document.getElementById('category' + x);
		
		if (hoverDiv) {
		hoverDiv.style.visibility = 'hidden';
		hoverDiv.style.display = 'none';
		
		hoverCat.style.color = '#ffffff';
		
		}
		
	// find the semi-transparent background layer and decrease the height
	var hoverBG = document.getElementById('hoverMenuBG');
	hoverBG.style.height = '50px';
		
	}	
}
