//Comprovem que es voti algo
function comprovarChecks() {
	maxim = $(".opcioenquesta:checked").length;
	if(maxim == 1) {
		document.getElementById('fenquesta').submit();
	} else {
		alert("Ha d'escollir una opció abans de votar");
	}
}

function igualar2Capes(capa1,capa2) {
		
	vcapa1 = document.getElementById(capa1).offsetHeight;
	vcapa2 = document.getElementById(capa2).offsetHeight;
	
	capaMesGran = Math.max(vcapa1,vcapa2);
	
	document.getElementById(capa1).style.height  = capaMesGran-10+'px';
	document.getElementById(capa2).style.height  = capaMesGran-10+'px';
}

function igualar3Capes(capa1,capa2,capa3) {
	
	vcapa1 = document.getElementById(capa1).offsetHeight;
	vcapa2 = document.getElementById(capa2).offsetHeight;
	vcapa3 = document.getElementById(capa3).offsetHeight;
	
	capaTemporal = Math.max(vcapa1,vcapa2);
	capaMesGran = Math.max(capaTemporal,vcapa3);
	
	document.getElementById(capa1).style.height  = capaMesGran-10+'px';
	document.getElementById(capa2).style.height  = capaMesGran-10+'px';
	document.getElementById(capa3).style.height  = capaMesGran-10+'px';
}

/**
 * Comprova quantitat màxima dels textarea
 **/
function limitText(limitField, limitNum, limitId) {
   if (limitField.value.length > limitNum) {
      limitField.value = limitField.value.substring(0, limitNum);
   } else {
      document.getElementById(limitId).innerHTML = "&nbsp;"+(limitNum - limitField.value.length)+"&nbsp;";
   }
}

/**
 * Funció de comprovació del mail
 **/
function isValidEmail(valor) {
    var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
        if (filter.test(valor)) { return true; }
            else { return false; }
}
/**
 * Funció de comprovació d'URL
 **/
function isValidURL(valor) {
     var filter= /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{2,4}/;
		if (filter.test(valor)) { return true; }
			else { return false; }
}
