function buscarSeleccion(){
	comboGama = document.getElementById("form1").gama;
	comboFamilia = document.getElementById("form1").familia;
	comboModelo = document.getElementById("form1").modelo;
	destino = '';
	idGama = comboGama.options[comboGama.selectedIndex].value;
	idFamilia = comboFamilia.options[comboFamilia.selectedIndex].value;
	idModelo = comboModelo.options[comboModelo.selectedIndex].value;
	idCatalogo = document.getElementById("form1").ID_CATALOGO.value;
	var gamaNueva = idGama;
	if ( gamaNueva == ''){
		gamaNueva = document.getElementById("form1").ID_GAMA.value;
	}

	if ( idFamilia!= '' && idModelo != ''){
		//jsp detalle del modelo
		destino = "modelo"+tipoProducto+".jsp";
		var ancho=750;
		var alto=500;
		if (document.all) var xMax = screen.width, yMax = screen.height;
		else
			if (document.layers) var xMax = window.outerWidth, yMax = window.outerHeight;
			else var xMax = 640, yMax=480;
		var xOffset = (xMax - ancho)/2, yOffset = (yMax - alto)/2 - 30;
		window.open(destino+'?ID_MODELO='+idModelo+'&ID_FAMILIA='+idFamilia+'&ID_CATALOGO='+idCatalogo+'&ID_GAMA='+gamaNueva,'FlotanteDetalleModelo'+tipoProducto,'scrollbars=yes,width='+ancho+',height='+alto+',top='+yOffset+',left='+xOffset);
		//form1.action=destino;
		//document.getElementById("form1").ID_GAMA.value=idGama;
		//document.getElementById("form1").ID_FAMILIA.value=idFamilia;
		//document.getElementById("form1").ID_MODELO.value=idModelo;
		//form1.submit();
	}else{
		if ( idFamilia!= ''){
			//jsp de familia
			destino = "familia"+tipoProducto+".jsp";
			form1.action=destino;
			if (idGama!= ''){
				document.getElementById("form1").ID_GAMA.value=idGama;
			}
			document.getElementById("form1").ID_FAMILIA.value=idFamilia;
			form1.submit();
		}else{
			if (idGama!= ''){
				//jsp de gama
				destino = "gama"+tipoProducto+".jsp";
				form1.action=destino;
				document.getElementById("form1").ID_GAMA.value=idGama;
				form1.submit();
			}
		}
	}
}

function buscarModelo1(){
	idModelo = document.getElementById("form1").modelos1.options[document.getElementById("form1").modelos1.selectedIndex].value;
	document.getElementById("form1").ID_FAMILIA.value=idFamiliaMOD;
	document.getElementById("form1").ID_MODELO.value =idModelo;
	document.getElementById("form1").ID_CATALOGO.value=idCatalogo;
	destino = "modelo"+tipoProducto+".jsp";
	form1.action = destino;
	form1.submit();
}

function buscarModelo2(){
	idModelo = form2.modelos2.options[form2.modelos2.selectedIndex].value;
	form2.ID_FAMILIA.value=idFamiliaMOD;
	form2.ID_MODELO.value =idModelo;
	form2.ID_CATALOGO.value=idCatalogo;
	destino = "modelo"+tipoProducto+".jsp";
	form2.action = destino;
	form2.submit();
}

function buscarSeleccionCalentadores(){
	comboGama = document.getElementById("form1").gama;
	comboModelo = document.getElementById("form1").modelo;
	destino = '';
	idGama = comboGama.options[comboGama.selectedIndex].value;
	idModelo = comboModelo.options[comboModelo.selectedIndex].value;
	idCatalogo = document.getElementById("form1").ID_CATALOGO.value;
	var gamaNueva = document.getElementById("form1").ID_GAMA.value;

	if ( idModelo != ''){
		var ancho = 750;
		var alto = 500;
		if (document.all) var xMax = screen.width, yMax = screen.height;
		else
			if (document.layers) var xMax = window.outerWidth, yMax = window.outerHeight;
			else var xMax = 640, yMax=480;
		var xOffset = (xMax - ancho)/2, yOffset = (yMax - alto)/2 - 30;
		//jsp detalle del modelo
		destino = "modelo"+tipoProducto+".jsp";
		window.open(destino+'?ID_MODELO='+idModelo+'&ID_FAMILIA='+idGama+'&ID_CATALOGO='+idCatalogo+'&ID_GAMA='+gamaNueva,'detalleModeloFlotante'+tipoProducto,'scrollbars=yes,width='+ancho+',height='+alto+',top='+yOffset+',left='+xOffset);
	}else{
		if (idGama!= ''){
			//jsp de gama
			destino = "familia"+tipoProducto+".jsp";
			form1.action=destino;
			document.getElementById("form1").ID_GAMA.value=idGama;
			document.getElementById("form1").ID_FAMILIA.value=idGama;
			form1.submit();
		}
	}
}

