
function popupc(URL,w,h,s){var l= Math.floor((screen.width-w)/2);var t = Math.floor((screen.height-h)/2);window.open(URL,"","width=" + w + ",height=" + h + ",top=" + t + ",left=" + l+ 'toolbar=0,scrollbars='+(s?'yes':'no')+',location=no,statusbar=no,menubar=no,resizable=no');}
var Checker={
	checks:{'nome':/.+/,'cognome':/.+/,'citta':/.+/,'indirizzo':/.+/,'provincia':/.+/,'telefono':/[\d\- \/\\]+/,'email':/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/},
	check_form:function(){
		for(i in this.checks){
			el=document.getElementById(i);
			if(!this.checks[i].test(el.value)){
				el.focus();
				alert('Il campo "'+el.name+'" non sembra corretto.');
				return false;
			}
		}
		return true;
	}
};
input_focus=function(){
	this.style.backgroundColor='#eaeff8';
	this.style.color='#3499cc';
	this.style.fontWeight='bold';
};
input_blur=function(){
	this.style.backgroundColor='#f4f4f4';
	this.style.color='#404147';
	this.style.fontWeight='normal';
};
window.onload=function(){
	inputs=document.getElementById('contatti').getElementsByTagName('input');
	inputs[inputs.length]=document.getElementById('contatti').getElementsByTagName('textarea')[0];
	for(i=0; i<inputs.length+1;i++){
		
		inputs[i].onfocus=input_focus;
		inputs[i].onblur=input_blur;
	}
	inputs[0].focus();
	document.getElementById('send').onclick=function(){
		if(Checker.check_form())document.getElementById('contatti').submit();
	};
};