/* Fonction empechant le rafraichissement d'une page via la touche F5
==================================================================*/
function test_f5(e) { 
  var layers = false;
  var ie4 = (document.all) ? true : false;
  var ns6 = (document.getElementById&&!document.all) ? true : false;
  if (ie4 || ns6) {layers = true;} 

  var val="";

  if(ie4)  {
    val="K"+window.event.keyCode;
    if (val == "K116") { 
      window.close();
    } else {
      return true; 
    }
  }
  
  if (ns6) {
    val="K"+e.which;
    if (val == "K116") { 
      window.close();
    } else {
      return true; 
    }
  }
}


/*Copie d'un champ de formulaire dans un autre
==================================================================*/
function fieldCopy(sourceField,destField,formular) {
  document.forms[formular].elements[destField].value = document.forms[formular].elements[sourceField].value;
}

/*validation des Room Number (Fixed Access)
==================================================================*/
function verifRoomNumber(roomNumber) {
  var exp = new RegExp("^[0-9]+$","g");
  if ( exp.test(roomNumber) ) { return 0;}
  else {
    alert("The Room Number ("+roomNumber+") must be composed of digit!"); 
    return 1;
  }
}


/*validation des adresses
==================================================================*/
function verifMacAddresse(macAddr) {
  var exp=new RegExp("^([a-fA-F0-9]{2}[\:]{1}){5}[a-fA-F0-9]{2}$","g");
  var exp2=new RegExp("^([a-fA-F0-9]{2}[\-]{1}){5}[a-fA-F0-9]{2}$","g");
  var exp3=new RegExp("^[a-fA-F0-9]{12}$","g");
  
  
  if ( (exp.test(macAddr)) || (exp2.test(macAddr)) || (exp3.test(macAddr)) ) {
    return 0;
  } else {
    alert("The MAC Address format ("+macAddr+") is not valid ! Valid format: xx:xx:xx:xx:xx:xx or xx-xx-xx-xx-xx-xx or xxxxxxxxxxxx"); 
    return 1;
  }
}    
    

/* Positionnement d'une adresse MAC (ayant l'un des trois formats précédents acceptés) au format de la base de données
=======================================================================================================================*/
function macTransform(macAddr) {
  var finalMac_ ;
  
  /* Format 1: xx:xx:xx:xx:xx:xx */
  if (macAddr.indexOf(":",0) != -1) {
    var reg = new RegExp("(:)", "g");
    finalMac_ = macAddr.replace(reg,"-");
  } else {
    if (macAddr.indexOf("-",0) != -1) {
      finalMac_= macAddr;
    } else {
      finalMac_ = macAddr.substring(0,2)+"-"+macAddr.substring(2,4)+"-"+macAddr.substring(4,6)+"-"+macAddr.substring(6,8)+"-"+macAddr.substring(8,10)+"-"+macAddr.substring(10,12);
    }
  }
  return finalMac_.toLowerCase();
}

/*validation des e-mail
==================================================================*/
function verifMail(email) {
  //var exp = new RegExp("^[a-zA-Z0-9\-_]+[a-zA-Z0-9\.\-_]*@[a-zA-Z0-9\-_]+\.[a-zA-Z\.\-_]{1,}[a-zA-Z\-_]+","g");
  var exp = new RegExp("^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]{2,}[.][a-zA-Z]{2,3}$","g");
  if ( exp.test(email) ) { 
    return 0;
  } else {
    alert("The e-mail format ("+email+") is not valid ! Valid format: xxx@xxx.xxx"); 
    return 1;
  }
}

/*validation des dates
==================================================================*/
function isNaNAllia(d){
  for(var i=0; i < d.length ; i++) {
    eval=(( d.charCodeAt(i) >= 48 ) && ( d.charCodeAt(i) <= 57 ));
    if(! eval) {
       return true;
    }	
  }
  return false;
}

function checkDate(d) {
      var separateur="/"; 
      var a=(d.substring(0,4));
      var m=(d.substring(5,7));
      var j=(d.substring(8));
      var sep1=(d.substring(4,5));
      var sep2=(d.substring(7,8));
      var ok=1;
      var phrase="Date format is AAAA/MM/JJ"; 
      
      if ( ((isNaN(j))||(j<1)||(j>31)) && (ok==1) ) {
         alert(phrase); ok=0;
      }
      if ( ((isNaN(m))||(m<1)||(m>12)) && (ok==1) ) {
         alert(phrase); ok=0;
      }
      if ( ((d.substring(4,5)!=separateur)||(d.substring(7,8)!=separateur)) && (ok==1) ) {
         alert(phrase); ok=0;
      }
     
     return ok;
}
function checkDate(d,msg) {
      var separateur="/"; 
      var a=(d.substring(0,4));
      var m=(d.substring(5,7));
      var j=(d.substring(8));
      var sep1=(d.substring(4,5));
      var sep2=(d.substring(7,8));
      var ok=1;
      var phrase=msg;//+", Date format AAAA/MM/JJ"; 
      
      if ( ((isNaN(j))||(j<1)||(j>31)) && (ok==1) ) {
         alert(phrase + "\nDay is not correct."); ok=0;
      }
      if ( ((isNaN(m))||(m<1)||(m>12)) && (ok==1) ) {
         alert(phrase + "\nMonth is not correct."); ok=0;
      }
      if ( ((isNaN(a))||(a<1900)||(a>2500)) ) {
        alert(phrase + "\nYear is not correct."); ok=0;
      }
      if ( ((d.substring(4,5)!=separateur)||(d.substring(7,8)!=separateur)) && (ok==1) ) {
         alert(phrase +"\nSeparator should be "+separateur); ok=0;
      }
     
     return ok;
}

/*contractstatus
==================================================================*/
function contractstatuscreate(){
 var STA_CODE=document.contractstatuscreateform.STA_CODE.value;
 if((STA_CODE)==''){
  alert("Status must not be null");
  return;
 }

 document.contractstatuscreateform.submit();
}
function contractstatusdelete(){
 if(confirm("Confirm deletion ?")) {
  document.contractstatusupdateform.updateOrDeleted.value='Delete';
  document.contractstatusupdateform.submit();
 }
}
function contractstatusupdate(){
 if((document.contractstatusupdateform.STA_CODE.value)==''){
  alert("Status must not be null");
  return;
 }
 document.contractstatusupdateform.updateOrDeleted.value='Update';
 if(confirm("Confirm update ?")) {
  document.contractstatusupdateform.submit();
 }
}



/*telcoservice
==================================================================*/
function telcoservicecreate(){
 if((document.telcoservicecreateform.TSI_CODE.value)==''){
  alert("Code must not be null");
  return;
 }
 if(isNaN(document.telcoservicecreateform.TSI_SUF.value)==true){
  alert("Set up must be int"); 
  return;
 }
 if(isNaN(document.telcoservicecreateform.TSI_MRFC.value)==true){
  alert("Recouring fix cost must be int");
  return;
 }
 if(isNaN(document.telcoservicecreateform.TSI_MMC.value)==true){
  alert("Maintenance cost must be int");
  return;
 }
 document.telcoservicecreateform.submit();
}

function telcoservicedelete(){
 document.telcoserviceupdateform.updateOrDeleted.value='Delete';
 if(confirm("Confirm deletion ?")) {
  document.telcoserviceupdateform.submit();
 }
}

