<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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 MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

function popup(url,windowname,width,height,features) { 

width=(width)?width:screen.width/2; 
height=(height)?height:screen.height/2; 
var screenX = (screen.width/2 - width/2); 
var screenY = (screen.height/2 - height/2); 
var features= "width=" + width + ",height=" + height +",scrollbars=yes,status=no"; 
features += ",screenX=" + screenX + ",left=" + screenX; 
features += ",screenY=" + screenY + ",top=" + screenY; 

var mywin=window.open(url, windowname, features); 
if (mywin) 
mywin.focus(); 
return mywin; 
}

function validaDades() {
var a = document.getElementById("f_nombre");	
var b = document.getElementById("f_email");	
var c = document.getElementById("f_privacidad");	

var missatge_requerits = "Por favor, rellena todos los campos requeridos";
var missatge_privacitat = "Para poder recibir información debes aceptar nuestra política de privacidad";

if(a.value == '') {
	alert(missatge_requerits);
	a.focus();
	return false;
} 

else if (b.value == '') {
	alert(missatge_requerits);
	b.focus();
	return false;
}

else if (!c.checked) {
	alert(missatge_privacitat);
	c.focus();
	return false;
}

return true;
}

function pasar_test() {
	validacion = 0;
	for (i = 0; i <= document.test.length - 2; i++) {
		if (document.test.elements[i].name.slice(0,5) == 'text_') { 
			if (document.test.elements[i].value == "" || document.test.elements[i].value == " ") { 
				validacion = 1;
			} else {
				if (isNaN(document.test.elements[i].value)) {
					validacion = 1;
				} else {
					if (document.test.elements[i].value == "0") {
						validacion = 1;
					}					
				}
			}
		}
	}	
	
	if (validacion == 1) {
		alert("Por favor, responda las preguntas asignando una puntuación entre 1 y 9 puntos a cada una");
	} else {
		document.test.submit();
	}
}

function cambio_test() {
	total = 0;
	for (i = 0; i <= document.test.length - 2; i++) {
		if (document.test.elements[i].name.slice(0,5) == 'text_') { 
			if (document.test.elements[i].value != "" && document.test.elements[i].value != " ") { 
				if (!(isNaN(document.test.elements[i].value))) {
					total = total + Number(document.test.elements[i].value) ;
				}
			}
		}
	}
	document.getElementById('camp_total').innerHTML = total;
}