//-------- VARIABLES GLOBALES ----------------
var NoasScript = function( oWindow ){
  this.agent = navigator.userAgent.toLowerCase();
  this.isIE = this.agent.indexOf("msie")!=-1;
  this.isNetscape = this.agent.indexOf("netscape")!=-1;
  this.isGecko = !this.isIE;
  this.window = oWindow;
}
/**
* @param string rid identfiant de requête
* @param string target context cible de l'action
* @param string event à générer sur le context
*/
NoasScript.prototype.onClick = function(rid, target, event){
  this.window.location.href = "?NOAS_RID=" + rid + "&NOAS_EVENT=" + event + "&NOAS_EVENT_TARGET=" + target;
}
/**
* @param string form nom du formaulaire
* @param string target context cible de l'action
* @param string event à générer sur le context
*/
NoasScript.prototype.onSubmit = function(form, target, event){
 eval("document." + form + ".NOAS_EVENT.value='" + event + "'");
 eval("document." + form + ".NOAS_EVENT_TARGET.value='" + target + "'");
 eval("document." + form + ".submit()");
}
/**
* @param string rid identfiant de requête
* @param string target context cible de l'action
* @param string event à générer sur le context
* @param string popup nom de la popup
*/
NoasScript.prototype.onClickPopup = function(rid, target, event, popup){
  this.window.location.href = "?NOAS_RID=" + rid + "&NOAS_EVENT=" + event + "&NOAS_EVENT_TARGET=" + target + "&NOAS_POPUP_NAME=" + popup;
}
/**
* @param string form nom du formaulaire
* @param string target context cible de l'action
* @param string event à générer sur le context
* @param string popup nom de la popup
*/
NoasScript.prototype.onSubmitPopup = function(form, target, event, popup){
 eval("document." + form + ".NOAS_EVENT.value='" + event + "'");
 eval("document." + form + ".NOAS_EVENT_TARGET.value='" + target + "'");
 eval("document." + form + ".NOAS_POPUP_NAME.value='" + popup + "'");
 eval("document." + form + ".submit()");
}
/**
* @param string id identifiant
* @param string url url à affciher
* @param boolean modal true la fenêtre doit être afficher en modal
* @param boolean center true la fenêtre doit être afficher au centre
* @param boolean resizable true la fenêtre peut être redimensionnée
* @param boolean scrollbars true si la fenêtre pocéde des scrcollbars
* @param int width largeur de la fenêtr
* @param int height hauteur de la fenêtre
*/
NoasScript.prototype.doModalIE = function(id,url,modal,center,resizable,scrollbars,width,height) {
  var params = "unadormed=yes";
  params += ",status=no";
  if(resizable){
    params += ",resizable=yes";
  } else{
    params += ",resizable=no";  
  }
  if(scrollbars){
    params += ",scroll=yes";
  } else{
    params += ",scroll=no";  
  } 
  if(center){
    // calculer
    params += ",center=yes";
  } else{
    params += ",center=no";  
  }  
  params += ",dialogWidth=" + width + ",dialogHeight=" + height;
  popup = showModalDialog(url,"",params);
 // popup.focus();
}

/**
* @param string id identifiant
* @param string url url à affciher
* @param boolean modal true la fenêtre doit être afficher en modal
* @param boolean center true la fenêtre doit être afficher au centre
* @param boolean resizable true la fenêtre peut être redimensionnée
* @param boolean scrollbars true si la fenêtre pocéde des scrcollbars
* @param int width largeur de la fenêtr
* @param int height hauteur de la fenêtre
*/
NoasScript.prototype.onOpenPopup = function(id,url,modal,center,resizable,scrollbars,width,height) {
  if(modal){
    if(this.isIE){
      this.doModalIE(id,url,modal,center,resizable,scrollbars,width,height);    
    }
  } else {
    var params = "location=no";
    params += ",menubar=no";
    params += ",status=no";
    params += ",hotkey=no";
    params += ",toolbar=no";
    if(modal){
      params += ",dependent=yes";
    } else{
      params += ",dependent=no";  
    }
    if(resizable){
      params += ",resizable=yes";
    } else{
      params += ",resizable=no";  
    }
    if(scrollbars){
      params += ",scrollbars=yes";
    } else{
      params += ",scrollbars=no";  
    } 
    if(center){
      // calculer
      params += ",left="+(screen.width - width)/2+",top="+(screen.height - height)/2;
    } else{
      params += ",left=0,top=0";  
    }  
    params += ",width=" + width + ",height=" + height;
    popup = window.open(url,id,params);
    popup.focus();          
  }
}
/** @var NoasScript logic javascript  */
var __noas = new NoasScript(window);