// JavaScript Document
function checkscript(idioma){
// valors obligatoris
nom = document.forms['frm_contacte'].elements['f_nom'];
email = document.forms['frm_contacte'].elements['f_email'];
telefon = document.forms['frm_contacte'].elements['f_telefon'];
codi = document.forms['frm_contacte'].elements['f_codi'];
captcha_session = document.forms['frm_contacte'].elements['f_captcha_session'];

switch(idioma){
	case "es":
	alerta_generica = "Por favor, compruebe que ha completado\ntodos los campos obligatorios";
	alerta_codi = "Por favor, compruebe el codigo";
	break;
	
	case "ca":
	alerta_generica = "Si us plau, comprovi que ha omplert\ntots els camps obligatoris";
	alerta_codi = "Si us plau, comprovi el codi";
	break;
	
	case "en":
	alerta_generica = "Please, check that you filled\nall required fields";
	alerta_codi = "Please, check the code";
	break;
	
	case "fr":
	alerta_generica = "Please, check that you filled\nall required fields";
	alerta_codi = "Please, check the code";
	break;
	
	case "de":
	alerta_generica = "Please, check that you filled\nall required fields";
	alerta_codi = "Please, check the code";
	break;
	
	case "jp":
	alerta_generica = "Please, check that you filled\nall required fields";
	alerta_codi = "Please, check the code";
	break;
}

if (nom.value == '')	{
	alert(alerta_generica);
	nom.focus();
	return false;
}
else if (email.value == '')	{
	alert(alerta_generica);
	email.focus();
	return false;
}
else if (telefon.value == '')	{
	alert(alerta_generica);
	telefon.focus();
	return false;
}
else if (codi.value.toUpperCase() != captcha_session.value)	{
	alert(alerta_codi);
	codi.focus();
	return false;
}
return true;
}

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=no,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; 
}