<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

var popWin = "";
function newWin(url,width,height){
	if(popWin.closed == false){popWin.close();popWin = null;}
	popWin = window.open(url,'popWin','toolbar=no,resizable=yes,width= ' + width + ' ,height= ' + height);
	popWin.focus();
}

//CONTROLLO DEI CAMPI DEL FORM
function check(theform){//alert(theform.length)
		for (var i=0;i<=theform.length-1;i++){				
			if (theform[i].value=="" && theform[i].type != "hidden" && theform[i].name != "descrizione_ita"&& theform[i].name != "descrizione_ing"){					
				alert("Il campo " + theform[i].name + " č obbligatorio");theform[i].focus();return false;}			
			if (theform[i].name=="mail"){						
					var mail = scanEmail(theform[i]);if (mail==false){theform[i].focus();return false}}
			if (theform[i].name=="cittā"){						
					var cittā = scanCampo(theform[i]);if (cittā==false){theform[i].focus();return false}}
			if (theform[i].name=="indirizzo"){						
					var cittā = scanCampo(theform[i]);if (cittā==false){theform[i].focus();return false}}	
			if (theform[i].name=="committente"){						
					var cittā = scanCampo(theform[i]);if (cittā==false){theform[i].focus();return false}}
			if (theform[i].name=="telefono"){						
					var cittā = scannumero(theform[i]);if (cittā==false){theform[i].focus();return false}}	
		}	
	}
	
//Check se il form di invio č correttamente riempito
function controllafile(theform) {
	for (var i=0;i<=theform.length-1;i++){				
		if (theform[i].value=="" && theform[i].type != "hidden"){					
			alert("Il campo " + theform[i].userfile + " č obbligatorio");theform[i].focus();return false;
		}
		if (theform[i].name=="userfile"){
			var nomefile = theform[i].value;
			nomefile = nomefile.substr(nomefile.lastIndexOf(".")+1);
			if (nomefile != "gif" && nomefile != "jpg" && nomefile != "png" && nomefile != "JPG" && nomefile != "PNG" && nomefile != "GIF" && nomefile != "jpeg" && nomefile != "JPEG"){
       			alert("Il formato "+nomefile+" non č valido.\n Si prega di inserire un file nei formati jpg, jpeg, gif o png.");theform[i].focus();return false;
			} 
		}
	}
} 
	
//CONTROLLA LA VALIDITA' DEL CAMPO EMAIL
function scanCampo(cittā){									
	var iChars = "*|,\<:>[]{}\;()&$#%@";
	var at = 0;																	
	for (var i=0; i < cittā.value.length; i++){
		if (iChars.indexOf(cittā.value.charAt(i)) != -1){
			alert("Il carattere " + cittā.value.charAt(i) + " non č consentito");return false;}
		}			
	}

function scannumero(cittā){									
	var iChars = "*|,\"\'\<:>[]{}\;()&$#%@";
	var at = 0;																	
	for (var i=0; i < cittā.value.length; i++){
		if (iChars.indexOf(cittā.value.charAt(i)) != -1){
			alert("Il carattere " + cittā.value.charAt(i) + " non č consentito");return false;}
		}			
	}
	
function scanEmail(mail){									
	var iChars = "*|,\"\/<:>[]{}`\';()&$#%";
	var at = 0;																	
	for (var i=0; i < mail.value.length; i++){
		if (iChars.indexOf(mail.value.charAt(i)) != -1){
			alert("Il carattere " + mail.value.charAt(i) + " non č consentito");return false;}
		if (mail.value.charAt(i) == "@"){at = at + 1;}
		}			
	if (at != 1){alert("Indirizzo email non consentito");return false}		
	}
	
function PopupCentrata(url,width,height) {
   var w = width;
   var h = height;
   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);
 }
 
function conferma(id)
{
	conf = confirm("Sei sicuro di voler cancellare il record " + id + "? \n\n L\'operazione non potrā essere annullata")
	if (conf==true){return true}	
	else{return false}
}
function gallery(theform)
{
	if (theform[i].name=="upload"){					
				alert("Il campo " + theform[i].name + " č uploadato");return true;}		
}
//-->
