var company_parent;
var company_menu;

var half_parent;
var half_menu;

var seventy_parent;
var seventy_menu;

var full_parent;
var full_menu;

var sales_parent;
var sales_menu;


var sub_parent;
var sub_menu;

var showMenuTimerCompany;
var showMenuTimerHalf;
var showMenuTimerSeventy;
var showMenuTimerFull;
var showMenuTimerSales;
var showMenuTimerSub;


var companyMenuShowing = false;
var halfMenuShowing = false;
var seventyMenuShowing = false;
var fullMenuShowing = false;
var salesMenuShowing = false;
var subMenuShowing = false;

Event.observe(window, 'load', function() {
	company_parent = $("nav_company");
	company_menu = $("company_menu");
	company_parent.observe('mouseover', showCompanyMenu);
	
	half_parent = $("nav_half");
	half_menu = $("half_menu");
	half_parent.observe('mouseover', showHalfMenu);
	
	seventy_parent = $("nav_seventy");
	seventy_menu = $("seventy_menu");
	seventy_parent.observe('mouseover', showSeventyMenu);
	
	full_parent = $("nav_full");
	full_menu = $("full_menu");
	full_parent.observe('mouseover', showFullMenu);
	
	
	sales_parent = $("nav_sales");
	sales_menu = $("sales_menu");
	sales_parent.observe('mouseover', showSalesMenu);
	
	sub_parent = $("nav_sub");
	sub_menu = $("sub_menu");
	sub_parent.observe('mouseover', showSubMenu);
	
});

//

function showCompanyMenu()
{
	hideMenuFull();
	hideMenuSeventy();
	hideMenuHalf();
	hideMenuSales();
	hideMenuSub();
	
	company_menu.show();
	company_parent.addClassName('on');
	companyMenuShowing =  true;
	
	company_parent.observe("mouseout",startHideTimerCompany);
	company_parent.observe("mouseover", clearHideTimerCompany);
	
	company_menu.observe("mouseover", clearHideTimerCompany);
	company_menu.observe("mouseout",startHideTimerCompany);
}


function startHideTimerCompany()
{
	showMenuTimerCompany = setTimeout(hideMenuCompany,100);	
}

function clearHideTimerCompany()
{
	clearTimeout(showMenuTimerCompany);
}

function hideMenuCompany()
{	
	company_parent.removeClassName('on');
	company_menu.hide();
	companyMenuShowing = false;
}


//


function showHalfMenu()
{
	hideMenuFull();
	hideMenuSeventy();
	hideMenuSales();
	hideMenuSub();
	hideMenuCompany();
	
	half_menu.show();
	half_parent.addClassName('on');
	halfMenuShowing =  true;
	
	half_parent.observe("mouseout",startHideTimerHalf);
	half_parent.observe("mouseover", clearHideTimerHalf);
	
	half_menu.observe("mouseover", clearHideTimerHalf);
	half_menu.observe("mouseout",startHideTimerHalf);
}


function startHideTimerHalf()
{
	showMenuTimerHalf = setTimeout(hideMenuHalf,100);	
}

function clearHideTimerHalf()
{
	clearTimeout(showMenuTimerHalf);
}

function hideMenuHalf()
{	
	half_parent.removeClassName('on');
	half_menu.hide();
	halfMenuShowing = false;
}


///

function showSeventyMenu()
{
	hideMenuFull();
	hideMenuHalf();
	hideMenuSales();
	hideMenuSub();
	hideMenuCompany();

	seventy_menu.show();
	seventy_parent.addClassName('on');
	seventyMenuShowing =  true;
	
	seventy_parent.observe("mouseout",startHideTimerSeventy);
	seventy_parent.observe("mouseover", clearHideTimerSeventy);
	
	seventy_menu.observe("mouseover", clearHideTimerSeventy);
	seventy_menu.observe("mouseout",startHideTimerSeventy);
}


function startHideTimerSeventy()
{
	showMenuTimerSeventy = setTimeout(hideMenuSeventy,100);	
}

function clearHideTimerSeventy()
{
	clearTimeout(showMenuTimerSeventy);
}

function hideMenuSeventy()
{	
	seventy_parent.removeClassName('on');
	seventy_menu.hide();
	seventyMenuShowing = false;
}




///


function showFullMenu()
{
	hideMenuSeventy();
	hideMenuHalf();
	hideMenuSales();
	hideMenuSub();
	hideMenuCompany();

	full_menu.show();
	full_parent.addClassName('on');
	fullMenuShowing =  true;
	
	full_parent.observe("mouseout",startHideTimerFull);
	full_parent.observe("mouseover", clearHideTimerFull);
	
	full_menu.observe("mouseover", clearHideTimerFull);
	full_menu.observe("mouseout",startHideTimerFull);
}


function startHideTimerFull()
{
	showMenuTimerFull = setTimeout(hideMenuFull,100);	
}

function clearHideTimerFull()
{
	clearTimeout(showMenuTimerFull);
}

function hideMenuFull()
{	
	full_parent.removeClassName('on');
	full_menu.hide();
	fullMenuShowing = false;
}


///


function showSalesMenu()
{
	hideMenuSeventy();
	hideMenuHalf();
	hideMenuFull();
	hideMenuSub();
	hideMenuCompany();

	sales_menu.show();
	sales_parent.addClassName('on');
	salesMenuShowing =  true;
	
	sales_parent.observe("mouseout",startHideTimerSales);
	sales_parent.observe("mouseover", clearHideTimerSales);
	
	sales_menu.observe("mouseover", clearHideTimerSales);
	sales_menu.observe("mouseout",startHideTimerSales);
}


function startHideTimerSales()
{
	showMenuTimerFull = setTimeout(hideMenuSales,100);	
}

function clearHideTimerSales()
{
	clearTimeout(showMenuTimerFull);
}

function hideMenuSales()
{	
	sales_parent.removeClassName('on');
	sales_menu.hide();
	salesMenuShowing = false;
}




function showSubMenu()
{
	hideMenuSeventy();
	hideMenuHalf();
	hideMenuFull();
	hideMenuSub();
	hideMenuCompany();

	sub_menu.show();
	sub_parent.addClassName('on');
	subMenuShowing =  true;
	
	sub_parent.observe("mouseout",startHideTimerSub);
	sub_parent.observe("mouseover", clearHideTimerSub);
	
	sub_menu.observe("mouseover", clearHideTimerSub);
	sub_menu.observe("mouseout",startHideTimerSub);
}


function startHideTimerSub()
{
	showMenuTimerSub = setTimeout(hideMenuSub,100);	
}

function clearHideTimerSub()
{
	clearTimeout(showMenuTimerSub);
}

function hideMenuSub()
{	
	sub_parent.removeClassName('on');
	sub_menu.hide();
	subMenuShowing = false;
}




