// JavaScript Document
function apriFotoGallery(idPhoto){
	if(idPhoto!=""){
		winGallery=window.open("showGallery.php?idPhoto=" + idPhoto, "gallery", "left=100, top=80, status=0, resizable=0, directories=0, toolbars=0, menubar=0, scrollbars=1");
		winGallery.focus();
	}
}

function changeImage(newImage, nomeTag){
	document.images[nomeTag].src="images/"+newImage+".jpg";
}
function controlloInvio(){
	nomeForm=document.contactform;
	if(nomeForm.nome.value==""){
		alert("inserire il nome");
		nomeForm.nome.focus();
		return;
	}
	if(nomeForm.cognome.value==""){
		alert("inserire il cognome");
		nomeForm.cognome.focus();
		return;
	}
	if(!checkEmailAddress(nomeForm.email)) return;
	nomeForm.submit();
}

var indirizzoEmail;
function checkEmailAddress(field) {

     var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
     
     if (goodEmail){
        indirizzoEmail = true
     } 
     else {
        alert('Inserire un indirizzo email valido');
        field.focus();
        field.select();
        indirizzoEmail = false;
        }
  	return indirizzoEmail;
}

function loadswf(swf, ivp, w, h){
	document.write("<object");
	document.write("width=\""+w+"\" height=\""+h+"\"");
	document.write("codebase=\"http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab#version=9,0,0,0\">");
	document.write("<param name=\"movie\" value=\""+swf+"\" />");
	document.write("<param name=\"allowScriptAccess\" value=\"sameDomain\" />");
	document.write("<param name=\"allowFullScreen\" value=\"true\" />");
	document.write("<param name='flashvars' value='panorama="+ivp+"' />");
	document.write("<embed src=\""+swf+"\""); 
	document.write("width=\""+w+"\" height=\""+h+"\" align=\"middle\"");
	document.write("play=\"true\"");
	document.write("loop=\"false\"");
	document.write("quality=\"high\"");
	document.write("allowScriptAccess=\"sameDomain\"");
	document.write("allowFullScreen=\"true\"");
	document.write("flashvars=\"panorama="+ivp+"\"");
	document.write("type=\"application/x-shockwave-flash\"");
	document.write("pluginspage=\"http://www.adobe.com/go/getflashplayer\">");
	document.write("</embed>");
	document.write("</object>");
}