// JavaScript Document
function fp_inputmultiopcion (id_input) {
   	this.nitems = 0;
    this.elemactual = false;
	
	this.id_input=id_input;
 	this.elementos = new Array;
 	this.elementosvalor = new Array;
    this.add_elemento = function(idelem,valor) {
         this.elementos[this.nitems]=idelem;
         this.elementosvalor[this.nitems]=valor;
		 this.nitems=this.nitems+1;
    };
   	this.get_input_obj = function() {
		if (this.inputobjOK){
			return true;	
		}
		if (this.inputobj=fp_get_element_by_id_siexiste(this.id_input)){
			this.inputobjOK=true;
			return true;	
		}
	}
	this.set_actual= function(idelem){
		if (this.elemactual!==false){
			fp_cambiar_propiedad(this.elementos[this.elemactual],'className',this.class_nosel);
		}
		this.elemactual=idelem;
		fp_cambiar_propiedad(this.elementos[this.elemactual],'className',this.class_sel);
		if (this.get_input_obj()){
			this.inputobj.value=this.elementosvalor[this.elemactual];
		}
	}
	this.set_actual_frominput= function(){
		if (this.get_input_obj()){
			var idelem=false;
			var valoractual= this.inputobj.value;
			
			for (i=0;i<this.nitems;i++){
				if(	this.elementosvalor[i]==valoractual){
					
					var idelem=i;
					break;
				}
			}
			if (idelem!==false){
				this.set_actual(idelem);
			}
			
		} 
	}
}