function contains(a, b) {
			while (b.parentNode)
		   	if ((b = b.parentNode) == a)
				return true;
			return false;
		}
		
function cambia_imagen(id,src){
	document.getElementById(id).src = "grafics/"+src;
}		


/*	CONDICIONES	*/
function condiciones(obligatorios,email){
	if(
		isWhitespace(document.form_contacte.nombre.value) || isWhitespace(document.form_contacte.email.value)||
		(document.form_contacte.nombre.value=="Nombre") || (document.form_contacte.email.value=="E-mail")||
		(document.form_contacte.nombre.value=="") ||(document.form_contacte.email.value=="")
		)
		{
			alert (obligatorios);
			return;			
		}
		if(!isEmail(document.getElementById("email").value))
		{
			alert (email);
			return;
		}

document.form_contacte.submit();// JavaScript Document

}
function muestra(id,num)
{
	var radio=document.getElementById(id+num);
	if ((radio.style.display)==("none"))
		{
			radio.style.display="block";
			return;
		}
	if ((radio.style.display)==("block"))
		{
			radio.style.display="none";
			return;
		}		
	
		
}

function BuscaProductes(id_cat, text) {
	var oSelPoblacio=document.getElementById("buscador_2");
	var oSelCategoria=document.getElementById("buscador_3");
	;
	
	if (oSelPoblacio.value==0 && oSelCategoria.value==0) {
		alert (text);
		return false;
	}
	else {
		var url="catalegbuscador.php?idc="+id_cat+"&idp="+oSelPoblacio.value+"&idcat="+oSelCategoria.value;
		document.location=url;
	}
}

function TancaDetall() {
	document.getElementById("fade").style.display='none';
	document.getElementById("loading").style.display='none';
}

