function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function hideRecipient(nombre, dominio){
	document.write("<input type='hidden' name='recipient' value='"+nombre+"@"+dominio+"'>");
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.id; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- El campo \"'+nm+'\" ha de contener una dirección de correo válida. \n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- El campo \"'+nm+'\" ha de ser numérico.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- El campo \"'+nm+'\" debe contener un número entre '+min+' y '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- El campo \"'+nm+'\" es obligatorio.\n'; }
  } if (errors) alert('Hay los siguientes errores:\n\n'+errors+'\n');
  document.MM_returnValue = (errors == '');
}

function eliminar(elemento,url){
	if (confirm('Se procederá a eliminar el elemento \"' + elemento + '\".¿Desea continuar?')){
		window.location = url;
	}
}

function displayObject(checkObj,obj){
	if(document.getElementById(checkObj).checked == true) document.getElementById(obj).style.display = "none";
	else document.getElementById(obj).style.display = "block";
}


//funciones para la visualizacion de los formularios de selección de servicios
function mostrar_familiaSub(){

	if (document.form1.anterior.value==""){
		document.form1.anterior.value = document.form1.select1.value;
	}
	else{
			
		document.getElementById("familia"+document.form1.anterior.value).style.display = "none";	
		document.form1.anterior.value = document.form1.select1.value;
	}
	document.getElementById("familia"+document.form1.select1.value).style.display = "block";
	document.form1.valorseleccionat.value = document.form1["selectFam"+document.form1.select1.value].value;
	
}

function assignar_familiaSub(){

		document.form1.valorseleccionat.value = document.form1["selectFam"+document.form1.select1.value].value;

}


<!-- ------------------------------------------------------------------------------------------------------- -->

function mostrar_familia(){

	

	if (document.form1.anterior.value==""){
		document.form1.anterior.value = document.form1.select1.value;
	}
	else{
		
		if (document.form1.valorseleccionat.value==""){
		document.form1.valorseleccionat.value = document.form1["selectFam"+document.form1.select1.value].value;
		}
		else{
		document.getElementById("Subfamilia"+document.form1.valorseleccionat.value).style.display = "none";	
		document.form1.valorseleccionat.value = document.form1["selectFam"+document.form1.select1.value].value;
		}
		
		document.getElementById("familia"+document.form1.anterior.value).style.display = "none";	
		document.form1.anterior.value = document.form1.select1.value;
	}
	document.getElementById("familia"+document.form1.select1.value).style.display = "block";
	document.form1.valorseleccionat.value = document.form1["selectFam"+document.form1.select1.value].value;
	
}

function assignar_familia(){

		document.form1.valorseleccionat.value = document.form1["selectFam"+document.form1.select1.value].value;

}

function mostrar_subfamilia(){

	if (document.form1.valorseleccionat.value==""){
		document.form1.valorseleccionat.value = document.form1["selectFam"+document.form1.select1.value].value;
	}
	else{
		document.getElementById("Subfamilia"+document.form1.valorseleccionat.value).style.display = "none";	
		document.form1.valorseleccionat.value = document.form1["selectFam"+document.form1.select1.value].value;
	}
	document.getElementById("Subfamilia"+document.form1["selectFam"+document.form1.select1.value].value).style.display = "block";
	document.form1.valorseleccionatSub.value = document.form1["selectSubFam"+document.form1["selectFam"+document.form1.select1.value].value].value;
	
}

function mostrar_subfamilia_nou(){

	if (document.form1.valorseleccionat.value==""){
		document.form1.valorseleccionat.value = document.form1["selectFam"].value;
	}
	else{
		document.getElementById("Subfamilia"+document.form1.valorseleccionat.value).style.display = "none";	
		document.form1.valorseleccionat.value = document.form1["selectFam"].value;
	}
	document.getElementById("Subfamilia"+document.form1["selectFam"].value).style.display = "block";
	document.form1.valorseleccionatSub.value = document.form1["selectSubFam"+document.form1["selectFam"].value].value;
	
}

function assignar_subfamilia(){

		document.form1.valorseleccionatSub.value = document.form1["selectSubFam"+document.form1["selectFam"+document.form1.select1.value].value].value;

}

function assignar_subfamilia_nou(){

		document.form1.valorseleccionatSub.value = document.form1["selectSubFam"+document.form1["selectFam"].value].value;

}



<!-- ------------------------------------------------------------------------------------------------------- -->

function mostrar_familiaProducte(){

	

	if (document.form1.anterior.value==""){
		document.form1.anterior.value = document.form1.select1.value;
	}
	else{
		
		if (document.form1.valorseleccionat.value==""){
		document.form1.valorseleccionat.value = document.form1["selectFam"+document.form1.select1.value].value;
		}
		else{
				if (document.form1.valorseleccionatSub.value==""){
					document.form1.valorseleccionatSub.value = document.form1["selectSubFam"+document.form1["selectFam"+document.form1.select1.value].value].value;
				}
				else{
					document.getElementById("Producte"+document.form1.valorseleccionatSub.value).style.display = "none";	
					document.form1.valorseleccionatSub.value = document.form1["selectSubFam"+document.form1["selectFam"+document.form1.select1.value].value].value;
				}
		document.getElementById("Subfamilia"+document.form1.valorseleccionat.value).style.display = "none";	
		document.form1.valorseleccionat.value = document.form1["selectFam"+document.form1.select1.value].value;
		}
		
		document.getElementById("familia"+document.form1.anterior.value).style.display = "none";	
		document.form1.anterior.value = document.form1.select1.value;
	}
	document.getElementById("familia"+document.form1.select1.value).style.display = "block";
	document.form1.valorseleccionat.value = document.form1["selectFam"+document.form1.select1.value].value;
	
}

