

<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function popUp(URL) {
  popUpBase(URL, '410', '360');
}

function popUpLoginAs(URL, w, h) {
  popUpFull(URL, 'loginAsUser', '0', '1', '0', '1', '1', '1', w, h);
}

function popUpSingle(URL, id, w, h) {
    popUpFull(URL, id, '0', '1', '0', '0', '0', '1', w, h);
}

function popUpBase(URL, w, h) {
 day = new Date();
 id = day.getTime();
 popUpFull(URL, id, '0', '1', '0', '0', '0', '1', w, h);
 //eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,status=0,menubar=0,resizable=1,width=" + w + ",height=" + h + "');");
}

function popUpHelp(URL) {
  popUpFull(URL, 'help', '0', '1', '0', '1', '0', '1', '420', '550');
}

function popUpTest(URL, id) {
  popUpFull(URL, id, '0', '1', '0', '0', '0', '1', '420', '550');
}

function popUpUpdate(msg) {
  popUpPB('/update.html', 'update', msg, '0', '1', '0', '1', '0', '0', '550', '450');
}

function popUpFull(URL, name, t, sc, l, st, m, r, w, h) {
 eval("page" + name + " = window.open(URL, '" + name + "','toolbar=" + t + ",scrollbars=" + sc + ",location=" + l + ",status=" + st + ",menubar=" + m + ",resizable=" + r + ",width=" + w + ",height=" + h + "');");
}

function popUpPB(URL, name, msg, t, sc, l, st, m, r, w, h) {
  var popup = eval("page" + name + " = window.open(URL, '" + name + "','toolbar=" + t + ",scrollbars=" + sc + ",location=" + l + ",status=" + st + ",menubar=" + m + ",resizable=" + r + ",width=" + w + ",height=" + h + "');");
  if (popup != null && !popup.closed) {
      popup.focus();
  }
  else {
      alert(msg);
  }
}

function doHelp(page) {
  window.location.href= "help.html?helppage="+page;
}

function doUserHelp(page) {
  window.location.href= "help_user.html?helppage="+page;
}

function selectAllRows(sel, form, cbName) {
  for(var i=0; i < form.length; i++) {
    if (form.elements[i].name == cbName) {
      chkbox = form.elements[i];
      chkbox.checked = sel;
      if (isIE()) {
        selRow(chkbox);
      }
    }
  }
}

function selRow(obj) {
    div = obj.parentElement;
    col = div.parentElement;
    row = col.parentElement;
    row.bgColor = (obj.checked) ? '#CEE0F3' : '#ffffff';
}

function jump(anchor) {
   window.document.location.href = anchor;
}

function changeRowNum(url, obj) {
  window.document.location.href=url+"?rows="+obj.value;
}

function findChecked(radioGrp, val) {
  for (var i=0; i < radioGrp.length; i++) {
    if (radioGrp[i].checked && radioGrp[i].value == val) {
       return 1;
    }
  }
  return 0;
}

function isIE() {
   if (navigator.appName == "Netscape") {
      return false;
   }
   else {
      return true;
   }
}

function getInsideWindowHeight() {
   if (isIE()) {
      return document.body.clientHeight;
   }
   return window.innerHeight;
}

function getInsideWindowWidth() {
   if (isIE()) {
      return document.body.clientWidth;
   }
   return window.innerWidth;
}

function getSearch(key) {
  var search = window.location.search;
  search = search.substring(1);
  var queries = search.split("&");
  for (var i=0; i < queries.length; i++) {
    var token = queries[i].split("=");
    if (token[0] == key) {
       return queries[i];
    }
  } 
}

