  var current;
  var menu     = "返回到主菜单";
  var compose  = "创建一个新邮件";
  var asearch  = "搜索所有邮件";
  var logout   = "登出";
  var check	= "按此开始检查所有地方";
  var CSSstatus = "0";
  var CSSObject = '菜单选项';
  var CSSselect = "请选择收件者";
  var Preferences = "邮箱设置";
  var subfold = "邮箱管理";
  var ab = "地址簿";
  var calendar = "日程表";
  var mailboxname = "邮件箱";
  var passwordpassword = "修改密码";
  var planplanplanplan = "修改数字签名";
  var signaturesignature = "修改我的签名";
  var userprefuserpref = "用户个性化设置";
  var chgvacchgvacchgvac = "外出自动回复";
  var chgfwdchgfwdchgfwd = "修改邮件转发";
  var chgldapchgldapchgldap = "改变用户信息";
  var autoresplinkautoresplink = "编辑自动回复";
  var chgruleschgrules = "修改处理规则";
  // convert all characters to lowercase to simplify testing 
  var agt=navigator.userAgent.toLowerCase();
  // Note: On IE5, these return 4, so use is_ie5up to detect IE5. 
  var is_major = parseInt(navigator.appVersion); 
  var is_minor = parseFloat(navigator.appVersion); 
  var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) 
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) 
                && (agt.indexOf('webtv')==-1)); 
  var is_nav3 = (is_nav && (is_major == 3));
  var is_nav4up = (is_nav && (is_major >= 4));
  var is_ie   = (agt.indexOf("msie") != -1);
  var is_ie4up  = (is_ie  && (is_major >= 4));

  if(is_nav4up)
  {
    CSSObject += 'NS';
  }

  function statusBarMsg(message)
  {
    window.status = message;
  }

  function chgTextBox(form)
  {
    var i;
	var newOpt = "<!--IMAIL.RuleNewMailbox-->";
	var deleteOpt = "<!--IMAIL.RuleDeleteMail-->";

    i = form.subarea.selectedIndex;
  
    if(i==-1)
    {
      return;
    }

    if(form.subarea.options[i].text==newOpt)
    {
      form.newMbxName.value="";
	  form.newMbxName.focus();
	  return;
    }
    if(form.subarea.options[i].text==deleteOpt)
    {
      form.newMbxName.value="Delete the message";
	  return;
	}
	else
	{
	  form.newMbxName.value=form.subarea.options[i].text;
	  return;
	}
  }

  function doButton(sButton)
  {
    if (sButton == "<!--IMAIL.SearchButton-->"
        || sButton == "<!--IMAIL.CancelButton-->")
      document.Search.search_ok.value = sButton;
      document.Search.submit();
  }

  function doButton2(TopBottom,sButton)
  {
    if (sButton=="<!--IMAIL.NextButton-->"
        || sButton=="<!--IMAIL.PreviousButton-->"
        || sButton=="<!--IMAIL.ReplyButton-->"
        || sButton=="<!--IMAIL.ReplyAllButton-->"
        || sButton=="<!--IMAIL.ForwardButton-->"
        || sButton=="<!--IMAIL.DeleteButton-->"
        || sButton=="<!--IMAIL.MoveToButton-->")
    {
      if (TopBottom=="Top")
      {
        document.Buttons.imail_action.value=sButton;
        document.Buttons.submit();
      }
	  if (TopBottom=="Move")
	  {
	    document.MoveButton.imail_action.value=sButton;
        document.MoveButton.submit();
	  }
      if (TopBottom=="Bottom")
      {
        document.BottomButtons.imail_action.value=sButton;
        document.BottomButtons.submit();
      }
      return;
    }
  }

  function doButton3(sButton)
  {
    if (sButton=="Top<!--IMAIL.NextPageButton-->"
       || sButton=="Top<!--IMAIL.LastPageButton-->"
       || sButton=="Top<!--IMAIL.GoPageButton-->"
       || sButton=="Top<!--IMAIL.FirstPageButton-->"
       || sButton=="Top<!--IMAIL.PriorPageButton-->"
       || sButton=="<!--IMAIL.NextPageButton-->"
       || sButton=="<!--IMAIL.LastPageButton-->"
       || sButton=="<!--IMAIL.GoPageButton-->"
       || sButton=="<!--IMAIL.FirstPageButton-->"
       || sButton=="<!--IMAIL.PriorPageButton-->")
    {
      var nCounter = document.forms.length;
      var nForms   = 0;
      while (nForms < nCounter)
      {
        if (document.forms[nForms].name == sButton)
		{
          document.forms[nForms].submit();
		}
          nForms++
      }
    } else if (sButton=="<!--IMAIL.DeleteButton-->"
              || sButton=="<!--IMAIL.DeleteAllButton-->"
              || sButton=="<!--IMAIL.MoveToButton-->"
              || sButton=="<!--IMAIL.GotoMailboxButton-->")
      {
        document.mboxsummary.imail_action.value=sButton;
        document.mboxsummary.submit();
        return;
      }
  }

  function newMailCount(data, NumValue)
  {
    if(NumValue==1)
	{
	  if(data.split("/"))
	  {
	    countArray = new Array(2);
	    countArray = data.split("/");
	    if(countArray[1] > 0)
		{
	      document.write("(" + countArray[1] + ")");
	    }
	      return;
	  }
	  else
	  {
	    return;
	  }
    }
	if(NumValue==0)
	{
	  if(data.split("/"))
	  {
	    countArray = new Array(2);
	    countArray = data.split("/");
	    document.write(countArray[0]);
	    return;
	  }
	  else
	  {
	    document.write(data);
		return;
	  }
	}
  }

  function checkAll()
  {
    for (var i=0;i<document.mboxsummary.elements.length;i++)
    {
      var e = document.mboxsummary.elements[i];
      var boolValue = document.sortedsummary.selectAll.checked;
      if (e.name != 'selectAll')
	  {
        e.checked = boolValue;
	  }
    }
  }

  function goToPage(numPages, curr, type)
  {
    var counter;
	var maxCount;
	document.write('<SELECT NAME="gotopage" SIZE="1" VALIGN="top" onChange="doButton3(');
	document.write("'" + type + "'");
	document.write(');">');
	for(counter=1,maxCount=numPages; maxCount > 0; maxCount--,counter++)
	{
	  if(counter == curr)
	  {
	    document.writeln('<OPTION VALUE="' + counter + '" SELECTED>' + counter + '</OPTION>');
	  }
	  else
	  {
	    document.writeln('<OPTION VALUE="' + counter + '">' + counter + '</OPTION>');
	  }
	}
	document.writeln('</SELECT>');
  }

  function newMsgCount()
  { 
    if(<!--IMAIL.UnreadMessageCount-->>0)
	{
	  <!--IMAIL.BeginIsMailbox.EQ Draft-->
	    document.writeln('<FONT SIZE="2" FACE="Arial, Helvetica"><B><!--IMAIL.UnreadMessageCount--> unread draft(s)</B></FONT>');
	  <!--IMAIL.ElseBeginIsMailbox-->
	   document.writeln('<FONT SIZE="2" FACE="Arial, Helvetica"><B><!--IMAIL.UnreadMessageCount--> unread message(s)</B></FONT>');
	  <!--IMAIL.EndBeginIsMailbox-->
	}
	else
	{
	  <!--IMAIL.BeginIsMailbox.EQ Draft-->
	    document.writeln('<FONT SIZE="2" FACE="Arial, Helvetica">No new draft.</FONT>');
	  <!--IMAIL.ElseBeginIsMailbox-->
	    document.writeln('<FONT SIZE="2" FACE="Arial, Helvetica">No new message.</FONT>');
	  <!--IMAIL.EndBeginIsMailbox-->
	}
  }

  function deleteMe(num)
  {
    for (var i=0;i<document.mboxsummary.elements.length;i++)
    {
      var me = document.mboxsummary.elements[i];
      if (me.name == 'msgsort' && me.value == num)
	  {
        me.checked = true;
	  }
	  else
	  {
	    me.checked = false;
	  }
    }
	doButton3('<!--IMAIL.DeleteButton-->');
  }

  function selectMe(me, match)
  {
    var maxNum, counter, choice;
    maxNum = me.length;
    for (counter=0; counter<maxNum; counter++)
    {
      choice = me.options[counter];
      if(choice.text==match)
	  {
	    choice.selected=1;
	    return;
	  }
	}
	return;
  }

  function selectMailbox(mailbox)
  {
    var maxNum, counter, choice;
    maxNum = document.ModRul.subarea.length;
    for (counter=0; counter<maxNum; counter++)
    {
      choice = document.ModRul.subarea.options[counter];
      if(choice.text==mailbox)
	  {
	    choice.selected=1;
	    return;
	  }
	  if(mailbox=="NUL")
	  {
	    document.ModRul.subarea.options[1].selected=1;
	    document.ModRul.newMbxName.value="";
	    return;
	  }
	}
	document.ModRul.subarea.options[0].selected=1;
	return;
  }

  <!--IMAIL.BeginIfUserIcalendarEnable-->
  function openIWebCal()
  { 
    <!--IMAIL.BeginSSL-->	
		<!--IMAIL.BeginIfCurrentDomainIsAVirtualDomain-->
		  newWindow = open("https://<!--IMAIL.PrimaryDomain-->:<!--IMAIL.ICalSSLServerPort-->/ical.cgi?&App=ICalMsg&<!--IMAIL.UserParameters-->",
			"Calendar", "toolbar=yes,location=1,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=1,copyhistory=1,width=512,height=512");
		<!--IMAIL.ElseBeginIfCurrentDomainIsAVirtualDomain-->
		  newWindow = open("https://<!--IMAIL.CurrentDomain-->:<!--IMAIL.ICalSSLServerPort-->/ical.cgi?&App=ICalMsg&<!--IMAIL.UserParameters-->",
			"Calendar", "toolbar=yes,location=1,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=1,copyhistory=1,width=512,height=512");
		<!--IMAIL.EndBeginIfCurrentDomainIsAVirtualDomain-->
	<!--IMAIL.ElseBeginSSL-->
		<!--IMAIL.BeginIfCurrentDomainIsAVirtualDomain-->
		  newWindow = open("http://<!--IMAIL.PrimaryDomain-->:<!--IMAIL.ICalServerPort-->/ical.cgi?&App=ICalMsg&<!--IMAIL.UserParameters-->",
			"Calendar", "toolbar=yes,location=1,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=1,copyhistory=1,width=512,height=512");
		<!--IMAIL.ElseBeginIfCurrentDomainIsAVirtualDomain-->
		  newWindow = open("http://<!--IMAIL.CurrentDomain-->:<!--IMAIL.ICalServerPort-->/ical.cgi?&App=ICalMsg&<!--IMAIL.UserParameters-->",
			"Calendar", "toolbar=yes,location=1,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=1,copyhistory=1,width=512,height=512");
		<!--IMAIL.EndBeginIfCurrentDomainIsAVirtualDomain-->
	<!--IMAIL.EndBeginSSL-->
  }

  <!--IMAIL.EndBeginIfUserIcalendarEnable-->

	function writeTextBox(form)
	{
	  i = form.Target.selectedIndex;
	  if((form.Target.options[i].text.search("@")!=-1) && (i != -1))
	  {
	    form.newaddr.value = form.Target.options[i].text;
	  }
	}

	function findMe(formList, textBoxValue)
	{
	  if(textBoxValue.charAt(0)=='<' && textBoxValue.charAt(textBoxValue.length - 1)=='>')
	  {
	    selectMe(formList, textBoxValue);
	  }

	  if(textBoxValue.charAt(0)!='<' && textBoxValue.charAt(textBoxValue.length - 1)!='>')
	  {
	    textBoxValue = '<' + textBoxValue + '>';
	    selectMe(formList, textBoxValue);
	  }

	  return;
	}

	function searchaddr(form, searchtext, listName)
    {

	  var i = 0;
	  var quote = '"';

	  if(searchtext == "")
	  {
	    alert("The text field for the " + listName + " is blank.");
		return;
	  }

      for(i=0; i< form.Target.length; i++)
	  {

	    if(form.Target.options[i].text == searchtext )
	    {	
	 	  form.Target.selectedIndex = i;
		  return;
		}
	    else
	    {
          if(form.Target.options[i].text.indexOf(searchtext) != -1)
	      {	
 		    form.Target.selectedIndex = i;
		    return;
	      }
        }
	  } 	
	
	  alert("User "+ quote + searchtext + quote + " could not be found in the "+ listName +"." );
	  return;
    }

  function show(id)
	{
	  if(document.getElementById)
	  {
      document.getElementById(id).style.visibility = "visible";
      document.getElementById(id).style.display = "block";
      return 1;
    }
	  else if(document.layers)
	  {
	    document.layers[id].visibility = "show";
      document.layers[id].display = "block";
      return 1;
    }
	  else if(document.all)
	  {
	    document.all[id].style.visibility = "visible";
      document.all[id].style.display = "block";
      return 1;
	  }
    return 0;
	}
	
	function hide(id)
	{
	  if(document.getElementById)
	  {
      document.getElementById(id).style.visibility = "hidden";
      document.getElementById(id).style.display = "none";
      return 1;
    }
	  else if(document.layers)
	  {
      document.layers[id].visibility = "hide";
      document.layers[id].display = "none";
      return 1;
    }
	  else if(document.all)
	  {
	    document.all[id].style.visibility = "hidden";
      document.all[id].style.display = "none";
      return 1;
    }
    return 0;
	}