// JavaScript Document
  var current = "登录";
  var help     = "获得当前信息的帮助: " + current;
  var headerMessage = "";

  function statusBarMsg(message)
  {
    window.status = message;
  }

  function getCookie(name)
  {
    var cookieFound = false;
    var start = 0;
	var end = 0;
	var cookieString = document.cookie;
	var cookieValue;
	var i = 0;
	
	//scan the Cookie for the name
	while (i <= cookieString.length)
	{
	  start = i;
	  end = start + name.length;
	  if(cookieString.substring(start, end) == name)
	  {
	    cookieFound = true;
		break;
	  }
	  i++;
	}
	
	//is name found/
	if(cookieFound)
	{
	  start = end+1;
	  end = document.cookie.indexOf(";",start);
	  if(end < start)
	  end = document.cookie.length;
	  
	  cookieValue = document.cookie.substring(start, end);
	  start = 0;
	  end = cookieValue.indexOf(" ", start);
	  
	  if(end < start)
	  end = cookieValue.length;
	  
	  return cookieValue.substring(start, end);
	}
	return "";
  }
  
  function initFields()
  {
    document.logon.userid.value = getCookie("IMail_UserId");
	document.logon.passwd.value = getCookie("IMail_password");
	if(document.logon.passwd.value.length > 0)
	{
	  document.logon.Use_Cookie.checked = 1;
	}
  }
  
  function deleteCookie(name, path, domain)
  {
    if(getCookie(name))
	{
	  document.cookie = name+ "=" + 
	  ((path) ? "; path=" + path : "") +
	  ((domain) ? "; domain=" + domain: "") +
	  "; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
  }
  
  function formSubmit()
  {
    deleteCookie("IMail_UserId", "/", null);
	deleteCookie("IMail_password", "/", null);
	deleteCookie("IMail_UserKey", "/", null);
  }

  // Begin cs_help.cgi
  function openHelp(sHelp)
  {
    url = '/' + sHelp + '.html';
	helpWin=window.open("",sHelp,"width=400,height=400,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes");
	helpWin.document.write('<HTML><HEAD><TITLE>Online Help</TITLE></HEAD><FRAMESET BORDER=0 ROWS="24, *">');
	helpWin.document.write('<FRAME MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="no" NAME="toolbar" NORESIZE SRC="helptoolbar.html">');
	helpWin.document.write('<FRAME MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="auto" NAME="mainPage" src="' + url + '">');
	helpWin.document.write('<NOFRAMES>Sorry, you need to have a browser that supports frames to view this file.</NOFRAMES>');
	helpWin.document.write('</FRAMESET></HTML>');
  }