function telcoserviceupdate(){
 if((document.telcoserviceupdateform.TSI_CODE.value)==''){
  alert("Code must not be null");
  return;
 }
 if(isNaN(document.telcoserviceupdateform.TSI_SUF.value)==true){
  alert("Set up must be int"); 
  return;
 }
 if(isNaN(document.telcoserviceupdateform.TSI_MRFC.value)==true){
  alert("Recouring fix cost must be int");
  return;
 }
 if(isNaN(document.telcoserviceupdateform.TSI_MMC.value)==true){
  alert("Maintenance cost must be int");
  return;
 }
 document.telcoserviceupdateform.updateOrDeleted.value='Update';
 if(confirm("Confirm update ?")) {
  document.telcoserviceupdateform.submit();
 }
}

/*hotspotaddservice
==================================================================*/
/*
function hotspotaddservice(){ 
 var ok=0;
 if( (document.hotspotaddserviceform.SRV_DESCRIPTION.value)=='' ){
  alert("Name must not be null");
  return;
 }
 ok=checkDate(document.hotspotaddserviceform.SRV_CODATE.value);
 if(ok==0){
   return;
 }
 ok=checkDate(document.hotspotaddserviceform.SRV_PODATE.value);
 if(ok==0){
   return;
 }
 ok=checkDate(document.hotspotaddserviceform.SRV_AODATE.value);
 if(ok==0){
   return;
 }
 ok=checkDate(document.hotspotaddserviceform.SRV_BILLING_DATE.value);
 if(ok==0){
   return;
 }
 if(ok==1){
 //Dates valide
   document.hotspotaddserviceform.submit();
 }
 
}
**/

function hotspotservicesubmit(actionUrl){
   document.hotspotupdateform.action=actionUrl;
   document.hotspotupdateform.submit();
}


/*afficher une popup
==================================================================*/
function browseropen(bUrl, bName, bWidth, bHeight){
 var tragerturl;
 if(bUrl.indexOf("http://")<0){
   tragerturl="http://"+bUrl;
 }else{
   tragerturl=bUrl;
 }
 bNavigatorName = navigator.appName;
 bNavigatorVer = parseInt(navigator.appVersion);
 var viewerpop = window.open(tragerturl,bName,'location=yes,toolbar=yes,directories=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,width='+bWidth+',height='+bHeight);
 if( bNavigatorName == "Netscape" && bNavigatorVer >= 3 )
  viewerpop.focus();
 else 
  if( bNavigatorName=="Microsoft Internet Explorer" && bNavigatorVer > 3 )
  viewerpop.focus();
 }


function windowopen(bUrl, bName, bWidth, bHeight){
  var tragerturl;
  if(bUrl.indexOf("http://")<0){
   tragerturl="http://"+bUrl;
  }else{
   tragerturl=bUrl;
  }
  bNavigatorName = navigator.appName;
  bNavigatorVer = parseInt(navigator.appVersion);
  var viewerpop = window.open(tragerturl,bName,'location=no,toolbar=no,directories=no,menubar=no,resizable=no,scrollbars=no,status=no,width='+bWidth+',height='+bHeight);
  if( bNavigatorName == "Netscape" && bNavigatorVer >= 3 )
     viewerpop.focus();
  else 
   if( bNavigatorName=="Microsoft Internet Explorer" && bNavigatorVer > 3 )
     viewerpop.focus();
 }

function puopen(bUrl, bName, bWidth, bHeight){
  bNavigatorName = navigator.appName;
  bNavigatorVer = parseInt(navigator.appVersion);
  
  var urlCible='';
    
  if (bUrl.indexOf("travailencours.html+")==0)
    urlCible= "/wisd/intranet/travailencours.html";
  else
    urlCible=bUrl; 	 
    
  var viewerpop = window.open(urlCible, bName,'location=no,toolbar=no,directories=no,menubar=no,resizable=yes,scrollbars=yes,status=no,width='+bWidth+',height='+bHeight);
 
  if( bNavigatorName == "Netscape" && bNavigatorVer >= 3 )
    viewerpop.focus();
  else 
    if( bNavigatorName=="Microsoft Internet Explorer" && bNavigatorVer > 3 )
      viewerpop.focus();
    
  if (bUrl.indexOf("travailencours.html+")==0){
    while (1){
      if (viewerpop.termine) break;
    }  
    viewerpop.location.href = bUrl.substr(20);
  }
  
 
}

function popupopen(bUrl, bName, bWidth, bHeight){
 bNavigatorName = navigator.appName;
 bNavigatorVer = parseInt(navigator.appVersion);
 var viewerpop = window.open(bUrl,bName,'location=no,toolbar=no,directories=no,menubar=no,resizable=yes,scrollbars=yes,status=no,width='+bWidth+',height='+bHeight);
 if( bNavigatorName == "Netscape" && bNavigatorVer >= 3 )
  viewerpop.focus();
 else 
  if( bNavigatorName=="Microsoft Internet Explorer" && bNavigatorVer > 3 )
  viewerpop.focus();
 }
function parantreload(){
   window.opener.location.reload();
}
function closemeandreloadmyparant(){
  window.opener.location.reload();
  this.close();
}
/*Contract type
==================================================================*/
function contracttypecreate(){
 if((document.contracttypecreateform.CTT_CODE.value)==''){
  alert("Code must not be null");
  return;
 }
 if (document.contracttypecreateform.CTT_COMMENT.value.length > 99) {
  alert("Comment must have less than 100 ");
  return;
 }  
  document.contracttypecreateform.submit();
}

function contracttypeupdate(){
 if((document.contracttypeupdateform.CTT_CODE.value)==''){
  alert("Code must not be null");
  return;
 }
 document.contracttypeupdateform.updateOrDeleted.value='Update';
 if(confirm("Confirm update ?")) {
  document.contracttypeupdateform.submit();
 }
}
function contracttypedelete(){
 document.contracttypeupdateform.updateOrDeleted.value='Delete';
 if(confirm("Confirm deletion ?")) {
  document.contracttypeupdateform.submit();
 }
}
/*contract
==================================================================*/

function contractdelete(){
 document.contractupdateform.updateOrDeleted.value='Delete';
 if(confirm("Confirm deletion ?")) {
  document.contractupdateform.submit();
 }
}

function contractupdate(){
 if( (document.contractupdateform.COP_NAME.value)=='' ){
  alert("Name must not be null");
  return;
 }
 var COP_CREDATE=document.contractupdateform.COP_CREDATE.value;
 if(COP_CREDATE!=''){
   ok=checkDate(COP_CREDATE);
   if(ok==0){
     return;
    }
 }
 var COP_SENDATE=document.contractupdateform.COP_SENDATE.value;
 if(COP_SENDATE!=''){
   ok=checkDate(COP_SENDATE);
   if(ok==0){
     return;
   }
 }
 var COP_ENDATE=document.contractupdateform.COP_ENDATE.value;
 if(COP_ENDATE!=''){
   ok=checkDate(COP_ENDATE);
   if(ok==0){
     return;
   }
 }
 var COP_DURATION =document.contractupdateform.COP_DURATION.value;
 if((COP_DURATION!='')&&(isNaN(COP_DURATION)==true)){
  alert("Duration must be int");
  return;
 }
 if(confirm("Confirm update ?")) {
   document.contractupdateform.updateOrDeleted.value='Update';
   document.contractupdateform.submit();
  }
}


/*Contact
==================================================================*/
function contactcreate(){
  if (checkcreateForm()==1) {
    document.contactcreateform.submit();
  }
}

function checkcreateForm(){ 
  if( (document.contactcreateform.CNT_NAME.value)=='' ){
    alert("Name must not be null");
    return;
  }
  if( (document.contactcreateform.OWN_ID.value)=='' ){
    alert("Legal Entity must not be null");
    return;
  }
  if( (document.contactcreateform.LOC_ID.value)=='' ){
    alert("Location must not be null");
    return;
  }
  return 1;
}

