var aImages = new Array();
var aHovers = new Array();

function emptyBanner(){
	document.getElementById('bannerPic').innerHTML = "";
}

function addDataBanner(sData){
	document.getElementById('bannerPic').innerHTML += sData;
}

function openCurrentMenu(){
	if(aMenuDeep){
		openMenu(0);
	}	
	else if(iCurrentMenu){
		openMenu(iCurrentMenu);
	}
}

function openMenu(iMenuId){
	emptyBanner();
	if(!iMenuId){
		//openDeep
		aTemp = aMenuDeep;
	}
	else{
		aTemp = aMenu[iMenuId];
	}
	
	if(aTemp.length > 6){
		document.getElementById('bannerPic').className = 'morethan7';
	}
	else{
		document.getElementById('bannerPic').className = 'header_image';
	}
	
	for (i=0;i<aTemp.length;i++){
		if(aTemp[i][2]){
			aImages[i] = aTemp[i][2];
			aHovers[i] = new Image();
			showNormal(i);
			
		}
	}
	
	for (i=0;i<aTemp.length;i++){
		sIcon = '<a href="'+aTemp[i][1]+'" ';
		if(aTemp[i][3]){
			sIcon += 'target="_blank" ';
		}
		
		if(aTemp[i][2]){
			sIcon += 'onmouseover="showActive2(this.getElementsByTagName(\'img\')[0],'+i+');" onmouseout="showNormal2(this.getElementsByTagName(\'img\')[0],'+i+');">'+"\n";
			sIcon += " <img name='aImages["+i+"]' src='/Assets/Images/layout/icons/"+aTemp[i][2]+".gif' "+' onmouseover="showActive2(this,'+i+');" onmouseout="showNormal2(this,'+i+');" />\n<br />\n';
		}
		else{
			sIcon += "style='position: relative; top: -50px;' >\n";
		}
		sIcon += aTemp[i][0]+"</a>\n";
		addDataBanner(sIcon);
	}
		
}

function restorePic(timer){
	/*if(timer){
		setTimeout ("restorePic(0)", timer);
	}
	else{
		if(sSrcPic){
			emptyBanner();
			addDataBanner("<img src='/Assets/Images/SiteContent/"+sSrcPic+"' height='138' width='604' onmouseover='openCurrentMenu()' />");
		}
		else if(aMenuDeep){
			openCurrentMenu();
		}
		else{
			emptyBanner();
			addDataBanner("<img src='/Assets/Images/layout/header_image.jpg' height='138' width='604' onmouseover='openCurrentMenu()' />");
		}
	}*/
}

function putPicture(){
	if(sSrcPic){
		emptyBanner();
		addDataBanner("<img src='/Assets/Images/SiteContent/"+sSrcPic+"' height='138' width='604' />");
	}
	else{
		openCurrentMenu();
	}
}

function showActive(iIndex){
	aHovers[iIndex].src='/Assets/Images/layout/icons/'+aImages[iIndex]+'_active.gif';
}

function showNormal(iIndex){
	aHovers[iIndex].src='/Assets/Images/layout/icons/'+aImages[iIndex]+'.gif';
}

function showActive2(which, iIndex){
	which.src='/Assets/Images/layout/icons/'+aImages[iIndex]+'_active.gif';
}

function showNormal2(which, iIndex){
	which.src='/Assets/Images/layout/icons/'+aImages[iIndex]+'.gif';
}