var timerid;
timerid=0;
var alertId;
var El;

function G_E(E_N)
{
	return document.getElementById(E_N);
}

function S_E(E_N,S)
{
	switch (S)
	{
	case 0: G_E(E_N).style.display='none';
	break;
	case 1: G_E(E_N).style.display='';
	break;
	case 2: G_E(E_N).style.display=(G_E(E_N).style.display=='')?'none':'';
	break;
	}
}

function D_W(H_T)
{
	document.write(H_T);
}

function hideAlert()
{
	G_E("AlertId").style.display='none';
	G_E("AlertId").innerHTML='&nbsp;';
	timerid=0;
}

function showAlert(alertstr)
{
	G_E("AlertId").innerHTML += alertstr;
	G_E("AlertId").style.display='';
	if (timerid>0) clearTimeout(timerid);
	timerid=setTimeout("hideAlert();", 5000);
}

function setCookie(name, value, expiredays, path, domain, secure) {
   if (expiredays) {
      var exdate=new Date();
      exdate.setDate(exdate.getDate()+expiredays);
      var expires = exdate.toGMTString();
   }
   document.cookie = name + "=" + escape(value) +
   ((expiredays) ? "; expires=" + expires : "") +
   ((path) ? "; path=" + path : "") +
   ((domain) ? "; domain=" + domain : "") +
   ((secure) ? "; secure" : "");
}

function getCookie(name) {
   var cookie = " " + document.cookie;
   var search = " " + name + "=";
   var setStr = null;
   var offset = 0;
   var end = 0;
   if (cookie.length > 0) {
      offset = cookie.indexOf(search);
      if (offset != -1) {
         offset += search.length;
         end = cookie.indexOf(";", offset)
         if (end == -1) {
            end = cookie.length;
         }
         setStr = unescape(cookie.substring(offset, end));
      }
   }
   return setStr;
}

function W_T_M(T_M_W,T_M_U_A,T_M_C_A,menuid)
{
	function W_T_M_(T_M_U, T_M_C, T_M_N, S_T_M_N, C_T_M_N)
	{
		D_W("<TD class='topmenucell_");
		if (T_M_N==S_T_M_N) D_W(" topmenulcell"); 
		if (T_M_N-1==S_T_M_N) D_W(" topmenurcell");
		D_W("'>&nbsp;</ TD>")
		if (T_M_N<C_T_M_N)
		{
			D_W("<TD ");
			if (T_M_N==S_T_M_N) D_W("class='topmenucell'");
			D_W("><a href='"+T_M_U+"'><div class='topmenua'>"+T_M_C+"</div></a></ TD>");
		}
	}
	D_W("<TABLE class='topmenutable' style='width:"+T_M_W+"px;' cols=13><TR valign=top>");
	for (var i=0; i<=T_M_U_A.length; i++)
	{
		W_T_M_(T_M_U_A[i], T_M_C_A[i], i, menuid-1, T_M_U_A.length);
	}
	D_W("</TR></TABLE>");
}

