function popup(url,windowname,width,height,p_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); 

if (p_features == ''){
	var features= "width=" + width + ",height=" + height +",scrollbars=no,status=no"; 
	features += ",screenX=" + screenX + ",left=" + screenX; 
	features += ",screenY=" + screenY + ",top=" + screenY; 
}
else {
	var features= "width=" + width + ",height=" + height +", " + p_features +",status=no"; 
	features += ",screenX=" + screenX + ",left=" + screenX; 
	features += ",screenY=" + screenY + ",top=" + screenY; 
	//var features = p_features + ",toolbar=no,menubar=no,status=no,width=" + width + ",height=" + height;
}

var mywin=window.open(url, windowname, features); 
if (mywin) 
mywin.focus(); 
return mywin; 
} 

function checkscript(idioma){
// valors obligatoris
nom = document.forms['frm_contacte'].elements['nom_i_cognoms'];
empresa = document.forms['frm_contacte'].elements['empresa'];
telefon = document.forms['frm_contacte'].elements['telefon'];
email = document.forms['frm_contacte'].elements['email'];

switch(idioma) {
case "ca":
alerta_nom = "Si us plau, faciliti'ns el seu nom \nper tal que poguem atendre la seva consulta";
alerta_telefon = "Si us plau, faciliti'ns el seu telfon \nper tal que poguem atendre la seva consulta";
alerta_empresa = "Si us plau, faciliti'ns el nom de la seva empresa \nper tal que poguem atendre la seva consulta";
alerta_email = "Si us plau, faciliti'ns el seu e-mail \nper tal que poguem atendre la seva consulta";
break;

case "es":
alerta_nom = "Por favor, faciltenos su nombre\npara que podamos atender su consulta";
alerta_telefon = "Por favor, faciltenos su telfono\npara que podamos atender su consulta";
alerta_empresa = "Por favor, faciltenos el nombre de su empresa\npara que podamos atender su consulta";
alerta_email = "Por favor, faciltenos su e-mail\npara que podamos atender su consulta";
break;
}

if (nom.value == '')	{
	alert(alerta_nom);
	nom.focus();
	return false;
}
else if (empresa.value == '')	{
	alert(alerta_empresa);
	empresa.focus();
	return false;
}
else if (telefon.value == '')	{
	alert(alerta_telefon);
	telefon.focus();
	return false;
}
else if (email.value == '')	{
	alert(alerta_email);
	email.focus();
	return false;
}
return true;
}

/*function finestra(theURL, Name, popW, popH, scroll) { // V 1.0
var winleft = (screen.width - popW) / 2;
var winUp = (screen.height - popH) / 2;
winProp = 'width='+popW+',height='+popH+',left='+winleft+',top='+winUp+',scrollbars='+scroll+',resizable'
Win = window.open(theURL, Name, winProp)
if (parseInt(navigator.appVersion) >= 4) { Win.window.focus(); }

}*/

function finestra(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+',resizable'; 

var mywin=window.open(url, windowname, features); 
if (mywin) 
mywin.focus(); 
return mywin;
}