var ns4 = (document.layers)? true:false;

var winW = 420;
var winH = 420;

if (ns4) {
    sW = screen.availWidth;
    sH = screen.availHeight;
} else {
    sH = screen.height;
    sW = screen.width;
}

var winX = sW - winW;
var winY = (sH / 2) - (winH / 2);

function openWin (url, name, winWidth, winHeight) {
  if(!winWidth) winWidth = "420";
  if(!winHeight) winHeight = "420";
  return window.open(url, name, "width="+winWidth+",height="+winHeight+",scrollbars=no,top="+winY+",left="+winX);
}

function showSignatur () {
  openWin("email_signatur.php?alias=" +
    document.mail_form.from.options[document.mail_form.from.selectedIndex].value,
    "signatur_window","450","280");
}

function showAdBook (type) {
  openWin("email_adbook.php?type=" + type,
  "addAB","260","250");
}

function setStdEmail () {
  openWin("email_setstdemail.php?alias=" +
    document.mail_form.from.options[document.mail_form.from.selectedIndex].value,
    "setStdEmail_window","260","150");
}

function addAB (select, type) {
        var target = document.mail_form[type];
        for (var i = 0; i < select.length; i++) {
                if (select.options[i].selected) {
                        if (target.value != '')
                                target.value += ', ';
                        target.value += select.options[i].text;
                        select.options[i].selected = false;
                }
        }
}

var checkAll = true;
function deActivateAll () {
  var i;
  if ( document.del_form.ids.length )
    for (i = 0; i < document.del_form.ids.length; i++)
      document.del_form.ids[i].checked = checkAll
  else
    document.del_form.ids.checked = checkAll
  checkAll = (checkAll) ? false : true
}

//function submitAttachForm(attachmentId, inLine) {
//  theForm = document.getElementById("attachForm")
//  theForm.attachmentNumber.value = attachmentId
//  if(inLine) {
//    theForm.target = "_blank";
//  }
//  theForm.submit()
//}
function submitAttachForm(attachmentId, inLine) {
  document.attachForm.attachmentNumber.value = attachmentId
  if(inLine) {
    document.attachForm.target = "_blank";
  }
  document.attachForm.submit()
}

function submitReplyForm() {
  document.replyForm.submit();
}

function submitForwardForm() {
  document.forwardForm.submit();
}




