
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 openBack() {
  var url = "http://backup.neotelecoms.com/obs/user/logon.do?locale=fr";
  var opt = "toolbar=no,status=yes,scrollbars=yes,resizable=no,location=no,width=650,height=550";
  window.open(url, "NEOT", opt);
}


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?curdate=" + args;
  popgraph = window.open(url, "GRAPHIQUE", "width=620,height=370,scrollbars,resizable");
}

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

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 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 = ((sub==1)?"../":"./") + "gen_passwd.php?field=" + field + "&ndeb=" + ndeb + "&nfin=" + nfin;
  poppwd = window.open(url, "PASSWD", "width=10,height=10");
}