function checkupdateForm(){ 
  if( (document.contactupdateform.CNT_NAME.value)=='' ){
    alert("Name must not be null");
    return;
  }
  if( (document.contactupdateform.OWN_ID.value)=='' ){
    alert("Legal Entity must not be null");
    return;
  }
  if( (document.contactupdateform.LOC_ID.value)=='' ){
    alert("Location must not be null");
    return;
  }
  return 1;
}

function contactdelete(){
 document.contactupdateform.updateOrDeleted.value='Delete';
 if(confirm("Confirm deletion ?")) {
  document.contactupdateform.submit();
 }
}

function contactupdate(){
  if (checkupdateForm()==1) {
    if(confirm("Confirm update ?")) {
      document.contactupdateform.updateOrDeleted.value='Update';
      document.contactupdateform.submit();
    }
  }
}


/*Contact function
==================================================================*/
function contactfunctioncreate(){
 if((document.contactfunctioncreateform.FUN_NAME.value)==''){
  alert("Name must not be null");
  return;
 }
 document.contactfunctioncreateform.submit();
}
function contactfunctiondelete(){
 document.contactfunctionupdateform.updateOrDeleted.value='Delete';
 if(confirm("Confirm deletion ?")) {
  document.contactfunctionupdateform.submit();
 }
}
function contactfunctionupdate(){
 if((document.contactfunctionupdateform.FUN_NAME.value)==''){
  alert("Name must not be null");
  return;
 }
 document.contactfunctionupdateform.updateOrDeleted.value='Update';
 if(confirm("Confirm update ?")) {
  document.contactfunctionupdateform.submit();
 }
}
/*user function
==================================================================*/
function userfunctioncreate(){
 if((document.userfunctioncreateform.EUF_NAME.value)==''){
  alert("Function must not be null");
  return;
 }
 document.userfunctioncreateform.submit();
}
function userfunctiondelete(){
 document.userfunctionupdateform.updateOrDeleted.value='Delete';
 if(confirm("Confirm deletion ?")) {
  document.userfunctionupdateform.submit();
 }
}
function userfunctionupdate(){
 if((document.userfunctionupdateform.EUF_NAME.value)==''){
  alert("Function must not be null");
  return;
 }
 document.userfunctionupdateform.updateOrDeleted.value='Update';
 if(confirm("Confirm update ?")) {
  document.userfunctionupdateform.submit();
 }
}
/*Equipment type
==================================================================*/
function equipmenttypecreate(){
 if((document.equipmenttypecreateform.TEQ_DESCR.value)==''){
  alert("Description must not be null");
  return;
 }
  document.equipmenttypecreateform.submit();
}
function equipmenttypedelete(){
 document.equipmenttypeupdateform.updateOrDeleted.value='Delete';
 if(confirm("Confirm deletion ?")) {
  document.equipmenttypeupdateform.submit();
 }
}
function equipmenttypeupdate(){
 if((document.equipmenttypeupdateform.TEQ_DESCR.value)==''){
  alert("Type must not be null");
  return;
 }
 document.equipmenttypeupdateform.updateOrDeleted.value='Update';
 if(confirm("Confirm update ?")) {
  document.equipmenttypeupdateform.submit();
 }
}

/*Supplier
==================================================================*/
function supplierupdate(){
 if((document.supplierupdateform.VDR_NAME.value)==''){
  alert("Vendor name must not be null");
  return;
 }
 if((document.supplierupdateform.VDR_NUMBER.value!='')&&(isNaN(document.supplierupdateform.VDR_NUMBER.value)==true)){
  alert("N° must be int"); 
  return;
 }
 document.supplierupdateform.updateOrDeleted.value='Update';
 if(confirm("Confirm update ?")) {
   document.supplierupdateform.submit();
 }
}
function supplierdelete(){
 document.supplierupdateform.updateOrDeleted.value='Delete';
 if(confirm("Confirm deletion ?")) {
  document.supplierupdateform.submit();
 }
}
function suppliercreate(){
 if((document.suppliercreateform.VDR_NAME.value)==''){
  alert("Vendor name must not be null");
  return;
 }
 if((document.suppliercreateform.VDR_NUMBER.value!='')&&(isNaN(document.suppliercreateform.VDR_NUMBER.value)==true)){
  alert("N° must be int"); 
  return;
 }
 document.suppliercreateform.submit();
}
function submitSupplier(){
 document.supplierform.submit();
}
/*Owner
==================================================================*/
//function ownerupdate(){
// document.ownerupdateform.updateOrDeleted.value='Update';
// if(confirm("Confirm update ?")) {
//   document.ownerupdateform.submit();
// }
//}
//function ownerdelete(){
// document.ownerupdateform.updateOrDeleted.value='Delete';
// if(confirm("Confirm deletion ?")) {
//  document.ownerupdateform.submit();
// }
//}
//function ownercreate(){
//if((isNaN(document.ownercreateform.VDR_NUMBER.value)==true)||(document.ownerercreateform.VDR_NUMBER.value=='')){
//  alert("N° must be int"); 
//  return;
// }
// if((isNaN(document.ownercreateform.VDR_INSTA.value)==true)||(document.ownercreateform.VDR_INSTA.value=='')){
//  alert("Vendor insta must be int");
//  return;
// }
// if((document.ownercreateform.VDR_NAME.value)==''){
//  alert("Vendor name must not be null");
//  return;
// }
// document.ownercreateform.submit();
//}
//function submitOwner(){
// document.ownerform.submit();
//}
/*Hotspot
==================================================================*/
function hotspotupdate(){
 document.hotspotupdateform.updateOrDeleted.value='Update';
 if(confirm("Confirm update ?")) {
   document.hotspotupdateform.submit();
 }
}
function hotspotdelete(){
 document.hotspotupdateform.updateOrDeleted.value='Delete';
 if(confirm("Confirm deletion ?")) {
  document.hotspotupdateform.submit();
 }
}
function hotspotcreate(){
 if((document.hotspotcreateform.RAT_ID.value)==''){
  alert("Rating must not be null - Please select one");
  return;
 }
 if((document.hotspotcreateform.STA_ID.value)==''){
  alert("Status must not be null - Please select one");
  return;
 }
 if((document.hotspotcreateform.COP_ID.value)==''){
  alert("Contract must not be null - Please select one");
  return;
 }
 if((document.hotspotcreateform.HTY_ID.value)==''){
  alert("Type must not be null - Please select one");
  return;
 }
 document.hotspotcreateform.submit();
}
/*Location
==================================================================*/
function locationupdate(){
 document.locationupdateform.updateOrDeleted.value='Update';
 if(confirm("Confirm update ?")) {
   document.locationupdateform.submit();
 }
}
function locationdelete(){
 document.locationupdateform.updateOrDeleted.value='Delete';
 if(confirm("Confirm deletion ?")) {
  document.locationupdateform.submit();
 }
}
function locationcreate(){
if((isNaN(document.locationcreateform.VDR_NUMBER.value)==true)||(document.locationcreateform.VDR_NUMBER.value=='')){
  alert("N° must be int"); 
  return;
 }
 if((isNaN(document.locationcreateform.VDR_INSTA.value)==true)||(document.locationcreateform.VDR_INSTA.value=='')){
  alert("Vendor insta must be int");
  return;
 }
 if((document.locationcreateform.VDR_NAME.value)==''){
  alert("Vendor name must not be null");
  return;
 }
 document.locationcreateform.submit();
}
function submitLocation(){
 document.loactionform.submit();
}
/*task type
==================================================================*/
function tasktypereset(){
 document.tasktypecreateform.TTY_DESCR.value='';
 return;
}
function tasktypecreate(){
 if((document.tasktypecreateform.TTY_DESCR.value)==''){
  alert("Type must not be null");
  return;
 }
 document.tasktypecreateform.submit();
}
function tasktypedelete(){
 document.tasktypeupdateform.updateOrDeleted.value='Delete';
 if(confirm("Confirm deletion ?")) {
  document.tasktypeupdateform.submit();
 }
}
function tasktypeupdate(){
 if((document.tasktypeupdateform.TTY_DESCR.value)==''){
  alert("Tyope must not be null");
  return;
 }
 document.tasktypeupdateform.updateOrDeleted.value='Update';
 if(confirm("Confirm update ?")) {
  document.tasktypeupdateform.submit();
 }
}
/*currency
==================================================================*/
function currencycreate(){
 if((document.currencycreateform.CUR_NAME.value)==''){
  alert("Name must not be null");
  return;
 }
 document.currencycreateform.submit();
}

