var timeout	= 0;
var closetimer	= 0;
var sclosetimer	= 0;
var ddmenuitem	= 0;
var sddmenuitem = 0;

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}

function sopen(sid)
{	
	// get new layer and show it
	sddmenuitem = document.getElementById(sid);
	sddmenuitem.style.visibility = 'visible';

}

// close showed layer
function sclose(sid)
{
	//if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
	sddmenuitem = document.getElementById(sid);
	if(sddmenuitem) sddmenuitem.style.visibility = 'hidden';
}

// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// go close timer
function sclosetime(sid)
{
	if (sid == "s1")
		s1closetimer = window.setTimeout("sclose('" + sid + "')", timeout);
	if (sid == "s2")
		s2closetimer = window.setTimeout("sclose('" + sid + "')", timeout);
	if (sid == "s21")
		s21closetimer = window.setTimeout("sclose('" + sid + "')", timeout);
	if (sid == "s4")
		s4closetimer = window.setTimeout("sclose('" + sid + "')", timeout);
	if (sid == "s41")
		s41closetimer = window.setTimeout("sclose('" + sid + "')", timeout);
	if (sid == "s42")
		s42closetimer = window.setTimeout("sclose('" + sid + "')", timeout);
	if (sid == "s43")
		s43closetimer = window.setTimeout("sclose('" + sid + "')", timeout);
	if (sid == "s5")
		s5closetimer = window.setTimeout("sclose('" + sid + "')", timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// cancel close timer
function scancelclosetime(sid)
{
	if (sid == "s1") {
		window.clearTimeout(s1closetimer);
		s1closetimer = null;
	}
	if (sid == "s2") {
		window.clearTimeout(s2closetimer);
		s2closetimer = null;
	}
	if (sid == "s21") {
		window.clearTimeout(s21closetimer);
		s2closetimer = null;
	}
	if (sid == "s4") {
		window.clearTimeout(s4closetimer);
		s4closetimer = null;
	}
	if (sid == "s41") {
		window.clearTimeout(s41closetimer);
		s41closetimer = null;
	}
	if (sid == "s42") {
		window.clearTimeout(s42closetimer);
		s42closetimer = null;
	}
	if (sid == "s43") {
		window.clearTimeout(s43closetimer);
		s43closetimer = null;
	}
	if (sid == "s5") {
		window.clearTimeout(s5closetimer);
		s5closetimer = null;
	}
}

function btnEmailClick()
{

	window.location = "/email/?url="+location.href.substr(location.href.indexOf(location.pathname));
}

function doPrint()
{
	print();
}