function buscarSeleccionHep2o(){
	comboGama = document.getElementById("form1").gama;
	comboFamilia = document.getElementById("form1").familia;
	destino = '';
	idGama = comboGama.options[comboGama.selectedIndex].value;
	idFamilia = comboFamilia.options[comboFamilia.selectedIndex].value;

	if ( idFamilia!= ''){
		//jsp de familia
		destino = "familia"+tipoProducto+".jsp";
		form1.action=destino;
		if (idGama!= ''){
			document.getElementById("form1").ID_GAMA.value=idGama;
		}
		document.getElementById("form1").ID_FAMILIA.value=idFamilia;
		form1.submit();
	}else{
		if (idGama!= ''){
			//jsp de gama
			destino = "gama"+tipoProducto+".jsp";
			form1.action=destino;
			document.getElementById("form1").ID_GAMA.value=idGama;
			form1.submit();
		}
	}
}

function buscarSeleccionSolar(){
	comboGama = document.getElementById("form1").gama;
	comboFamilia = document.getElementById("form1").familia;
	comboModelo = document.getElementById("form1").modelo;
	destino = '';
	idGama = comboGama.options[comboGama.selectedIndex].value;
	idFamilia = comboFamilia.options[comboFamilia.selectedIndex].value;
	idModelo = comboModelo.options[comboModelo.selectedIndex].value;
	idCatalogo = document.getElementById("form1").ID_CATALOGO.value;
	var gamaNueva = idGama;
	if ( gamaNueva == ''){
		gamaNueva = document.getElementById("form1").ID_GAMA.value;
	}

	if ( idFamilia!= '' && idModelo != ''){
		//jsp detalle del modelo
		//En la posición 3 del array se guarda la jsp del modelo
		destino = buscarJspFamilia(idFamilia,3);
		//idFamilia = idFamilia.substring(0,idFamilia.indexOf("$$"));
		if ( destino != '' && destino != 'null'){
			var ancho = 750;
			var alto = 500;
			if (document.all) var xMax = screen.width, yMax = screen.height;
			else
				if (document.layers) var xMax = window.outerWidth, yMax = window.outerHeight;
				else var xMax = 640, yMax=480;
			var xOffset = (xMax - ancho)/2, yOffset = (yMax - alto)/2 - 30;
			window.open(destino+'?ID_MODELO='+idModelo+'&ID_FAMILIA='+idFamilia+'&ID_CATALOGO='+idCatalogo+'&ID_GAMA='+gamaNueva,'FlotanteDetalleModelo'+tipoProducto,'scrollbars=yes,width='+ancho+',height='+alto+',top='+yOffset+',left='+xOffset);
		}
	}else{
		if ( idFamilia!= ''){
			//jsp de familia
			//En la posición 2 del array se guarda la jsp de la familia
			destino = buscarJspFamilia(idFamilia,2);
			form1.action=destino;
			if (idGama!= ''){
				document.getElementById("form1").ID_GAMA.value=idGama;
			}
			document.getElementById("form1").ID_FAMILIA.value=idFamilia;
			form1.submit();
		}else{
			if (idGama!= ''){
				//jsp de gama
				destino = "gama"+tipoProducto+".jsp";
				form1.action=destino;
				document.getElementById("form1").ID_GAMA.value=idGama;
				form1.submit();
			}
		}
	}
}

//**********************************************************************************************************
// * Función: setOverStyle ()									   *
// * Autor: Alvaro V.S.								                           *
// * Fecha Creación: 17/6/2004									           *
// * Objetivo:   Cambia el estilo de un enlace cuando se pasa el raton por encima			   *
// * Parámetros: 								                           *
//**********************************************************************************************************//
function setOverStyle(id,estilo){
   id.className=estilo;
}

//**********************************************************************************************************
// * Función: removeOverStyle ()									   *
// * Autor: Alvaro V.S.								                           *
// * Fecha Creación: 17/6/2004									           *
// * Objetivo:   Cambia el estilo de un enlace cuando se quita el raton de encima			   *
// * Parámetros: 								                           *
//**********************************************************************************************************//
function removeOverStyle(id,estilo)
{
	id.className=estilo;
}