function currencydelete(){
 document.currencyupdateform.updateOrDeleted.value='Delete';
 if(confirm("Confirm deletion ?")) {
  document.currencyupdateform.submit();
 }
}
function currencyupdate(){
 if((document.currencyupdateform.CUR_NAME.value)==''){
  alert("Name must not be null");
  return;
 }
 document.currencyupdateform.updateOrDeleted.value='Update';
 if(confirm("Confirm update ?")) {
  document.currencyupdateform.submit();
 }
}

/*hotspottype
==================================================================*/
function hotspottypecreate(){
 if((document.hotspottypecreateform.HTY_DESCR.value)==''){
  alert("Type must not be null");
  return;
 }
 document.hotspottypecreateform.submit();
}
function hotspottypedelete(){
 document.hotspottypeupdateform.updateOrDeleted.value='Delete';
 if(confirm("Confirm deletion ?")) {
  document.hotspottypeupdateform.submit();
 }
}
function hotspottypeupdate(){
 if((document.hotspottypeupdateform.HTY_DESCR.value)==''){
  alert("Type must not be null");
  return;
 }
 document.hotspottypeupdateform.updateOrDeleted.value='Update';
 if(confirm("Confirm update ?")) {
  document.hotspottypeupdateform.submit();
 }
}
/*revenuesharing
==================================================================*/
function commissiontypecreate(){
 if((document.commissiontypecreateform.COT_CODE.value)==''){
  alert("Type must not be null");
  return;
 }
 if((document.commissiontypecreateform.COT_COMMENT.value)==''){
  alert("Description must not be null");
  return;
 }
  document.commissiontypecreateform.submit();
}
function commissiontypedelete(){
 document.commissiontypeupdateform.updateOrDeleted.value='Delete';
 if(confirm("Confirm deletion ?")) {
  document.commissiontypeupdateform.submit();
 }
}
function commissiontypeupdate(){
 if((document.commissiontypeupdateform.COT_CODE.value)==''){
  alert("Code must not be null");
  return;
 }
 if((document.commissiontypeupdateform.COT_COMMENT.value)==''){
  alert("Description must not be null");
  return;
 }
 document.commissiontypeupdateform.updateOrDeleted.value='Update';
 if(confirm("Confirm update ?")) {
  document.commissiontypeupdateform.submit();
 }
}
/*hotspotstatus
==================================================================*/
function hotspotstatuscreate(){
 var STA_HOT_DESCR=document.hotspotstatuscreateform.STA_HOT_DESCR.value;
 if((STA_HOT_DESCR)==''){
  alert("Status must not be null");
  return;
 }

 document.hotspotstatuscreateform.submit();
}
function hotspotstatusdelete(){
 if(confirm("Confirm deletion ?")) {
  document.hotspotstatusupdateform.updateOrDeleted.value='Delete';
  document.hotspotstatusupdateform.submit();
 }
}
function hotspotstatusupdate(){
 if((document.hotspotstatusupdateform.STA_HOT_DESCR.value)==''){
  alert("Status must not be null");
  return;
 }
 document.hotspotstatusupdateform.updateOrDeleted.value='Update';
 if(confirm("Confirm update ?")) {
  document.hotspotstatusupdateform.submit();
 }
}
/*hotspotrating
==================================================================*/
function hotspotratingreset(){
 document.hotspotratingcreateform.RAT_DESCR.value='';
 return;
}
function hotspotratingcreate(){
 if((document.hotspotratingcreateform.RAT_DESCR.value)==''){
  alert("Rating must not be null");
  return;
 }
 document.hotspotratingcreateform.submit();
}
function hotspotratingdelete(){
 document.hotspotratingupdateform.updateOrDeleted.value='Delete';
 if(confirm("Confirm deletion ?")) {
  document.hotspotratingupdateform.submit();
 }
}
function hotspotratingupdate(){
 if((document.hotspotratingupdateform.RAT_DESCR.value)==''){
  alert("Description must not be null");
  return;
 }
 document.hotspotratingupdateform.updateOrDeleted.value='Update';
 if(confirm("Confirm update ?")) {
  document.hotspotratingupdateform.submit();
 }
}

/*networkobject
==================================================================*/
function networkobjectcreate(){ 
 if( (document.networkobjectcreateform.NOB_MODEL.value)=='' ){
  alert("Model must not be null");
  return;
 }
 var NOB_SUF =document.networkobjectcreateform.NOB_SUF.value;
 if((NOB_SUF!='')&&(isNaN(NOB_SUF)==true)){
  alert("Set Up  must be int");
  return;
 }
 var NOB_MMC =document.networkobjectcreateform.NOB_MMC.value;
 if((NOB_MMC!='')&&(isNaN(NOB_MMC)==true)){
  alert("Maintenance cost must be int");
  return;
 }
 
 var NOB_MRFC =document.networkobjectcreateform.NOB_MRFC.value;
 if((NOB_MRFC!='')&&(isNaN(NOB_MRFC)==true)){
  alert(" Recuring Fix cost must be int");
  return;
 }
 var NOB_INVEST =document.networkobjectcreateform.NOB_INVEST.value;
 if((NOB_INVEST!='')&&(isNaN(NOB_INVEST)==true)){
  alert("Investment cost must be int");
  return;
 }
 var NOB_PORTS =document.networkobjectcreateform.NOB_PORTS.value;
 if((NOB_PORTS!='')&&(isNaN(NOB_PORTS)==true)){
  alert("Total Ports must be int");
  return;
 }
 document.networkobjectcreateform.submit();
 
}
function networkobjectdelete(){
 document.networkobjectupdateform.updateOrDeleted.value='Delete';
 if(confirm("Confirm deletion ?")) {
    document.networkobjectupdateform.submit();
 }
}

