/**
  * Initialisation d'un Objet TChampSelect
  */
 var TCOS = new TChampOptionSelect();

 function TCOSPopup(id,doc) {
        this.id = id;
        this.inputname = id + 'input';
        this.lien = id + 'lien'
        this.docsource = doc;
        var w = 400, h = 400,
        move = screen ?
                ',left=' + ((screen.width - w) >> 1) + ',top=' + ((screen.height - h) >> 1) : '',
        win = window.open(contextpath+'/element/options/selectchamp.jsp', null, "help=no,status=no,scrollbars=yes,resizable=yes"
        + move + ",width=" + w + ",height=" + h + ",dependent=yes", true);
        win.opener = window;
        win.focus();
}

function TCOSInit(o_win, o_doc) {
        this.win = o_win;
        this.doc = o_doc;
}

function TCOSSelect(idchamp,nom,type) {
    // On cache le le lien select champ
	texte = this.listemot;
    this.docsource.getElementById(this.id).style.visibility = 'hidden';

    // mise a jour de l'id dans l'input
    this.docsource.getElementById(this.inputname).value = idchamp;

    this.docsource.getElementById(this.lien).style.visibility = 'visible';
    // mise a jour du lien
    val = "<script>var TCOS = new TChampOptionSelect();</script>"
    val =  val + "<a href=\"javascript:TCOS.Popup(";
    val = val +"'"+this.id+"',";
    val = val +"document);\">"+nom+"</a>";
    this.docsource.getElementById(this.lien).innerHTML = val;

    this.win.close();
}

function TChampOptionSelect() {
   this.Popup   = TCOSPopup;
   this.Select  = TCOSSelect;
   this.Init    = TCOSInit;
}

