// JavaScript Document
function apriPopupCentrata(nome, titolo, lar, alt, feat){
   var wdt = screen.width;
   var hgt = screen.height;
   var x = Math.round( (wdt / 2) - (lar / 2) );
   var y = Math.round( (hgt / 2) - (alt / 2) );
   window.open(nome, titolo, 'width=' + lar + ',height=' + alt + ',left=' + x + ',screenX=' + x + ',top=' + y + ',screenY=' + y + ',' + feat);
}

function NewWindow(mypage, myname, w, h) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl;
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function NewWindow2(mypage, myname, w, h) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'scrollbars=yes,resizable=yes,height='+h+',width='+w+',top='+wint+',left='+winl;
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}


function apriFoto(chemin) {
	i1 = new Image;
	i1.src = chemin;
	html = '<HTML>\n<HEAD>\n<title>NUOVAFOTOGRAFIA</title>\n</HEAD>\n<BODY BGCOLOR="#000000" LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0>\n<CENTER><IMG SRC="'+chemin+'" BORDER=0 NAME=imageTest onLoad="window.resizeTo(document.imageTest.width+30,document.imageTest.height+20)"></CENTER>\n</BODY>\n</HTML>';
	popupImage = window.open('','foto','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=no,width=10,height=10,resizable=0');
	popupImage.document.open();
	popupImage.document.write(html);
	popupImage.document.close()
};

function CheckTextArea() {
	obj=document.getElementById( 'controllo' );
	mess="";
	document.getElementById('nome').style.backgroundColor="#FFFFFF";
	document.getElementById('indirizzo').style.backgroundColor="#FFFFFF";
	document.getElementById('telefono').style.backgroundColor="#FFFFFF";
	document.getElementById('subject').style.backgroundColor="#FFFFFF";
	document.getElementById('mail').style.backgroundColor="#FFFFFF";
	document.getElementById('messaggio').style.backgroundColor="#FFFFFF";
	if (obj.nome.value == "") {
		mess+=err_nome;
		document.getElementById('nome').style.backgroundColor="#E2EFF7";
	}
	if (obj.indirizzo.value == "") {
		if(mess==""){
			mess+=err_indirizzo;
		} else {
			mess+=", "+ err_indirizzo;
		}
		document.getElementById('indirizzo').style.backgroundColor="#E2EFF7";
	}
	if (obj.telefono.value == "") {
		if(mess==""){
			mess+=err_telefono;
		} else {
			mess+=", "+ err_telefono;
		}
		document.getElementById('telefono').style.backgroundColor="#E2EFF7";
	}
	if (obj.subject.value == "") {
		if(mess==""){
			mess+=err_subject;
		} else {
			mess+=", "+err_subject;
		}
		document.getElementById('subject').style.backgroundColor="#E2EFF7";
	}
	if (obj.mail.value == "") {
		if(mess==""){
			mess+=err_mail1;
		} else {
			mess+=", "+err_mail1;
		}
		document.getElementById('mail').style.backgroundColor="#E2EFF7";
	}
	if (obj.mail.value != "" && (obj.mail.value.indexOf("@") == -1 || obj.mail.value.indexOf(".") == -1 || obj.mail.value.length<6)) {
		if(mess==""){
			mess+=err_mail2;
		} else {
			mess+=", "+err_mail2;
		}
		document.getElementById('mail').style.backgroundColor="#E2EFF7";
	}
	if (obj.messaggio.value == "") {
		if(mess==""){
			mess+=err_messaggio;
		} else {
			mess+=", "+err_messaggio;
		}
		document.getElementById('messaggio').style.backgroundColor="#E2EFF7";
	}
	if (mess!="") {
		alert(err_invia+mess+".");
		return false;
		void(0);
	} else {
		obj.submit();
	}
	//return true
}
function veri() {
	obj=document.getElementById( 'domanda' );
	mess="";
	document.getElementById('testo').style.backgroundColor="#FFFFFF";
	if (obj.testo.value == "") {
		mess+=err_testo;
		document.getElementById('testo').style.backgroundColor="#E2EFF7";
	}
	if (mess!="") {
		alert(err_invia+mess+".");
		return false;
		void(0);
	} else {
		obj.submit();
	}
	//return true
}