function networkobjectupdate(){
 if( (document.networkobjectupdateform.NOB_MODEL.value)=='' ){
  alert("Model must not be null");
  return;
 }
 var NOB_SUF =document.networkobjectupdateform.NOB_SUF.value;
 if((NOB_SUF!='')&&(isNaN(NOB_SUF)==true)){
  alert("Set Up  must be int");
  return;
 }
 var NOB_MMC =document.networkobjectupdateform.NOB_MMC.value;
 if((NOB_MMC!='')&&(isNaN(NOB_MMC)==true)){
  alert("Maintenance cost must be int");
  return;
 }
 
 var NOB_MRFC =document.networkobjectupdateform.NOB_MRFC.value;
 if((NOB_MRFC!='')&&(isNaN(NOB_MRFC)==true)){
  alert(" Recuring Fix cost must be int");
  return;
 }
 var NOB_INVEST =document.networkobjectupdateform.NOB_INVEST.value;
 if((NOB_INVEST!='')&&(isNaN(NOB_INVEST)==true)){
  alert("Investment cost must be int");
  return;
 }
 var NOB_PORTS =document.networkobjectupdateform.NOB_PORTS.value;
 if((NOB_PORTS!='')&&(isNaN(NOB_PORTS)==true)){
  alert("Total Ports must be int");
  return;
 }
 if(confirm("Confirm update ?")) {
  document.networkobjectupdateform.updateOrDeleted.value='Update';
  document.networkobjectupdateform.submit();
 }
}
/*eurospot servicetype
==================================================================*/
function euroservicetypecreate(){
 if((document.euroservicetypecreateform.SRT_TYPE.value)==''){
  alert("Type must not be null");
  return;
 }
 document.euroservicetypecreateform.submit();
}
function euroservicetypedelete(){
 document.euroservicetypeupdateform.updateOrDeleted.value='Delete';
 if(confirm("Confirm deletion ?")) {
  document.euroservicetypeupdateform.submit();
 }
}
function euroservicetypeupdate(){
 if((document.euroservicetypeupdateform.SRT_TYPE.value)==''){
  alert("Type must not be null");
  return;
 }
 if(confirm("Confirm update ?")) {
  document.euroservicetypeupdateform.updateOrDeleted.value='Update';
  document.euroservicetypeupdateform.submit();
 }
}


/*telco servicetype
==================================================================*/
function telcoservtypecreate(){
 if((document.telcoservtypecreateform.TTS_DESCR.value)==''){
  alert("Type must not be null");
  return;
 }
 document.telcoservtypecreateform.submit();
}
function telcoservtypedelete(){
 document.telcoservtypeupdateform.updateOrDeleted.value='Delete';
 if(confirm("Confirm deletion ?")) {
  document.telcoservtypeupdateform.submit();
 }
}
function telcoservtypeupdate(){
 if((document.telcoservtypeupdateform.TTS_DESCR.value)==''){
  alert("Type must not be null");
  return;
 }
 document.telcoservtypeupdateform.updateOrDeleted.value='Update';
 if(confirm("Confirm update ?")) {
  document.telcoservtypeupdateform.submit();
 }
}
/*countrycode
==================================================================*/
function countrycodecreate(){
 if((document.countrycodecreateform.CTY_CODE.value)==''){
  alert("Code must not be null");
  return;
 }
 if((document.countrycodecreateform.CTY_NAME.value)==''){
  alert("Name must not be null");
  return;
 }
 if((document.countrycodecreateform.CUR_ID.value)==''){
  alert("Currency must not be null");
  return;
 }
 if((document.countrycodecreateform.SCEO_ID.value)==''){
  alert("SCEO Office must not be null");
  return;
 }
 if((document.countrycodecreateform.LAN_ID.value)==''){
  alert("Language must not be null");
  return;
 }
 document.countrycodecreateform.submit();
}
function countrycodedelete(){
 document.countrycodeupdateform.updateOrDeleted.value='Delete';
 if(confirm("Confirm deletion ?")) {
  document.countrycodeupdateform.submit();
 }
}
function countrycodeupdate(){
 if((document.countrycodeupdateform.CTY_CODE.value)==''){
  alert("Code must not be null");
  return;
 }
 if((document.countrycodeupdateform.CTY_NAME.value)==''){
  alert("Name must not be null");
  return;
 }
 if((document.countrycodeupdateform.CUR_ID.value)==''){
  alert("Currency must not be null");
  return;
 }
 if((document.countrycodeupdateform.LAN_ID.value)==''){
  alert("Language must not be null");
  return;
 }
 document.countrycodeupdateform.updateOrDeleted.value='Update';
 if(confirm("Confirm update ?")) {
  document.countrycodeupdateform.submit();
 }
}
/* Ouverture pop-up simple
==================================================================*/
function openWindow(theURL,winName,features) { 
	window.open(theURL,winName,features);
}

/* Check validity of an Email address
==================================================================*/
function CheckEmail(email) {
	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars="\[^\\s" + specialChars + "\]"
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom=validChars + '+'
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
	var matchArray=email.match(emailPat)
	if (matchArray==null) {	return false; }
	var user=matchArray[1]
	var domain=matchArray[2]
	if (user.match(userPat)==null) { return false; }
	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) {
		for (var i=1;i<=4;i++) {
		    if (IPArray[i]>255) { return false; }
	    }
	    return true;
	}
	var domainArray=domain.match(domainPat)
	if (domainArray==null) { return false }
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) { return false; }
	if (len<2) { return false }
	return true;
}

/* Check validity of a date string
==================================================================*/
function CheckDate(datestring) {
	var datePat=/^(\d\d)[\-\.\\\/ ](\d\d)[\-\.\\\/ ](\d\d\d\d)$/
	if (datestring.match(datePat)==null) { return false; }
	var jour = datestring.substring(0,2);
	var mois = datestring.substring(3,5);
	var an = datestring.substring(6,10);
	var bBissextile = true;
	var bDateOK = false;
	if (!((an % 4) ==0)) bBissextile=false;
	else
	{
		if(!((an % 100)==0))
	      {
	      	bBissextile=true;
	      }
	      else
	      {
	      	if (!((an % 400)==0)) bBissextile=false;
	        else bBissextile=true;
	      }
	}
	if ((mois == "01" || mois =="03" || mois=="05" || mois=="07" || mois=="08" || mois=="10" || mois=="12") && (jour<=31))
	{
		bDateOK=true;
	}
	if((mois=="04" || mois=="06" || mois=="09" || mois=="11" ) && (jour<=30))
	{
		bDateOK=true;
	}
	if((mois=="02") && (bBissextile==true) && (jour<=29))
	{
		bDateOK=true;
	}
	if((mois=="02") && (bBissextile==false) && (jour<=28))
	{
		bDateOK=true;
	}
	return bDateOK;
}


/* Check validity of a "code postal" string
==================================================================*/
function CheckCodePostal(codepostal) {
	if (codepostal.length<3 || codepostal.length>8) { return false; }
/*
	var Nombre=/^(\d)*$/;
	if (codepostal.match(Nombre)==null) { return false; }
*/
	return true;
}


/* Check validity of a RCS-SIRET-SIREN number
==================================================================*/
function CheckSiret(siret,pays) {
	if (pays.match(/canada/i)!=null || pays.match(/quebec/i)!=null) {
		if (siret.length < 2) {	return false; }
		return true;
	}
	if (siret.length < 6) {	return false; }
	return true;
}

/* Check validity of a telephone number
==================================================================*/
function CheckTel(tel) {
/*	tel=tel.replace("[^0-9]", "");
	var searchstring=/[0-9]/;
	if (tel.match(searchstring)==null) { return false; } */
	if (tel.length < 6) { return false; }
	return true;
}

/* Check if a field is a number
==================================================================*/
function isNumber(valeur) {
	var Nombre=/^(\d)*$/;
	if (valeur.match(Nombre)==null) { return false; }
	return true;
}

/* Positionne la propriété disable = false de tous les éléments
   pour avoir la valeur dans la page POST
==================================================================*/
function SetAllEnabled() {
	var nb=document.forms[0].length;
	for( i = 0; i < nb; i ++ )
	{
		document.forms[0].elements[i].disabled = false;
	}
}

/* Affecte à nomElement la valueElement
==================================================================*/
function SetValue(nomElement,valueElement)
{
    nomElement.value=valueElement;
	return true;
}

/*
Permet de cocher ou décocher ChampCheck en fonction de ChampChange
==================================================================*/
function Check_onEditField(ChampChange,ChampCheck)
{
	if (ChampChange.value != "")
	{
		ChampCheck.checked = true;
	}
	else
	{
		ChampCheck.checked = false;
	}
	return true;
}

