// JavaScript Document
function checkDropDown(myDepartment){
	var over=false;
	if(departments[myDepartment].over==true){
		over=true;
	}
	if(departments[myDepartment].menuOver==true){
		over=true;
	}
	for(var i=0; i<departments[myDepartment].optionOver.length; i++){
		if(departments[myDepartment].optionOver[i]==true){
			over=true;
		}
	}
	if(over==true){
		if(document.getElementById("tab_"+myDepartment).className!="departmentTabSelected" && document.getElementById("tab_"+myDepartment).className!="departmentTabOver"){
			document.getElementById("tab_"+myDepartment).className="departmentTabOver";
		}
	}
	return over;
}
function startCloseDropDown(myDepartment){
	if(checkDropDown(myDepartment)==false){
		if (document.getElementById("menu_"+myDepartment) != null){
			document.getElementById("menu_"+myDepartment).style.zIndex=25;
			var t=setTimeout("closeDropDown("+myDepartment+")",1000);
		}
	}
}
function closeDropDown(myDepartment){
	if(checkDropDown(myDepartment)==false){
		if (document.getElementById("menu_"+myDepartment) != null){
			document.getElementById("menu_"+myDepartment).style.display="none";
			if(document.getElementById("tab_"+myDepartment).className!="departmentTabSelected"){
				document.getElementById("tab_"+myDepartment).className="departmentTab";
			}
		}
	}
}


function departmentOptionOver(myDepartment,myOption){
	departments[myDepartment].optionOver[myOption]=true;
}
function departmentOptionOut(myDepartment,myOption){
	departments[myDepartment].optionOver[myOption]=false;
	startCloseDropDown(myDepartment);
}


function overDropDown(myDepartment){
	departments[myDepartment].over=true;
	if (document.getElementById("menu_"+myDepartment) != null){
		document.getElementById("menu_"+myDepartment).style.display="block";
		document.getElementById("menu_"+myDepartment).style.zIndex=30;
		for(var i=0; i<departments.length; i++){
			if(i!=myDepartment){
				closeDropDown(i);
			}
		}
	}
}
function outDropDown(myDepartment){
	departments[myDepartment].over=false;
	startCloseDropDown(myDepartment);
}


function overDropDownMenu(myDepartment){
	departments[myDepartment].menuOver=true;
}
function outDropDownMenu(myDepartment){
	departments[myDepartment].menuOver=false;
	startCloseDropDown(myDepartment);
}