// Set timeouts for each submenu piece
var membershipTimeoutId = null;
var travelTimeoutId = null;
var automotiveTimeoutId = null;
var insuranceTimeoutId = null;
var financialTimeoutId = null;
var memberdiscountsTimeoutId = null;
var newssafetyTimeoutId = null;
// Set submenu piece = div id
var membershipDrop = "dropmenu_membership";
var travelDrop = "dropmenu_travel";
var automotiveDrop = "dropmenu_automotive";
var insuranceDrop = "dropmenu_insurance";
var financialDrop = "dropmenu_financial";
var memberdiscountsDrop = "dropmenu_memberdiscounts";
var newssafetyDrop = "dropmenu_newssafety";


// Display membership drop
function showMembershipDrop()
{
	if (membershipTimeoutId != null)
	{
		window.clearTimeout(membershipTimeoutId);
		membershipTimeoutId = null;
	}
	menuElement = document.getElementById(membershipDrop);
	menuElement.style.display = "block";
}

// Set timer to turn off membership drop (delayed turn off)
function hideMembershipDrop()
{
	membershipTimeoutId = window.setTimeout("turnOffDrop('" + membershipDrop + "')", 60 * 2);
}


// Display travel drop
function showTravelDrop()
{
	if (travelTimeoutId != null)
	{
		window.clearTimeout(travelTimeoutId);
		travelTimeoutId = null;
	}
	menuElement = document.getElementById(travelDrop);
	menuElement.style.display = "block";
}

// Set timer to turn off travel drop (delayed turn off)
function hideTravelDrop()
{
	travelTimeoutId = window.setTimeout("turnOffDrop('" + travelDrop + "')", 60 * 2);
}


// Display automotive drop
function showAutomotiveDrop()
{
	if (automotiveTimeoutId != null)
	{
		window.clearTimeout(automotiveTimeoutId);
		automotiveTimeoutId = null;
	}
	menuElement = document.getElementById(automotiveDrop);
	menuElement.style.display = "block";
}

// Set timer to turn off automotive drop (delayed turn off)
function hideAutomotiveDrop()
{
	automotiveTimeoutId = window.setTimeout("turnOffDrop('" + automotiveDrop + "')", 60 * 2);
}


// Display insurance drop
function showInsuranceDrop()
{
	if (insuranceTimeoutId != null)
	{
		window.clearTimeout(insuranceTimeoutId);
		insuranceTimeoutId = null;
	}
	menuElement = document.getElementById(insuranceDrop);
	menuElement.style.display = "block";
}

// Set timer to turn off insurance drop (delayed turn off)
function hideInsuranceDrop()
{
	insuranceTimeoutId = window.setTimeout("turnOffDrop('" + insuranceDrop + "')", 60 * 2);
}


// Display financial drop
function showFinancialDrop()
{
	if (financialTimeoutId != null)
	{
		window.clearTimeout(financialTimeoutId);
		financialTimeoutId = null;
	}
	menuElement = document.getElementById(financialDrop);
	menuElement.style.display = "block";
}

// Set timer to turn off financial drop (delayed turn off)
function hideFinancialDrop()
{
	financialTimeoutId = window.setTimeout("turnOffDrop('" + financialDrop + "')", 60 * 2);
}


// Display memberdiscounts drop
function showMemberDiscountsDrop()
{
	if (memberdiscountsTimeoutId != null)
	{
		window.clearTimeout(memberdiscountsTimeoutId);
		memberdiscountsTimeoutId = null;
	}
	menuElement = document.getElementById(memberdiscountsDrop);
	menuElement.style.display = "block";
}

// Set timer to turn off memberdiscounts drop (delayed turn off)
function hideMemberDiscountsDrop()
{
	memberdiscountsTimeoutId = window.setTimeout("turnOffDrop('" + memberdiscountsDrop + "')", 60 * 2);
}


// Display newssafety drop
function showNewsSafetyDrop()
{
	if (newssafetyTimeoutId != null)
	{
		window.clearTimeout(newssafetyTimeoutId);
		newssafetyTimeoutId = null;
	}
	menuElement = document.getElementById(newssafetyDrop);
	menuElement.style.display = "block";
}

// Set timer to turn off newssafety drop (delayed turn off)
function hideNewsSafetyDrop()
{
	newssafetyTimeoutId = window.setTimeout("turnOffDrop('" + newssafetyDrop + "')", 60 * 2);
}


// Turns off drop immediately
function turnOffDrop(menuId)
{
	menuElement = document.getElementById(menuId);
	menuElement.style.display = "none";
}

function turnOffAll()
{
	menu1 = document.getElementById("dropmenu_membership");
	menu1.style.display = "none";
}