/*
Permet de cocher ou décocher/cocher ChampCheck/ChampCheck2 en fonction de ChampChange
==================================================================*/
function Check_onEditField2(ChampChange,ChampCheck,ChampCheck2)
{
	if (ChampChange.value != "")
	{
		ChampCheck.checked = true;
	}
	else
	{
		ChampCheck2.checked = true;
	}
	return true;
}

/*
Permet d'afficher un tooltip
==================================================================*/
function ShowTooltip(fArg)
{
	var tooltipOBJ = (document.getElementById) ? document.getElementById('tt' + fArg) : eval("document.all['tt" + fArg + "']");
	if (tooltipOBJ != null) {
	    var tooltipLft = (document.body.offsetWidth?document.body.offsetWidth:document.body.style.pixelWidth) - (tooltipOBJ.offsetWidth?tooltipOBJ.offsetWidth:(tooltipOBJ.style.pixelWidth?tooltipOBJ.style.pixelWidth:300)) - 30;
	    if (navigator.appName != 'Netscape') {
			var tooltipTop = event.clientY+10;
			tooltipLft = event.clientX+6;
			if (event.clientX+6+tooltipOBJ.offsetWidth > (document.body.offsetWidth?document.body.offsetWidth:document.body.style.pixelWidth)) {
				tooltipLft = (event.clientX-6-tooltipOBJ.offsetWidth);
			}
			tooltipOBJ.style.pixelLeft = tooltipLft; tooltipOBJ.style.pixelTop = tooltipTop;
		}
		else {
			var tooltipTop = 10;
			tooltipOBJ.style.left = tooltipLft; tooltipOBJ.style.top = tooltipTop;
		}
	    tooltipOBJ.style.visibility = "visible";
	}
}

/*
Permet de cacher un tooltip
==================================================================*/
function HideTooltip(fArg)
{
	var tooltipOBJ = (document.getElementById) ? document.getElementById('tt' + fArg) : eval("document.all['tt" + fArg + "']");
	if (tooltipOBJ != null) {
	    tooltipOBJ.style.visibility = "hidden";
	}
}

