 var TCS = new TChampSelect();
 function TCSPopup(numLigne,doc) {
        this.numLigne = numLigne;
        this.inputname = 'valeur' + numLigne;
        this.docsource = doc;
        makeRequestFirefox(contextpath+'/element/recherche/selectchamp.jsp', 'divarbre', 'divarbrecontenu', 'divarbre');
	activeWindow("divarbre");
}
function TCSInit(o_win, o_doc) {
        this.win = o_win;
        this.doc = o_doc;
}
function TCSSelect(id,type) {
  validSelectChamp(id,this.docsource,this.numLigne,type);
  if(this.docsource.getElementById('lienselect'+this.numLigne)){
    this.docsource.getElementById('lienselect'+this.numLigne).style.visibility = 'hidden';
    }
  document.getElementById("divarbre").style.display="none";
}
function validSelectChamp(id,doc,ligne,type){
	texte = this.listemot;
    doc.getElementById('dateperiode'+ligne).style.display = 'none';
    if(doc.getElementById('infX'+ligne)){
    doc.getElementById('infX'+ligne).style.display = 'none';
    }
    if(doc.getElementById('supX'+ligne)){
    doc.getElementById('supX'+ligne).style.display = 'none';
    }

    doc.getElementById('input'+ligne).value = id;
    if(doc.getElementById('lienselect'+ligne)){
      makeRequestFirefox(contextpath+"/listes/calculeNomtableNomchamp.jsp?idChamp="+id+"&num="+ligne+"&type=TCS",'idChamp'+ligne+'nom', 'idChamp'+ligne+'nom', 'idChamp'+ligne+'nom', '');
    }else{
      makeRequestFirefox(contextpath+"/listes/calculeNomtableNomchampSansLien.jsp?idChamp="+id+"&num="+ligne+"&type=TCS",'idChamp'+ligne+'nom', 'idChamp'+ligne+'nom', 'idChamp'+ligne+'nom', '');
    }
    if(doc.getElementById("divoperateur"+ligne)){
      if(type !=3){// Si c'est une date on cache l'opérateur
        doc.getElementById("divoperateur"+ligne).style.display="block";
      }else{
    	doc.getElementById("divoperateur"+ligne).style.display="none";
      }
    }
    //num = this.inputname.substring(7);
    makeRequestFirefox(contextpath+"/element/recherche/initinput.jsp?id="+id+"&num="+ligne,'idChamp'+ligne+'val', 'idChamp'+ligne+'val', 'idChamp'+ligne+'val', '');
}

function TChampSelect() {
   this.Popup   = TCSPopup;
   this.Select  = TCSSelect;
   this.Init    = TCSInit;
}

