function popup(path,width,height,target) {
    if (target=="" || target==undefined) target="_blank";
    if (width=="" || width==undefined) width=500;
    if (height=="" || height==undefined) height=460;
    features = "width="+width+", height="+height+", scrollbars=yes status=yes resizable=no";

		sWidth = 1024;    
		sHeight = 768;
    if(typeof(screen)=='object') {
		 	sWidth = screen.width;
		 	sHeight = screen.height;
		}
		
		xPos = (sWidth-width)/2;
		yPos = (sHeight-height)/2;

    window_handle = window.open(path,target,features);   
    window_handle.moveTo(xPos, yPos);
    window_handle.focus(); 
};

function isemail(myemail)   {
   Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
   if (Filtro.test(myemail)) return true;
   else return false;
}

function submitMail(){
 	document.formPage.fName.style.backgroundColor="#FFFFFF";
	document.formPage.fSurname.style.backgroundColor="#FFFFFF";
	document.formPage.fTel.style.backgroundColor="#FFFFFF";
	document.formPage.fEmail.style.backgroundColor="#FFFFFF";
	document.formPage.fContent.style.backgroundColor="#FFFFFF";
	
	var error = "";

	if(document.formPage.fEmail.value == "") { 
		error += "\n- Devi indicare l'indirizzo email";
		document.formPage.fEmail.style.backgroundColor="#FFCC00"; document.formPage.fEmail.focus();
	}
	else if (!isemail(document.formPage.fEmail.value)){
		error += "\n- L'indirizzo email specificato non ha un formato corretto"
		document.formPage.fEmail.style.backgroundColor="#FFCC00"; 
		document.formPage.fEmail.focus();
	}

	if(document.formPage.fTel.value == "") { 
		error += "\n- Devi i recapiti telefonici";
		document.formPage.fTel.style.backgroundColor="#FFCC00"; document.formPage.fTel.focus();
	}

	if(document.formPage.fSurname.value == "") { 
		error += "\n- Devi indicare il cognome";
		document.formPage.fSurname.style.backgroundColor="#FFCC00"; document.formPage.fSurname.focus();
	}

	if(document.formPage.fName.value == "") { 
		error += "\n- Devi indicare il nome";
		document.formPage.fName.style.backgroundColor="#FFCC00"; document.formPage.fName.focus();
	}
 
	if (error != "") {
		alert(error);
		return;
	}
		
	document.formPage.submit();
}