function reloadMsgViewer(raw, checkbox) {
   if (checkbox.checked != true) {
      host = window.document.location.host;
      uri = window.document.location.pathname;
      protocol = window.document.location.protocol;
      query = getSearch('msgkey');
      ptr = getSearch('ptr'); 
      if (typeof(ptr) != "undefined") { 
         query += '&' + ptr; 
      } 
      sec = getSearch('sec'); 
      if (typeof(sec) != "undefined") { 
         query += '&' + sec; 
      } 
      useremail = getSearch('useremail');
      if (typeof(useremail) != "undefined") {
         query += '&' + useremail;
      }
      if (raw == true) {
         query += '&rawMode=1';
      }
      url = protocol + '//' + host + uri + '?' + query;
      window.document.location.replace(url);
   }
}

function rpwsc() {
  var url = window.opener.location.href;
  window.opener.location.href = url
  self.close();
}

function rpw() {
  var url = window.opener.location.href;
  window.opener.location.href = url
}

function getWindowWidth() {
  width = 0;
  if (!isIE()) {
     width = window.innerWidth;
  }
  else {
     width = document.body.offsetWidth;
  }
  return width;
}

function getWindowHeight() {
  height = 0;
  if (!isIE()) {
     height = window.innerHeight;
  }
  else {
     height = document.body.offsetHeight;
  }
  return height;
}

// This function is used by the three pages that allow configuration of
// Junk Summary emails: JunkSummaryBody.jsp, UserJunkSummaryBody.jsp,
// and GroupsSummaryBody.jsp.  The purpose is to allow the junk summary
// examples to be shown in the language selected for Junk Summaries,
// not the language the UI is in.
function goToJunkSummarySample(page) {
  var index = document.forms[0].emailLanguage.selectedIndex;
  //alert("selectedIndex = " + index);
  locale = document.forms[0].emailLanguage.options[index].value;
  //alert("locale = " + locale);
  if (locale.indexOf('zh_') == -1 && locale.indexOf('_') != -1) {
      locale = locale.substring(0, locale.indexOf('_'));
  }
  uri = '/static_page?url=/static_htms/' + locale + '/' + page;
  var windowName = page.substr(0, page.length-4);  // strip the ".htm" off the end 
  //alert("window name  = " + windowName);
  popUpFull(uri, windowName, 0, 1, 0, 1, 0, 1, 800, 800)
}


function subThreatsSwitch(obj, isParent) {
    prefix = (isParent) ? obj.value : obj.value.substring(0, obj.value.indexOf('_'));
    for (var i = 0; i < document.forms[0].searchThreats.length; i++) {
        tmpObj = document.forms[0].searchThreats[i];
        if (obj.value == tmpObj.value) continue;
        if (tmpObj.value.indexOf(prefix) == 0) {
            if (isParent) {
                if (!obj.checked) {
                    tmpObj.checked = false;
                }
            }
            else {
                if (obj.checked) {
                    tmpObj.checked = true;
                    break;
                }
            }
        }
    }
}

function printIt(){
  if (window.print) {
    window.print() ;
  } else {
    var page = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
    document.body.insertAdjacentHTML('beforeEnd', page);
    page.ExecWB(6, 2);
  }
}

function enableServer(on, val) {
    if (on == 1) {
        document.forms[0].disable.value = '';
        document.forms[0].enable.value = val;
    }
    else {
        document.forms[0].disable.value = val;
        document.forms[0].enable.value = '';
    }
}

function enableOutboundServer(on, val) {
    if (on == 1) {
        document.forms[0].disableOutbound.value = '';
        document.forms[0].enableOutbound.value = val;
    }
    else {
        document.forms[0].disableOutbound.value = val;
        document.forms[0].enableOutbound.value = '';
    }
}

function moveSeq(type, id, seq, up) {
  document.forms[0].groupType.value = type;
  document.forms[0].groupId.value = id;
  document.forms[0].groupSeq.value = seq;
  document.forms[0].moveUp.value = up;
}