/*
Permet la selection rapide dans une liste déroulante
list est le chemin de la liste deroulante ex: formu.liste (omettre le document.)
titre est le titre du popup
desc est le texte affiché dans la fenetre
enable boolean pour savoir si la fenetre apparait ou non
==================================================================*/
function UpdateDropDownlist(list,titre,desc,enable,txterr)
{
	if(!enable) {
		alert(txterr);
		return;
	}
	qsearch=window.open('','','resizable=no,toolbar=no,scrollbars=no,status=no,width=500,height=180,left=0,top=0');
	qsearch.document.write("<html>\n<head>\n<title>Smart Search - "+titre+"</title>\n<LINK rel=stylesheet type='text/css' href='/wisd/styles/style.css'>\n");
	qsearch.document.write("<script>\n")
	qsearch.document.write("function MAJdropdown(){\n")
	qsearch.document.write("	ret=document.toto.field.value.toUpperCase();\n");
	qsearch.document.write("	var list=this.opener.document."+list+";\n");
	qsearch.document.write("	var len=list.options.length;\n");
	qsearch.document.write("	var choice=document.toto.tos[0].checked;\n");
	qsearch.document.write("	var ourlist=document.all.dynlist;\n");
	qsearch.document.write("	ourlist.innerHTML=\"\";\n");
	qsearch.document.write("	var selitem=-1;\n");
	qsearch.document.write("	var el = document.createElement(\"Option\");\n");
	qsearch.document.write("	ourlist.options.add(el);\n");
	qsearch.document.write("	el.innerText = \" ----- \";\n");
	qsearch.document.write("	el.value = \"\";\n");
	qsearch.document.write("	if(ret!=\"\"){ \n");
	qsearch.document.write("	if(choice){\n");	
	qsearch.document.write("		for(i=0;i<len;i++){\n");
	qsearch.document.write("			if(list.options[i].text.toUpperCase().indexOf(ret)==0) {\n");
	qsearch.document.write("				var el = document.createElement(\"Option\");\n");
	qsearch.document.write("				ourlist.options.add(el);\n");
	qsearch.document.write("				el.innerText = list.options[i].text;\n");
	qsearch.document.write("				el.value = i;\n");
	qsearch.document.write("			}\n");
	qsearch.document.write("		}\n");
	qsearch.document.write("	}\n");
	qsearch.document.write("	else{\n");	
	qsearch.document.write("		for(i=0;i<len;i++){\n");
	qsearch.document.write("			if(list.options[i].text.toUpperCase().indexOf(ret)>=0) {\n");
	qsearch.document.write("				var el = document.createElement(\"Option\");\n");
	qsearch.document.write("				ourlist.options.add(el);\n");
	qsearch.document.write("				el.innerText = list.options[i].text;\n");
	qsearch.document.write("				el.value = i;\n");
	qsearch.document.write("			}\n");
	qsearch.document.write("		}\n");
	qsearch.document.write("	}\n");
	qsearch.document.write("	}\n");
	qsearch.document.write("	var fodrop=document.toto.dropfield;\n");
	qsearch.document.write("	if(fodrop.options.length>1) fodrop.options[1].selected=true;\n");
	qsearch.document.write("	else fodrop.options[0].selected=true;\n");
	qsearch.document.write("}\n");
	qsearch.document.write("function UpdateDropDown(){\n")
	qsearch.document.write("	var list=this.opener.document."+list+";\n");
	qsearch.document.write("	var ourlist=document.toto.dropfield;\n");
	qsearch.document.write("	var selist=ourlist.selectedIndex;\n");
	qsearch.document.write("	if(selist!=0) list.options[ourlist.options[selist].value].selected=true;\n");
	qsearch.document.write("}\n");
	qsearch.document.write("</script>\n")
	qsearch.document.write("</head>\n<body background='/wisd/img/background.gif'>\n");
	qsearch.document.write("<table width='100%'><tr><td>\n");
	qsearch.document.write("<table cellSpacing='0' cellPadding='1' bgColor='#006699' border='0' width='100%'>\n");
	qsearch.document.write("<tr><td><table width='100%' border='0' cellSpacing='2' cellPadding='0' bgcolor='#FFFFFF'>\n");
	qsearch.document.write("<tr><td colspan='3'><FONT color=#006699><img src='/wisd/img/tip.gif'>&nbsp;<B>"+desc+"</B></FONT></td></tr>\n");
	qsearch.document.write("<tr><td colspan='3'>&nbsp;</td></tr>\n<form name='toto' onsubmit='UpdateDropDown();return false;'>");
	qsearch.document.write("<tr>\n");
	qsearch.document.write("<td width='34%'><IMG src='/wisd/img/pucegrise.gif'>&nbsp;Filter type:</td>\n");
	qsearch.document.write("<td width='33%'><input type='radio' name='tos' onClick='javascript:MAJdropdown();document.toto.field.focus();' CHECKED><a href='javascript:document.toto.tos[0].checked=true;MAJdropdown();document.toto.field.focus();'>Begins with</a></td>\n");
	qsearch.document.write("<td width='33%'><input type='radio' name='tos' onClick='javascript:MAJdropdown();document.toto.field.focus();' ><a href='javascript:document.toto.tos[1].checked=true;MAJdropdown();document.toto.field.focus();'>Contains</a></td>\n");
	qsearch.document.write("</tr>\n");
	qsearch.document.write("</tr>\n");
	qsearch.document.write("<tr><td colspan='3'><hr></td></tr>\n");
	qsearch.document.write("<tr>\n");
	qsearch.document.write("<td><IMG src='/wisd/img/pucegrise.gif'>&nbsp;Enter filter:</td>\n");
	qsearch.document.write("<td colspan='2'><input name='field' type='text' size='48' onKeyup='javascript:MAJdropdown();' class='inText'></td>\n");
	qsearch.document.write("</tr>\n");
	qsearch.document.write("<tr><td><IMG src='/wisd/img/pucegrise.gif'>&nbsp;"+titre+":</td>\n");
	qsearch.document.write("<td colspan='2'>\n");
	qsearch.document.write("<select id='dynlist' name='dropfield' class='inText' style=\"width:300px\"><option> None </option></select>\n");
	qsearch.document.write("</td></tr>\n");
	qsearch.document.write("<tr><td colspan='3' align='right'>\n");
	qsearch.document.write("<input type='button' name='update' value='Update' onclick='javascript:UpdateDropDown();' class='inText'>&nbsp;&nbsp;\n");
	qsearch.document.write("</td></tr></form>\n");
	qsearch.document.write("</table>\n");
	qsearch.document.write("</td></tr>\n");
	qsearch.document.write("</table>\n");
	qsearch.document.write("</td></tr>\n");
	qsearch.document.write("<tr><td width='100%' align='right'><img src='/wisd/img/fermer.gif' onclick='javascript:window.close();'>&nbsp;<a href='javascript:window.close();' class='button'>Close the window</a>");
	qsearch.document.write("</table>\n");
	qsearch.document.write("<script>\n	document.toto.field.focus();\n</script>\n");
	qsearch.document.write("</body>\n</html>");

}
/*
Permet la selection rapide dans une liste déroulante
list1 est le chemin de la liste deroulante qui contient les intitulés ex: formu.liste (omettre le document.)
list2 est le chemin de la liste deroulante qui contient les codes ex: formu.liste (omettre le document.)
titre est le titre du popup
desc est le texte affiché dans la fenetre
enable boolean pour savoir si la fenetre apparait ou non
==================================================================*/
function UpdateDropDownlist2(name1,list1,name2,list2,titre,desc,enable,txterr,jsexec)
{
	if(!enable) {
		alert(txterr);
		return;
	}
	qsearch=window.open('','','resizable=no,toolbar=no,scrollbars=no,status=no,width=500,height=200,left=0,top=0');
	qsearch.document.write("<html>\n<head>\n<title>Smart Search - "+titre+"</title>\n<LINK rel=stylesheet type='text/css' href='/wisd/styles/style.css'>\n");
	qsearch.document.write("<script>\n")
	qsearch.document.write("function MAJdropdown(){\n")
	qsearch.document.write("	ret=document.toto.field.value.toUpperCase();\n");
	qsearch.document.write("	var seltyp=document.toto.seltype[0].checked;\n");
	qsearch.document.write("	var seltyp1=document.getElementById(\"mesg1\");\n");
	qsearch.document.write("	var seltyp2=document.getElementById(\"mesg2\");\n");
	qsearch.document.write("	var list;\n");
	qsearch.document.write("	if(seltyp) {\n");
	qsearch.document.write("		list=this.opener.document."+list1+";\n");
	qsearch.document.write("		seltyp1.style.display=\"block\";\n");
	qsearch.document.write("		seltyp2.style.display=\"none\";\n");
	qsearch.document.write("	}\n");
	qsearch.document.write("	else {\n");
	qsearch.document.write("		list=this.opener.document."+list2+";\n");
	qsearch.document.write("		seltyp2.style.display=\"block\";\n");
	qsearch.document.write("		seltyp1.style.display=\"none\";\n");
	qsearch.document.write("	}\n");
	qsearch.document.write("	var len=list.options.length;\n");
	qsearch.document.write("	var choice=document.toto.tos[0].checked;\n");
	qsearch.document.write("	var ourlist=document.all.dynlist;\n");
	qsearch.document.write("	ourlist.innerHTML=\"\";\n");
	qsearch.document.write("	var selitem=-1;\n");
	qsearch.document.write("	var el = document.createElement(\"Option\");\n");
	qsearch.document.write("	ourlist.options.add(el);\n");
	qsearch.document.write("	el.innerText = \" None\";\n");
	qsearch.document.write("	el.value = \"\";\n");
	qsearch.document.write("	if(ret!=\"\"){ \n");
	qsearch.document.write("	if(choice){\n");	
	qsearch.document.write("		for(i=0;i<len;i++){\n");
	qsearch.document.write("			if(list.options[i].text.toUpperCase().indexOf(ret)==0) {\n");
	qsearch.document.write("				var el = document.createElement(\"Option\");\n");
	qsearch.document.write("				ourlist.options.add(el);\n");
	qsearch.document.write("				el.innerText = list.options[i].text;\n");
	qsearch.document.write("				el.value = i;\n");
	qsearch.document.write("			}\n");
	qsearch.document.write("		}\n");
	qsearch.document.write("	}\n");
	qsearch.document.write("	else{\n");	
	qsearch.document.write("		for(i=0;i<len;i++){\n");
	qsearch.document.write("			if(list.options[i].text.toUpperCase().indexOf(ret)>=0) {\n");
	qsearch.document.write("				var el = document.createElement(\"Option\");\n");
	qsearch.document.write("				ourlist.options.add(el);\n");
	qsearch.document.write("				el.innerText = list.options[i].text;\n");
	qsearch.document.write("				el.value = i;\n");
	qsearch.document.write("			}\n");
	qsearch.document.write("		}\n");
	qsearch.document.write("	}\n");
	qsearch.document.write("	}\n");
	qsearch.document.write("	var fodrop=document.toto.dropfield;\n");
	qsearch.document.write("	if(fodrop.options.length>1) fodrop.options[1].selected=true;\n");
	qsearch.document.write("	else fodrop.options[0].selected=true;\n");
	qsearch.document.write("}\n");
	qsearch.document.write("function UpdateDropDown(){\n")
	qsearch.document.write("	var seltyp=document.toto.seltype[0].checked;\n");
	qsearch.document.write("	var list;\n");
	qsearch.document.write("	if(seltyp) list=this.opener.document."+list1+";\n");
	qsearch.document.write("	else list=this.opener.document."+list2+";\n");
	qsearch.document.write("	var list2;\n");
	qsearch.document.write("	if(!seltyp) list2=this.opener.document."+list1+";\n");
	qsearch.document.write("	else list2=this.opener.document."+list2+";\n");
	qsearch.document.write("	var ourlist=document.toto.dropfield;\n");
	qsearch.document.write("	var selist=ourlist.selectedIndex;\n");
	qsearch.document.write("	var len=list2.options.length;\n");
	qsearch.document.write("	if(selist!=0) {\n");
	qsearch.document.write("		list.options[ourlist.options[selist].value].selected=true;\n");
	qsearch.document.write("		val=list.options[ourlist.options[selist].value].value;\n");
	qsearch.document.write("		for(i=0;i<len;i++){\n");
	qsearch.document.write("			if(list2.options[i].value==val) {\n");
	qsearch.document.write("				list2.options[i].selected=true;\n");
	if(jsexec!="") 	qsearch.document.write("			opener.setTimeout(\""+jsexec+"\",0);\n");
	qsearch.document.write("				return ;\n");
	qsearch.document.write("			}\n");
	qsearch.document.write("		}\n");
	qsearch.document.write("	}\n");
	qsearch.document.write("}\n");
	qsearch.document.write("</script>\n")
	qsearch.document.write("</head>\n<body background='/wisd/img/background.gif'>\n");
	qsearch.document.write("<table width='100%'><tr><td>\n");
	qsearch.document.write("<table cellSpacing='0' cellPadding='1' bgColor='#006699' border='0' width='100%'>\n");
	qsearch.document.write("<tr><td><table width='100%' border='0' cellSpacing='2' cellPadding='0' bgcolor='#FFFFFF'>\n");
	qsearch.document.write("<tr><td colspan='2'><FONT color=#006699><img src='/wisd/img/tip.gif'>&nbsp;<B>"+desc+"</B></FONT></td></tr>\n");
	qsearch.document.write("<tr><td colspan='2'>&nbsp;</td></tr>\n<form name='toto' onsubmit='UpdateDropDown();return false;'>");
	qsearch.document.write("<tr>\n");
	qsearch.document.write("<td width='34%'><IMG src='/wisd/img/pucegrise.gif'>&nbsp;Filter type:</td>\n");
	qsearch.document.write("<td width='33%'><input type='radio' name='tos' onClick='javascript:MAJdropdown();document.toto.field.focus();' CHECKED><a href='javascript:document.toto.tos[0].checked=true;MAJdropdown();document.toto.field.focus();'>Begins with</a></td>\n");
	qsearch.document.write("<td width='33%'><input type='radio' name='tos' onClick='javascript:MAJdropdown();document.toto.field.focus();' ><a href='javascript:document.toto.tos[1].checked=true;MAJdropdown();document.toto.field.focus();'>Contains</a></td>\n");
	qsearch.document.write("</tr>\n");
	qsearch.document.write("<tr><td colspan='3'><hr></td></tr>\n");
	qsearch.document.write("<tr>\n");
	qsearch.document.write("<td><input type='radio' name='seltype' onClick='javascript:MAJdropdown();document.toto.field.focus();' CHECKED><a href='javascript:document.toto.seltype[0].checked=true;MAJdropdown();document.toto.field.focus();'>"+name1+"</a>\n");
	qsearch.document.write("<br><input type='radio' name='seltype' onClick='javascript:MAJdropdown();document.toto.field.focus();' ><a href='javascript:document.toto.seltype[1].checked=true;MAJdropdown();document.toto.field.focus();'>"+name2+"</a></td>\n");
	qsearch.document.write("<td colspan='2'><input name='field' type='text' size='48' onKeyup='javascript:MAJdropdown();' class='inText'></td>\n");
	qsearch.document.write("</tr>\n");
	qsearch.document.write("<tr><td><div id=\"mesg1\"><IMG src='/wisd/img/pucegrise.gif'>&nbsp;"+name1+":</div><div id=\"mesg2\" STYLE=\"display: none\"><IMG src='/wisd/img/pucegrise.gif'>&nbsp;"+name2+":</div></td>\n");
	qsearch.document.write("<td colspan='2'>\n");
	qsearch.document.write("<select id='dynlist' name='dropfield' class='inText' style=\"width:300px\"><option> None </option></select>\n");
	qsearch.document.write("</td></tr>\n");
	qsearch.document.write("<tr><td colspan='3' align='right'>\n");
	qsearch.document.write("<input type='button' name='update' value='Update' onclick='javascript:UpdateDropDown();' class='inText'>&nbsp;&nbsp;\n");
	qsearch.document.write("</td></tr></form>\n");
	qsearch.document.write("</table>\n");
	qsearch.document.write("</td></tr>\n");
	qsearch.document.write("</table>\n");
	qsearch.document.write("</td></tr>\n");
	qsearch.document.write("<tr><td width='100%' align='right'><img src='/wisd/img/fermer.gif' onclick='javascript:window.close();'>&nbsp;<a href='javascript:window.close();' class='button'>Close the window</a>");
	qsearch.document.write("</table>\n");
	qsearch.document.write("<script>\n	document.toto.field.focus();\n</script>\n");
	qsearch.document.write("</body>\n</html>");

}
var ie5= (document.getElementById && document.all);
var ns6= (document.getElementById && !document.all);

