<!--
/*
'°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
' Copyright (C) 2010 Mariano Di Maria.
' Tutti i diritti riservati.
' http://www.elabografica.it  -  Email: info@elabografica.it
'°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
	
'-------------------------------------------------------
' NOME:			supporto.js
'
' DESCRIZIONE:	Client side scripts
' DATA:			18/06/2010
'-------------------------------------------------------
*/

// function riempi() { 
//	if (window.screen) { 
//		var w = screen.availWidth; 
//		var h = screen.availHeight; 
//		window.moveTo(0, 0); 
//		window.resizeTo(w, h); 
//	} 
//} 

//-->

// Gestore focus su textbox
function FocusTextBox(OBJ,BACKGROUND,TESTO){
	//Se IE5+ o NS6+
	if (document.documentElement){
		OBJ.style.backgroundColor=BACKGROUND;
		OBJ.style.color=TESTO;
	}
}
//-->

// CHIUDE LA FINESTRA

<!--

function winclose(URL){
	var wind;
	wind = window.close(URL);
					}	

// -->


<!--
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];}
}
//-->


// Pop-Up

<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->



// Controlla la compilazione dei campi
function risultatof(preventivi)
{


// Crea le variabili
var campo1 = document.preventivi.Nome
var campo2 = document.preventivi.Cognome
var campo3 = document.preventivi.Email
var campo4 = document.preventivi.Telefono
var campo5 = document.preventivi.Destinazione
var campo6 = document.preventivi.Periodo
var campo7 = document.preventivi.N_Partecipanti


//// campo1 = document.preventivi.Nome -----------------------------------------------

  //if (document.preventivi.Nome.value == "")
  
  if (campo1.value == "")
  {
    alert("Inserire il Nome\.");
    campo1.focus();
    return (false);
  }

  if (campo1.value.length < 4)
  {
    alert("Compilare correttamente il campo Nome\.");
    campo1.focus();
    return (false);
  }

  if (campo1.value.length > 20)
  {
    alert("E' stato superato il massimo dei caratteri consentiti nel campo Nome\.");
    campo1.focus();
    return (false);
  }

  
//// campo2 = document.preventivi.Cognome -----------------------------------------------

  //if (document.preventivi.Nome.value == "")
  
  if (campo2.value == "")
  {
    alert("Inserire il Cognome\.");
    campo2.focus();
    return (false);
  }

  if (campo1.value.length < 4)
  {
    alert("Compilare correttamente il campo Cognome\.");
    campo2.focus();
    return (false);
  }

  if (campo2.value.length > 20)
  {
    alert("E' stato superato il massimo dei caratteri consentiti nel campo Cognome\.");
    campo2.focus();
    return (false);
  }


//// campo3 = document.preventivi.Email -------------------------------------
  
    if (campo3.value == "")
  {
    alert("Inserire la tua E-mail\.");
    campo3.focus();
    return (false);
  }

  if (campo3.value.length < 5)
  {
    alert("Compilare correttamente il campo E-mail\.");
    campo3.focus();
    return (false);
  }

  if (campo3.value.length > 40)
  {
    alert("E' stato superato il massimo dei caratteri consentiti per il campo E-mail\.");
    campo3.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789-@_-?!&.";
  var checkStr = campo3.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Compilare correttamente i dati nel campo\.");
    campo3.focus();
    return (false);
  }


//// campo4 = document.preventivi.Telefono -------------------------------------
  
  if (campo4.value == "")
  {
    alert("Inserire il numero di telefono\.");
   campo4.focus();
    return (false);
  }

  if (campo4.value.length < 6)
  {
    alert("Compilare correttamente il numero telefonico\.");
    campo4.focus();
    return (false);
  }

  if (campo4.value.length > 20)
  {
    alert("E' stato superato il massimo dei numeri consentiti per il numero telefonico\.");
    campo4.focus();
    return (false);
  }

  var checkOK = "0123456789-";
  var checkStr = campo4.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Inserire prefisso e numero di telefono senza spazi\.");
    campo4.focus();
    return (false);
  }

//// campo5 = document.preventivi.Destinazione -------------------------------------
  
    if (campo5.value == "")
  {
    alert("Inserire la destinazione\.");
    campo5.focus();
    return (false);
  }

  if (campo5.value.length < 2)
  {
    alert("Compilare correttamente il campo destinazione\.");
    campo5.focus();
    return (false);
  }

  if (campo5.value.length > 50)
  {
    alert("E' stato superato il massimo dei caratteri consentiti nel campo destinazione\.");
    campo5.focus();
    return (false);
  }


//// campo6 = document.preventivi.Periodo -------------------------------------
  
    if (campo6.value == "")
  {
    alert("Inserire il periodo\.");
    campo6.focus();
    return (false);
  }

  if (campo6.value.length < 2)
  {
    alert("Compilare correttamente il campo periodo\.");
    campo6.focus();
    return (false);
  }

  if (campo6.value.length > 50)
  {
    alert("E' stato superato il massimo dei caratteri consentiti nel campo periodo\.");
    campo6.focus();
    return (false);
  }

//// campo7 = document.preventivi.N_Partecipanti --------------------------------------------
  
     if (campo7.value == "")
  {
    alert("Inserire il numero dei partecipanti\.");
    campo7.focus();
    return (false);
  }

//  if (campo7.value.length < 2)
//  {
//    alert("Compilare correttamente il campo periodo\.");
//    campo7.focus();
//    return (false);
//  }

//  if (campo7.value.length > 50)
//  {
//    alert("E' stato superato il massimo dei caratteri consentiti nel campo periodo\.");
//    campo7.focus();
//    return (false);
//  }
  

  

  return (true);
}  





