function redirect(x, group){
	
    for (m=temp.options.length-1;m>0;m--)
    	temp.options[m]=null;
    for (i=0;i<group[x].length;i++){
    	temp.options[i]=new Option(group[x][i].text,group[x][i].value);
    }
    temp.options[0].selected=true;
}

function go(){
	location=temp.options[temp.selectedIndex].value;
}


function selectjs(texto,valor){
	this.texto = texto;
	this.valor = valor;
}

function cambioseljs(cbPadre,cbHijo,opcioncb){
	var vsel;
	if(cbPadre.selectedIndex != 0){
		cbHijo.length=0;
		vsel = eval(cbPadre.value);
		for(cont=0;cont<opcioncb[vsel].length;cont++){
			var nuevaOpcion = new Option(opcioncb[vsel][cont].texto);
			cbHijo.options[cont] = nuevaOpcion;
			if(opcioncb[vsel][cont].valor != null){
				cbHijo.options[cont].value = opcioncb[vsel][cont].valor;
			}
			else{
				cbHijo.options[cont].value = opcioncb[vsel][cont].texto;
			}
		}
	}
}

function cambioseljsIDs(idComboPadre,idComboHijo,opcioncb){
	var cont = 0;
	var cbPadre = getField(idComboPadre);
	var cbHijo = getField(idComboHijo);
	if(cbPadre.selectedIndex != 0){
		cbHijo.length=0;
		var vsel = eval(cbPadre.value);
		for(cont=0;cont<opcioncb[vsel].length;cont++){
			var nuevaOpcion = new Option(opcioncb[vsel][cont].texto);
			cbHijo.options[cont] = nuevaOpcion;
			if(opcioncb[vsel][cont].valor != null){
				cbHijo.options[cont].value = opcioncb[vsel][cont].valor;
			}
			else{
				cbHijo.options[cont].value = opcioncb[vsel][cont].texto;
			}
		}
	}
}

function getField(idElemento){
	try{
		return document.getElementById(idElemento);
	}
	catch(e){
		return '';
	}
}