function assignar_familiaProducte(){

		document.form1.valorseleccionat.value = document.form1["selectFam"+document.form1.select1.value].value;

}

function mostrar_subfamiliaProducte(){

	if (document.form1.valorseleccionat.value==""){
		document.form1.valorseleccionat.value = document.form1["selectFam"+document.form1.select1.value].value;
	}
	else{
			if (document.form1.valorseleccionatSub.value==""){
				document.form1.valorseleccionatSub.value = document.form1["selectSubFam"+document.form1["selectFam"+document.form1.select1.value].value].value;
			}
			else{
				document.getElementById("Producte"+document.form1.valorseleccionatSub.value).style.display = "none";	
				document.form1.valorseleccionatSub.value = document.form1["selectSubFam"+document.form1["selectFam"+document.form1.select1.value].value].value;
			}
		document.getElementById("Subfamilia"+document.form1.valorseleccionat.value).style.display = "none";	
		document.form1.valorseleccionat.value = document.form1["selectFam"+document.form1.select1.value].value;
	}
	document.getElementById("Subfamilia"+document.form1["selectFam"+document.form1.select1.value].value).style.display = "block";
	document.form1.valorseleccionatSub.value = document.form1["selectSubFam"+document.form1["selectFam"+document.form1.select1.value].value].value;
	
}

function mostrar_subfamiliaProducte_nou(){

	if (document.form1.valorseleccionat.value==""){
		document.form1.valorseleccionat.value = document.form1["selectFam"].value;
	}
	else{
			if (document.form1.valorseleccionatSub.value==""){
				document.form1.valorseleccionatSub.value = document.form1["selectSubFam"+document.form1["selectFam"].value].value;
			}
			else{
				document.getElementById("Producte"+document.form1.valorseleccionatSub.value).style.display = "none";	
				document.form1.valorseleccionatSub.value = document.form1["selectSubFam"+document.form1["selectFam"].value].value;
			}
		document.getElementById("Subfamilia"+document.form1.valorseleccionat.value).style.display = "none";	
		document.form1.valorseleccionat.value = document.form1["selectFam"].value;
	}
	document.getElementById("Subfamilia"+document.form1["selectFam"].value).style.display = "block";
	document.form1.valorseleccionatSub.value = document.form1["selectSubFam"+document.form1["selectFam"].value].value;
	
}

function assignar_subfamiliaProducte(){

		document.form1.valorseleccionatSub.value = document.form1["selectSubFam"+document.form1["selectFam"+document.form1.select1.value].value].value;

}

function mostrar_ProducteProducte(){

	if (document.form1.valorseleccionatSub.value==""){
		document.form1.valorseleccionatSub.value = document.form1["selectSubFam"+document.form1["selectFam"+document.form1.select1.value].value].value;
	}
	else{
		document.getElementById("Producte"+document.form1.valorseleccionatSub.value).style.display = "none";	
		document.form1.valorseleccionatSub.value = document.form1["selectSubFam"+document.form1["selectFam"+document.form1.select1.value].value].value;
	}
	document.getElementById("Producte"+document.form1["selectSubFam"+document.form1["selectFam"+document.form1.select1.value].value].value).style.display = "block";

	document.form1.valorseleccionatProdcute.value = document.form1["selectProducte"+document.form1["selectSubFam"+document.form1["selectFam"+document.form1.select1.value].value].value].value;	
}

function mostrar_ProducteProducte_nou(){

	if (document.form1.valorseleccionatSub.value==""){
		document.form1.valorseleccionatSub.value = document.form1["selectSubFam"+document.form1["selectFam"].value].value;
	}
	else{
		document.getElementById("Producte"+document.form1.valorseleccionatSub.value).style.display = "none";	
		document.form1.valorseleccionatSub.value = document.form1["selectSubFam"+document.form1["selectFam"].value].value;
	}
	document.getElementById("Producte"+document.form1["selectSubFam"+document.form1["selectFam"].value].value).style.display = "block";

	document.form1.valorseleccionatProdcute.value = document.form1["selectProducte"+document.form1["selectSubFam"+document.form1["selectFam"].value].value].value;	
}

function assignar_ProducteProducte(){

		document.form1.valorseleccionatProdcute.value = document.form1["selectProducte"+document.form1["selectSubFam"+document.form1["selectFam"+document.form1.select1.value].value].value].value;

}

function assignar_ProducteProducte_nou(){

		document.form1.valorseleccionatProdcute.value = document.form1["selectProducte"+document.form1["selectSubFam"+document.form1["selectFam"].value].value].value;

}

<!-- Buscador de la web-->

function mostrar_familiaBUSC(){

	if (document.buscadorProductes.marca.value==""){
		document.buscadorProductes.marca.value = document.getElementById("select1").value;
	}
	else{
		document.getElementById("familia"+document.buscadorProductes.marca.value).style.display = "none";	
		document.buscadorProductes.marca.value = document.getElementById("select1").value;
	}
	if (document.buscadorProductes.marca.value!=""){
		document.getElementById("selectFamBuida").style.display = "none"; 
		document.getElementById("familia"+document.getElementById("select1").value).style.display = "block";
			document.buscadorProductes.familiaSelec.value = document.buscadorProductes["selectFam"+document.getElementById("select1").value].value;
	 }
	else{
		document.getElementById("selectFamBuida").style.display = "block";
	}
	
	

	
}

function assignar_familiaBUSC(){

		document.buscadorProductes.familiaSelec.value = document.buscadorProductes["selectFam"+document.getElementById("select1").value].value;

}

function inicializa (valor) {
	if ((valor) == 'true') {
		document.getElementById("categoria").style.display = "none";
		document.getElementById("servicios").style.display = "none";
	}
}