function showHelp(tip,posX, posY){
 if (ie5) {
  //coordonnées du curseur en pixel
  top_  = document.body.scrollTop+posY;
  left_ = document.body.scrollLeft+190;
 }
 else {
  //coordonnées du curseur en pixel
  top_  = window.pageYOffset+posY;
  left_ = window.pageXOffset+190;
 }
 
 if(ie5 || ns6){
  elm = document.getElementById(tip);
  elm.style.left = left_+"px";
  elm.style.top=top_+"px";	
  elm.style.visibility="visible";
 }
}

function showHelp2(tip,posX, posY){
 if (ie5) {
  //coordonnées du curseur en pixel
  top_  = posY+15;
  left_ = posX-50;
 }
 else {
  //coordonnées du curseur en pixel
  top_  = posY+15;
  left_ = posX-50;
 }
 
 if(ie5 || ns6){
  elm = document.getElementById(tip);
  elm.style.left = left_+"px";
  elm.style.top=top_+"px";	
  elm.style.visibility="visible";
 }
}

function showHelp3(tip,posX, posY){
  //coordonnées du curseur en pixel
  if (ie5) {
    top_  = document.body.scrollTop+posY;
    left_ = document.body.scrollLeft+posX;
  } else {
  //coordonnées du curseur en pixel
    top_  = window.pageYOffset+posY;
    left_ = window.pageXOffset+posX;
  }
 
  if(ie5 || ns6){
    elm = document.getElementById(tip);
    elm.style.left = left_+"px";
    elm.style.top=top_+"px";	
    elm.style.visibility="visible";
  }
}


function hideHelp(tip){
 if(ie5 || ns6){
  elm = document.getElementById(tip);
  elm.style.visibility="hidden";
 }
}

function setFocus() {
  // Appelée au onload
  // Donner le focus à la zone d'input non disabled

  // Appel de la smartsearch: ne pas donner le focus à la fenetre reafraichie sinon la smartsearch le perd
  tmp=window.location.href;
  if ((tmp.indexOf("hotspotdetail.jsp") > 0) || (tmp.indexOf("contractdetail.jsp") > 0) || (tmp.indexOf("locationdetail.jsp") > 0) || (tmp.indexOf("groupdetail.jsp") > 0) || (tmp.indexOf("legalentitydetail.jsp") > 0))
    return;

  var formexist =document.forms[0];
  if(formexist!=undefined){
   for(var i=0;i<document.forms[0].length;i++){
    if((document.forms[0].elements[i].type=='text')&&(document.forms[0].elements[i].disabled==false)){
     document.forms[0].elements[i].focus();
     return; 
    }
   }
  }
  return;
 }

 /* Scroll de l'ascenseur si onglet sélectionné
 ==================================================================*/
 function descendreAscenseur(){
  var URL = new String(window.location);
  if (URL.indexOf('&add', 0)>0){
   if (ie5)
    window.scroll(0,document.body.offsetHeight);  
   if (ns6)
    window.scroll(0,document.height); 
  }
 }
 
 function preloadImages() { 
   var d=document;
   if(d.images){ 
     if(!d.MM_p) d.MM_p=new Array();
     var i,j=d.MM_p.length,a=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 enter(evt){ 
   var formexist =document.forms[0];
   if(formexist!=undefined){
    var CR = 13;
    var charCode; 
    if (navigator.appName == "Netscape") charCode = evt.which 
    else charCode = evt.keyCode;
    if (charCode == CR){
     for(var i=0;i<document.forms[0].length;i++){
      if(document.forms[0].elements[i].value=='filter / search the list'){
       document.forms[0].submit();
       return;
      }
     }
    }
    return true;
   }
   return;
  }

 function pausecomp(Amount){
   d = new Date() //today's date
   while (1)
   {
     mill=new Date() // Date Now
     diff = mill-d //difference in milliseconds
     if( diff > Amount ) {break;}
   }
 }

