function changeFormDetail(strData) {
  document.getElementById('commentaire_form').innerHTML = strData; 
  execJS(document.getElementById('commentaire_form'));
}

function changeNbCommentaires(strData) {
  document.getElementById('commentaires_nb').innerHTML = strData; 
}

function changeListeCommentaires(strData) {
  document.getElementById('commentaires_liste').innerHTML = strData; 
}

function changeFormulaire(iMode, strToken) {
  var f = document.commentaire;
   
  new AlkAjax('commentaire', 'changeFormDetail', ALK_FORM_METHOD_POST, '/libconf/lib/lib_exectmpl.php?tmpl=alkexeccommentaire&token='+strToken+'&iMode='+iMode, 'commentaire');
  
  refreshListComment(strToken);
}

function refreshListComment(strToken) {
  new AlkAjax('commentaires_liste', 'changeListeCommentaires', ALK_FORM_METHOD_GET, '/libconf/lib/lib_exectmpl.php?tmpl=alkexeccommentaire&token='+strToken+'&iMode=8'); 
  new AlkAjax('commentaires_nb', 'changeNbCommentaires', ALK_FORM_METHOD_GET, '/libconf/lib/lib_exectmpl.php?tmpl=alkexeccommentaire&token='+strToken+'&iMode=9'); 
}

var AlkNbClickValidComment = 0;

function ValidationComment(){
  var f = document.commentaire;
  if( AlkNbClickValidComment == 0 ) {
    var bRes = AlkVerifCtrl(f);
    if( bRes == true ) {
      //AlkNbClickValidComment++;
      f.submit();
    }
  }
}

function ValidationInscription(){
  var f = document.commentaire;
  if( AlkNbClickValidComment == 0 ) {
    var bRes = AlkVerifCtrl(f);
    if( bRes == true ) {
      var bPwd = (f.pwd_abo.value==f.pwd_abo2.value);
      if (bPwd==false) {
        window.alert("Les 2 mots de passe doivent être identiques");
      } else {
        //AlkNbClickValidComment++;
        f.submit();
      }
    }
  }
}

function execJS(node) {
  var bSaf = (navigator.userAgent.indexOf('Safari') != -1);
  var bOpera = (navigator.userAgent.indexOf('Opera') != -1);
  var bMoz = (navigator.appName == 'Netscape');
  var st = node.getElementsByTagName('SCRIPT');
  var strExec;
  for(var i=0;i<st.length; i++) {     
    if (bSaf) {
      strExec = st[i].innerHTML;
    }
    else if (bOpera) {
      strExec = st[i].text;
    }
    else if (bMoz) {
      strExec = st[i].textContent;
    }
    else {
      strExec = st[i].text;
    }
    try {
      eval(strExec);
    } catch(e) {
      alert(e);
    }
  }
}

function ChangeObjDisplay()
{
  var a=ChangeObjDisplay.arguments; 
  
  for(i=0; i<a.length; i++){
  	if ((obj=MM_findObj(a[i]))!=null){
  	  if (obj.style) { obj=obj.style; }
  	  if (obj.display=='block' || obj.display=='' || obj.display==null){
        obj.display='none';
  	  } else {
    	  obj.display='block';  
  	  }  
  	}
  }
}