//**********************************************************************************************************
// * Función: imagenOver()									 	   *
// * Autor: Alvaro V.S.								                           *
// * Fecha Creación: 24/6/2004									           *
// * Objetivo:   Cambia el estilo de la image cuando se pone el raton de encima			           *
// * Parámetros: 								                           *
//**********************************************************************************************************//
var anchoImagen;
var altoImagen;

function imagenOver(id){
	id.style.cursor='hand';
}

/*
* Método que busca en el array de familias el valor de una determinada posición
*   valor --> valor del combo familia de  solar, está formado por la idFamilia+ $$+ idGama
*   posicion --> posición dentro del array de familia que se quiere recuperar
*/
function buscarJspFamilia(valor, posicion){
	indice=parseInt(idFamilia.indexOf("$$"));
	idGama = valor.substring(indice+2,idFamilia.length);
	idFamilia = valor.substring(0,indice);
	if ( arrayFamilias && arrayFamilias[idGama]){
		for(i=0;i<arrayFamilias[idGama].length;i++){
			if(arrayFamilias[idGama][i]){
				if ( arrayFamilias[idGama][i][0]==valor){
					valorDevolver = arrayFamilias[idGama][i][posicion];
					return valorDevolver;
				}
			}
		}
	}
}

/*
* Método para buscar modelos desde el combo de la jsp de modelos en el catálogo solar
*/
function buscarModeloSolar(jsp){
	idModelo = document.getElementById("form1").modelos1.options[document.getElementById("form1").modelos1.selectedIndex].value;
	document.getElementById("form1").ID_FAMILIA.value=idFamiliaMOD;
	document.getElementById("form1").ID_MODELO.value =idModelo;
	document.getElementById("form1").ID_CATALOGO.value=idCatalogo;
	destino = jsp;
	form1.action = destino;
	form1.submit();
}

/*
* Método para imprimir
*/
function imprimirVentana(){
	if (window.print)
    		window.print();
  	else
	    alert("No se puede imprimir");
}

/**
* Método usado en las pantallas flotantes para link "mas información"
* cierra la ventana flotante y envía a la pantalla padre a la página de contacto
* correspondiente
*/
function buscarInformacion (jsp){
    window.opener.location.href=jsp;
    window.close();
}

//funciones javascript del catalogo

/*
function irDetalleGama(valorGama, jsp, valorCat){
	formulario.action = jsp;
	formulario.ID_GAMA.value = valorGama;
	formulario.ID_CATALOGO.value= valorCat; //'<%if (elementoCatalogo != null && elementoCatalogo.getChild("IdCatalogo") != null ){%><%=((Elemento)elementoCatalogo.getChild("IdCatalogo")).getValorString()%><%}%>';
	formulario.submit();
}

function irDetalleGamaCalentadores(valor, valorCat){
	formulario.action = 'familiaCalentadores.jsp';
	formulario.ID_GAMA.value = valor;
	formulario.ID_CATALOGO.value = valorCat; //'<%if (elementoCatalogo != null && elementoCatalogo.getChild("IdCatalogo") != null ){%><%=((Elemento)elementoCatalogo.getChild("IdCatalogo")).getValorString()%><%}%>';
	formulario.ID_FAMILIA.value = valor;
	formulario.submit();
}

function irDetalleGamaHep2O(valorGama, jsp, valorCat){
	formulario.action = jsp;
	formulario.ID_GAMA.value = valorGama;
	formulario.ID_CATALOGO.value = valorCat; //'<%if (elementoCatalogo != null && elementoCatalogo.getChild("IdCatalogo") != null ){%><%=((Elemento)elementoCatalogo.getChild("IdCatalogo")).getValorString()%><%}%>';
	formulario.submit();
}


function irDetalle(valorFam, valorGama, valorCat){
	formulario.ID_GAMA.value = valorGama; //'<%=request.getParameter("ID_GAMA")%>';
	formulario.ID_CATALOGO.value = valorCat; //'<%=request.getParameter("ID_CATALOGO")%>';
	formulario.ID_FAMILIA.value = valorFam;
	formulario.submit();
}

function irDetalleSolar(valorFam, jsp, valorGama, valorCat){
	formulario.ID_GAMA.value = valorGama; //'<%=request.getParameter("ID_GAMA")%>';
	formulario.ID_CATALOGO.value = valorCat; //'<%=request.getParameter("ID_CATALOGO")%>';
	formulario.ID_FAMILIA.value = valorFam;
	formulario.action=jsp;
	formulario.submit();
}
*/