// JavaScript Document

function limpiarCombo(combo) {
	while (combo.options.length!=0) 
		combo.remove(0);
	opt=new Option("[ Seleccionar... ]","",true);
//	combo.add(opt,null);
	try {
		combo.add(opt,null);
	} catch (e) {
		combo.add(opt);
	}
}


function valorCombo(combo) {

	var valor=combo.options[combo.selectedIndex].value;
	return valor;
	
}

function textoCombo(combo) {

	var texto=combo.options[combo.selectedIndex].text;
	return texto;
	
}

function agregarOpcion(idCombo,texto,valor) {
	combo=document.getElementById(idCombo);
	opt=new Option(valor,texto);
	try {
		combo.add(opt,null);
	} catch (e) {
		combo.add(opt);
	}
}

function selectCombo(idCombo,valor) {
	combo=document.getElementById(idCombo);
	for(i=0; i<combo.options.length; i++) {
		if (combo.options[i].value==valor) {
			combo.options[i].selected=true;
			return;
		}
	}
}
