
function checkBrowser() {
  this.ver = navigator.appVersion;
  this.dom = document.getElementById?1:0;
  this.ie4 = (document.all && !this.dom)?1:0;
  this.ie5 = (this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
  this.ns4 = (document.layers && !this.dom)?1:0;
  this.ns5 = (this.dom && parseInt(this.ver)>=5)?1:0;
  this.dyn = (this.ie4||this.ie5||this.ns4||this.ns5);
  return this;
}

function showHelp(topic, sub) {
  if (sub == undefined) sub = 0;
  if ((typeof(pophlp)=="object") && (typeof(pophlp.document)=="object")) pophlp.close();
  var url = ((sub==1)?"../":"./") + "help.php?id=" + topic;
  pophlp = window.open(url, "HELP", "width=400,height=400,scrollbars,resizable");
}

function showGraph(type, args) {
  if ((typeof(popgraph)=="object") && (typeof(popgraph.document)=="object")) popgraph.close();
  var url = "graph_" + type + ".php?sx=800&sy=400&curdate=" + args;
  popgraph = window.open(url, "GRAPHIQUE", "width=820,height=420,scrollbars,resizable");
}

function showAddress(ref) {
  if ((typeof(popadd)=="object") && (typeof(popadd.document)=="object")) popadd.close();
  var url = "address_part.php" + ((ref==1)?"?SELECT":"");
  popadd = window.open(url, "CONTACTS", "width=650,height=600,scrollbars,resizable,status=0");
}

function addAddress(adr) {
  var actual = document.frm.ADRESSE.value;
  if (actual != "") actual = actual + "; ";
  document.frm.ADRESSE.value = actual + adr;
}

function toggle(isChecked) {
  for (i=0; i<document.frm.elements.length; i++)
    document.frm.elements[i].checked = isChecked;
}

function countLength(field) {
  var obj = eval("document.frm."+field);
  var nb = obj.value.length;
  alert("Ce champs comporte "+nb+" caractère(s)");
}

function genPwd(sub, field, ndeb, nfin) {
  if (field == undefined) field = "PASSWD";
  if (sub   == undefined) sub   = 0;
  if (ndeb  == undefined) ndeb  = 0;
  if (nfin  == undefined) nfin  = 0;
//if ((typeof(poppwd)=="object") && (typeof(poppwd.document)=="object")) poppwd.close();
  var url = "gen_passwd.php?field=" + field + "&ndeb=" + ndeb + "&nfin=" + nfin;
  poppwd = window.open(url, "PASSWD", "width=10,height=10");
}


function loginHorde(user) {
  if (user == 1) {
    var url = "http://webmail.proxymx.net/imp/logout.php?logout_reason=logout";
    window.open(url, "HORDE", "width=800,height=600,scrollbars,resizable,status");
    var delay = 2000;
    setTimeout('document.frm.submit();', delay);
  } else {
    var url = "http://webmail.proxymx.net";
    window.open(url, "HORDE", "width=800,height=600,scrollbars,resizable,status");
  }
}

// -------------------------------------------------------------------------