function controlBox2() {
    var listenPort = false;
    var listenToThisHost = true;
    var listenToThisPort = true;
    if (document.forms[0].listen[1].checked) {
        listenPort = true;
        listenToThisHost = false;
        listenToThisPort = false;
    }
    document.forms[0].listenPort.disabled=listenPort;
    document.forms[0].listenToThisHost.disabled=listenToThisHost;
    document.forms[0].listenToThisPort.disabled=listenToThisPort;
}

function controlBox3() {
    var realHost = false;
    var realPort = false;
    var mtaRealHost = true;
    var mtaRealPort = true;
    var mtaRealProcess = true;
    var mtaRealHosts = true;
    var mtaRoutingDomain = true;
    if (document.forms[0].routing[1].checked) {
        realHost = true;
        realPort = true;
        mtaRealHost = false;
        mtaRealPort = false;
        mtaRealProcess = true;
        mtaRealHosts = true;
        mtaRoutingDomain = true;
    }
    else if (document.forms[0].routing[2].checked) {
        realHost = true;
        realPort = true;
        mtaRealHost = true;
        mtaRealPort = true;
        mtaRealProcess = false;
        mtaRealHosts = false;
        mtaRoutingDomain = true;
    }
    else if (document.forms[0].routing[3].checked) {
        realHost = true;
        realPort = true;
        mtaRealHost = true;
        mtaRealPort = true;
        mtaRealProcess = true;
        mtaRealHosts = true;
        mtaRoutingDomain = true;
    }
    else if (document.forms[0].routing[4].checked) {
        realHost = true;
        realPort = true;
        mtaRealHost = true;
        mtaRealPort = true;
        mtaRealProcess = true;
        mtaRealHosts = true;
        mtaRoutingDomain = false;
    }
    document.forms[0].realHost.disabled=realHost;
    document.forms[0].realPort.disabled=realPort;
    document.forms[0].mtaRealHost.disabled=mtaRealHost;
    document.forms[0].mtaRealPort.disabled=mtaRealPort;
    document.forms[0].mtaRealHosts.disabled=mtaRealHosts;
    document.forms[0].mtaRoutingDomain.disabled=mtaRoutingDomain;
    document.forms[0].mtaRealProcess[0].disabled=mtaRealProcess;
    document.forms[0].mtaRealProcess[1].disabled=mtaRealProcess;
}

function convertToCharCode(source) {
  result = '';
  for (i=0; i<source.length; i++)
    result += source.charCodeAt(i) + ',';
  return result;
}


function checkboxSelectedSingle(obj, noSelectedMsg, tooManySelectedMsg) {
    return checkboxSelected(obj, noSelectedMsg, true, tooManySelectedMsg)
}

function checkboxSelectedMultiple(obj, noSelectedMsg) {
    return checkboxSelected(obj, noSelectedMsg, false, null)
}

function checkboxSelected(obj, noSelectedMsg, single, tooManySelectedMsg) {
    var checked;
    var declared;
    var i;
    var numBoxesChecked = 0;

    if (obj == null) {
        return false;
    }
    else if ((obj.length == declared) && (obj.checked == true)) {
        return true;
    }
    else if ((obj.length == declared) && (obj.checked == false)) {
        alert(noSelectedMsg);
        return false;
    }
    else {
        for( i = 0; i < obj.length; i++) {
            if(obj[i].checked == true) {
                numBoxesChecked++;
            }

            if(numBoxesChecked > 2) {
               break;
            }
        }

        if (single) {
            if(numBoxesChecked == 1) {
                return true;
            }
            else if (numBoxesChecked > 1) {
                alert(tooManySelectedMsg);
                return false;
            }
            else {
                alert(noSelectedMsg);
                return false;
            }
        }
        else {
            if(numBoxesChecked > 0) {
                return true;
            }
            else {
                alert(noSelectedMsg);
                return false;
            }
        }
    }
    return false;
}

function isEmpty(str) {
    if (str == null) {
        return true;
    }
    for (i=0; i < str.length; i++) {
        if (str.charAt(i) != ' ') {
            return false;
        }
    }
    return true;
}

//-->


