// JavaScript Document
function confirmaBorrar() {
	if(!confirm("Esteu segurs de voler esborrar l'element?")) {
		return false;
	} else {
		return true;
	}
}

function confirmaBorrarRetorn(adrecaretorn) {
	if(confirm("Esteu segurs de voler esborrar l'element?")) {
		document.location = adrecaretorn;
		return true;
	} else {
		return false;
	}
}

function comprova(valor, nom, clase) {
	if (valor.value=="") {
		alert ('El camp ' + nom + ' és obligatori');
		valor.className = clase;
		return false;
	} else {
		return true;
	}
}

function comprovaNumeric(valor, nom, clase) {
	if (isNaN(valor.value)) {
		alert ('El camp ' + nom + ' cal que tingui un valor numèric');
		valor.className = clase;
		return false;
	} else {
		return comprova(valor, nom, clase);
	}	
}

function comprovaCheck(valor, nom, clase) {
	if (valor.checked) {
		return true;
	} else {
		alert ('El camp ' + nom + ' és obligatori');
		valor.className = clase;
		return false;
	}
}


function obrirFinestra(amplada,alcada,desti) {
	var w = amplada, h = alcada;
    window.open(desti,'windowName','width=' + w + ',height=' + h + ',scrollbars=no,resizable=no');
}
function obrirFinestraScroll(amplada,alcada,desti) {
	var w = amplada, h = alcada;
    window.open(desti,'windowName','width=' + w + ',height=' + h + ',scrollbars=yes,resizable=yes');
}
