var dropdown_intervalId;
var dropdown_ulId = (!dropdown_ulId) ? 'nav' : dropdown_ulId;
var dropdown_delay = (!dropdown_delay) ? 1000 : dropdown_delay;
function dropdown_init()
{
	try
	{
		var as = document.getElementById(dropdown_ulId).getElementsByTagName('a');
		for (var a = 0; a < as.length; a++)
		{
			as[a].onfocus = function() { dropdown_expand(this) }
			as[a].onmouseover = function() { dropdown_expand(this) }
			as[a].onblur = function() { dropdown_colapse(dropdown_delay) }
			as[a].onmouseout = function() { dropdown_colapse(dropdown_delay) }
		}
		dropdown_colapse(0);
	} catch(e){}
}
function dropdown_expand(caller)
{
	try
	{
		clearInterval(dropdown_intervalId);
		var uls = caller.parentNode.parentNode.getElementsByTagName('ul');
		for (var ul = 0; ul < uls.length; ul++)
			uls[ul].style.left = "-1000em";
		caller.parentNode.getElementsByTagName('ul')[0].style.left = "auto";
	} catch(e){}
}
function dropdown_colapse(milliseconds)
{
	try
	{
		clearInterval(dropdown_intervalId);
		dropdown_intervalId = setInterval(function()
		{
			var uls = document.getElementById(dropdown_ulId).getElementsByTagName('ul');
			for (var ul = 0; ul < uls.length; ul++)
				uls[ul].style.left = "-1000em";
			clearInterval(dropdown_intervalId);
		}, milliseconds, null);
	} catch(e){}
}
window.onload = dropdown_init;
