// JavaScript Document

function PopUp_Avviso(){
	w=450;h=320;
	settings = 'height='+h+',width='+w+',top=80,left=120,resizable,status=yes'
	win = window.open('/win_popup/disservizio.htm','',settings)
}

function Open_Video(theUrl) { //v3.0
	w=451;h=460;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	window.open('dettaglio/pdVideoStream.jsp?id='+theUrl,'video','left='+LeftPosition+',top='+TopPosition+',width='+w+',height='+h);
}


function Open_VideoM() { //v3.0
	w=451;h=460;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	window.open('dettaglio/pdVideoM.jsp?','video','left='+LeftPosition+',top='+TopPosition+',width='+w+',height='+h);
}

function Open_Video_Generico(theUrl,Testo) {
w=451;h=460;
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
window.open('../video/video.jsp?Testo='+Testo+'&theUrl='+theUrl,'video_generico','left='+LeftPosition+',top='+TopPosition+',width='+w+',height='+h);
}

function vota() {
//   if (sondaggio.voto[0].checked == true || sondaggio.voto[1].checked == true || sondaggio.voto[2].checked == true) {
   if (sondaggio.voto[0].checked == true || sondaggio.voto[1].checked == true) {
		// sondaggio.submit();
		var voto = sondaggio.voto[0].value;
		if (sondaggio.voto[1].checked) voto = sondaggio.voto[1].value;
		//if (sondaggio.voto[2].checked) voto = sondaggio.voto[2].value;
		var id = sondaggio.id.value;
		w=400;h=272;
		LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
		settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',resizable=no,status=no'
		window.open("dettaglio/pdSondaggio.jsp?id=" + id + "&voto=" + voto,"sondaggio",settings);
	} else {
		alert("Esprimi un voto per favore!");
	}
}

function Ceck_Combo()
 { 

		if ((document.cercaospedale.ass_serv.options[document.cercaospedale.ass_serv.selectedIndex].value != '*') && (document.cercaospedale.specialita.options			                  [document.cercaospedale.specialita.selectedIndex].value != '*'))
		 {
			  alert("Assistenza e Specialita' sono in alternativa")
			  document.cercaospedale.reset()
			  
			  return false
	         }
		//onsubmit="return Ceck_Combo()" NAME="cercaospedale" 
		//document.cercaospedale.method='post' 
		//document.cercaospedale.action='servizio/prterritorio.asp'
		//document.cercaospedale.submit()
}


var si = 1084
var no = 124
var nessuno = 0
var percsi = 0.0
var percno = 0.0
var percnessuno = 0.0
if ((si+no+nessuno) > 0) {
	percsi = Math.round((si/(si+no+nessuno)*1000.0),0)/10.0
	percno = Math.round((no/(si+no+nessuno)*1000.0),0)/10.0
	percnessuno = Math.round((100.0-percsi-percno)*10.0,0)/10.0;
}

function writeHTML(stringa)
{
document.write(stringa)
}

function Calendario() {
	
	var data, giorno, mese, date, year, s = "";
/*
	var settimana = new Array("Domenica","Lunedi","Martedi","Mercoledi","Giovedi","Venerdi","Sabato");
	var Mese	= new Array("Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre");           
	d = new Date();
	w = d.getDay();
	g = d.getDate();
	m = d.getMonth();   
	a = d.getYear();
	s = settimana[w] + ', ' + g + ' ' + Mese[m].toLowerCase() + ' ' + a;
*/
	data = new Date();
	giorno = data.getDay();
	mese = data.getMonth();
	date= data.getDate();
	year= data.getYear();
	
	if(year<1900)year=year+1900;
	
	if(giorno == 0) giorno = " Domenica ";
	if(giorno == 1) giorno = " Luned\ì ";
	if(giorno == 2) giorno = " Marted\ì ";
	if(giorno == 3) giorno = " Mercoled\ì ";
	if(giorno == 4) giorno = " Gioved\ì ";
	if(giorno == 5) giorno = " Venerd\ì ";
	if(giorno == 6) giorno = " Sabato ";
	
	if(mese == 0) mese = "Gennaio ";
	if(mese ==1) mese = "Febbraio ";
	if(mese ==2) mese = "Marzo ";
	if(mese ==3) mese = "Aprile ";
	if(mese ==4) mese = "Maggio ";
	if(mese ==5) mese = "Giugno ";
	if(mese ==6) mese = "Luglio ";
	if(mese ==7) mese = "Agosto ";
	if(mese ==8) mese = "Settembre ";
	if(mese ==9) mese = "Ottobre ";
	if(mese ==10) mese = "Novembre ";
	if(mese ==11) mese = "Dicembre";

	s = giorno+", "+date+" "+mese+" "+year;
	return(s);                                
}
function apriMenu(pagina)
	{
		msg=open(
			pagina,
			'SOP',
			'toolbar=no,directories=no,menubar=no,hotkeys=no,location=no,scrollbars=yes,width=500,height=500,top=0,left=0'
		);
	}
	
function apriPrivacy(pagina)
	{
		msg=open(
			pagina,
			'SOP',
			'toolbar=no,directories=no,menubar=no,hotkeys=no,location=no,scrollbars=yes,width=500,height=500,top=0,left=0'
		);
	}
	
function apriRivenditore(pagina)
	{
		msg=open(
			pagina,
			'SOP',
			'toolbar=no,directories=no,menubar=no,hotkeys=no,location=no,scrollbars=yes,width=500,height=500,top=0,left=0'
		);
	}
	
function indirizzoEmailValido(indirizzo) {
  if (window.RegExp) {
    var nonvalido = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
    var valido = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
    var regnv = new RegExp(nonvalido);
    var regv = new RegExp(valido);
    if (!regnv.test(indirizzo) && regv.test(indirizzo))
      return true;
    return false;
	}
  else {
    if(indirizzo.indexOf("@") >= 0)
      return true;
    return false;
  	}
  };
	
function controllaDati(modulo) {
	if (!indirizzoEmailValido(modulo.email.value)) {
		 	modulo.email.select();
			alert("Si prega di inserire un indirizzo email valido");
			return false;
		 	}
	if(modulo.remove.checked == false){	
		if( modulo.privacy.checked != true ) {
			alert ("prima di registrarsi leggere l'informativa sulla privacy e selezionare la check");
			return false;
			}
	 }
		else
			return true;		
};
		
function login_validator() {
	if (frmLogin.txtUsername.value == "") 
	{
		frmLogin.txtUsername.select();
		alert("Si prega di inserire uno username valido valido");
			return false;
	}
	if (frmLogin.txtPassword.value == "") 
	{
		frmLogin.txtPassword.select();
		alert("Si prega di inserire una password valida");
			return false;
	}
	else
		return true;
	};
	
function partitaIVA(sz_Codice) 
   { 
   var n_Val,n_Som1=0,n_Som2=0,lcv; 
   if (sz_Codice.length!=11 || isNaN(parseFloat(sz_Codice)) || parseFloat(sz_Codice)<parseFloat(0)) 
      return false; 
   
   for (lcv=0;lcv<9;lcv+=2) 
   { 
      n_Val=parseInt(sz_Codice.charAt(lcv)); 
      n_Som1+=n_Val; 
      n_Val=parseInt(sz_Codice.charAt(lcv+1)); 
      n_Som1+=Math.floor(n_Val/5) + (n_Val<<1) % 10; 
   } 
   n_Som2 = 10 - (n_Som1 % 10); 
   n_Val=parseInt(sz_Codice.charAt(10)); 
   if (n_Som2==n_Val) 
      return true; 
   return false; 
   } 


function codicefiscale(cfins)
{
    var validi, i, s, set1, set2, setpari, setdisp;
    if( cfins == '' )  return '';
    cfins = cfins.toUpperCase();
    if( cfins.length != 16 )
        return "La lunghezza del codice fiscale non è "
        +"corretta: il codice fiscale dovrebbe essere lungo\n"
        +"esattamente 16 caratteri.\n";
    validi = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    for( i = 0; i < 16; i++ ){
        if( validi.indexOf( cfins.charAt(i) ) == -1 )
            return "Il codice fiscale contiene un carattere non valido `" +
                cfins.charAt(i) +
                "'.\nI caratteri validi sono le lettere e le cifre.\n";
    }
    set1 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    set2 = "ABCDEFGHIJABCDEFGHIJKLMNOPQRSTUVWXYZ";
    setpari = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    setdisp = "BAKPLCQDREVOSFTGUHMINJWZYX";
    s = 0;
    for( i = 1; i <= 13; i += 2 )
        s += setpari.indexOf( set2.charAt( set1.indexOf( cfins.charAt(i) )));
    for( i = 0; i <= 14; i += 2 )
        s += setdisp.indexOf( set2.charAt( set1.indexOf( cfins.charAt(i) )));
    if( s%26 != cfins.charCodeAt(15)-'A'.charCodeAt(0) )
        return "Il codice fiscale non è corretto:\n"+
            "il codice di controllo non corrisponde.\n";
    return "";
}

   
function isEmail(what)
{
var i=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
if(!i.test(what)) { 
	alert("Il campo EMAIL non è valido."); 
		return false
				 }   
return true;
}
					
function registrazione_utente_Form_Validator(theForm)
{

  if( theForm.privacy.checked != true ) 
  {
	alert ("prima di registrarsi leggere l'informativa sulla privacy e selezionare la check");
	return false;
  }
  
  if (theForm.ragione_Sociale.value.length > 39)
  {
    alert("Inserire al massimo 16 caratteri per il campo RAGIONE SOCIALE");
    theForm.ragione_Sociale.focus();
    return (false);
  }

  var checkOK = "-_.,:;'^?£$%&/\|*éèìòàABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆ`ÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789- \t\r\n\f";
  var checkStr = theForm.ragione_Sociale.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 solo lettera, cifra e spazio caratteri nel campo RAGIONE SOCIALE");
    theForm.ragione_Sociale.focus();
    return (false);
  }
  
   if (theForm.nome_referente.value == "")
  {
    alert("Inserire un valore per il campo Nome Referente");
    theForm.nome_referente.focus();
    return (false);
  }
  
     if (theForm.cognome_referente.value == "")
  {
    alert("Inserire un valore per il campo Cognome Referente");
    theForm.cognome_referente.focus();
    return (false);
  }
  
//    if (theForm.codice_fiscale.value == "")
//  {
//    alert("Il codice fiscale è obbligatorio");
//    theForm.codice_fiscale.focus();
//    return (false);
//  }
  
//	if (theForm.codice_fiscale.value != "")
//  {    
//   var CFok=codicefiscale(theForm.codice_fiscale.value) 
//   if (CFok==false)
//      { 
//      alert("Codice Fiscale errato"); 
//      return false; 
//      } 
// 	}
  
      if (theForm.indirizzo.value == "")
  {
    alert("Inserire un valore per il campo Indirizzo");
    theForm.indirizzo.focus();
    return (false);
  } 
  
     if (theForm.citta.value == "")
  {
    alert("Inserire un valore per il campo Città");
    theForm.citta.focus();
    return (false);
  }
  
      if (theForm.cap.value == "")
  {
    alert("Inserire il codice di avviamento postale");
    theForm.cap.focus();
    return (false);
  }
      if (theForm.cap.value.length < 5 )
  {
    alert("Inserire 5 numeri nel campo codice di avviamento postale");
    theForm.cap.focus();
    return (false);
  }

//if (theForm.partita_iva.value != "")
//  {  
//   var PIvaOk=partitaIVA(theForm.partita_iva.value)
//   if (PIvaOk==false) 
//     { 
//     alert("Partita IVA errata"); 
//      return false; 
//     } 
//   }

  if (theForm.indirizzo.value.length > 50)
  {
    alert("Inserire al massimo 50 caratteri nel campo INDIRIZZO");
    theForm.indirizzo.focus();
    return (false);
  }

  var checkOK = "-_.,:;'^?£$%&/\|*éèìòàABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789- \t\r\n\f";
  var checkStr = theForm.indirizzo.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 solo lettera, cifra, spazio e \"-/\\,.\" caratteri nel campo INDIRIZZO");
    theForm.indirizzo.focus();
    return (false);
  }

  if (theForm.cap.value.length > 5)
  {
    alert("Inserire al massimo 5 caratteri nel campo CAP");
    theForm.cap.focus();
    return (false);
  }

  var checkOK = "0123456789-.";
  var checkStr = theForm.cap.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  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 (ch != ".")
      allNum += ch;
  }
  if (!allValid)
  {
    alert("Inserire solo cifra caratteri nel campo CAP");
    theForm.cap.focus();
    return (false);
  }
   
   if (theForm.cap_consegna.value.length > 5)
  {
    alert("Inserire al massimo 5 caratteri nel campo CAP CONSEGNA");
    theForm.cap_consegna.focus();
    return (false);
  }
  
    if (theForm.cap_consegna.value.length > 5)
  {
    alert("Inserire al massimo 5 caratteri nel campo CAP per la consegna");
    theForm.cap_consegna.focus();
    return (false);
  }

  var checkOK = "0123456789-.";
  var checkStr = theForm.cap_consegna.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  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 (ch != ".")
      allNum += ch;
  }
  if (!allValid)
  {
    alert("Inserire solo cifra caratteri nel campo CAP CONSEGNA");
    theForm.cap_consegna.focus();
    return (false);
  }

  if (theForm.citta.value.length > 25)
  {
    alert("Inserire al massimo 25 caratteri nel campo CITTA'");
    theForm.citta.focus();
    return (false);
  }

  var checkOK = "-_.,:;'^?£$%&/\|*éèìòàABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789- \t\r\n\f";
  var checkStr = theForm.citta.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 solo lettera, cifra, spazio e \"-\\/\" caratteri nel campo CITTA'");
    theForm.citta.focus();
    return (false);
  }

  if (theForm.telefono.value.length > 12)
  {
    alert("Inserire al massimo 12 caratteri nel campo TELEFONO`");
    theForm.telefono.focus();
    return (false);
  }

  var checkOK = "0123456789-";
  var checkStr = theForm.telefono.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  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;
    }
    allNum += ch;
  }
  if (!allValid)
  {
    alert("Inserire solo cifra caratteri nel campo TELEFONO");
    theForm.telefono.focus();
    return (false);
  }
  
  if (theForm.telefono_consegna.value.length > 12)
  {
    alert("Inserire al massimo 12 caratteri nel campo TELEFONO CONSEGNA`");
    theForm.telefono_consegna.focus();
    return (false);
  }

  var checkOK = "0123456789-";
  var checkStr = theForm.telefono_consegna.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  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;
    }
    allNum += ch;
  }
  if (!allValid)
  {
    alert("Inserire solo cifra caratteri nel campo TELEFONO CONSEGNA");
    theForm.telefono_consegna.focus();
    return (false);
  }
  

  if (theForm.email.value == "")
  {
    alert("Inserire un valore per il campo E-MAIL");
    theForm.email.focus();
    return (false);
  }
  
  if(!isEmail(theForm.email.value)) 
		return false;

  if (theForm.email.value.length > 80)
  {
    alert("Inserire al massimo 30 caratteri nel campo E-MAIL");
    theForm.email.focus();
    return (false);
  }

  var checkOK = "ç@-_.,:;'^?£$%&/\|*éèìòàABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789- \t\r\n\f";
  var checkStr = theForm.email.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 solo lettera, cifra e \"@.-\" caratteri nel campo E-MAIL");
    theForm.email.focus();
    return (false);
  }

  if (theForm.nome_referente.value.length > 16)
  {
    alert("Inserire al massimo 16 caratteri per il campo NOME REFERENTE");
    theForm.nome_referente.focus();
    return (false);
  }

  var checkOK = "-_.,:;'^?£$%&/\|*éèìòàABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789- \t\`r\n\f";
  var checkStr = theForm.nome_referente.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 solo lettera, cifra e spazio caratteri nel campo NOME REFERENTE");
    theForm.nome_referente.focus();
    return (false);
  }
  
  if (theForm.cognome_referente.value.length > 16)
  {
    alert("Inserire al massimo 16 caratteri per il campo COGNOME REFERENTE");
    theForm.cognome_referente.focus();
    return (false);
  }

  var checkOK = "-_.,:;'^?£$%&/\|*éèìòàABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789- \t\r\n\f";
  var checkStr = theForm.cognome_referente.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 solo lettera, cifra e spazio caratteri nel campo COGNOME REFERENTE");
    theForm.cognome_referente.focus();
    return (false);
  }
  
  
  if (theForm.telefono_cellulare.value.length > 15)
  {
    alert("Inserire al massimo 15 caratteri nel campo TELEFONO CELLULARE");
    theForm.telefono_cellulare.focus();
    return (false);
  }

  var checkOK = "0123456789-";
  var checkStr = theForm.telefono_cellulare.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  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;
     }
    allNum += ch;
  }
  if (!allValid)
  {
    alert("Inserire solo cifra caratteri nel campo TELEFONO CELLULARE");
    theForm.telefono_cellulare.focus();
    return (false);
  }

  if (theForm.fax.value.length > 15)
  {
    alert("Inserire al massimo 15 caratteri nel campo FAX");
    theForm.fax.focus();
    return (false);
  }
 
  var checkOK = "0123456789-.";
  var checkStr = theForm.fax.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  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 (ch != ".")
      allNum += ch;
  }
  if (!allValid)
  {
    alert("Inserire solo cifra caratteri nel campo FAX");
    theForm.fax.focus();
    return (false);
  }
  return (true);
}
// modulo contatti
function isEmail(what)
		{
		var i=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
		if(!i.test(what)) { 
			alert("Il campo EMAIL non è valido."); 
				return false
						 }   
		return true;
		}
				
function frmContatti_Validator(theForm){
	if (theForm.nome.value == "")
	  {
		alert("Inserire un valore per il campo Nome");
		theForm.nome.focus();
		return (false);
		}
	
	if (theForm.cognome.value == "")
	  {
		alert("Inserire un valore per il campo Cognome");
		theForm.cognome.focus();
		return (false);
		}

	if(!isEmail(theForm.email.value)) 
	return false;
	
	if (theForm.messaggio.value == "")
	  {
		alert("Inserire un valore per il campo messaggio");
		theForm.messaggio.focus();
		return (false);
		}
	}
	
function frmPreventivi_Validator(theForm){
if (theForm.nome.value == "")
  {
	alert("Inserire un valore per il campo Nome");
	theForm.nome.focus();
	return (false);
	}

if (theForm.cognome.value == "")
  {
	alert("Inserire un valore per il campo Cognome");
	theForm.cognome.focus();
	return (false);
	}

if(!isEmail(theForm.email.value)) 
return false;

if (theForm.messaggio.value == "")
  {
	alert("Inserire un valore per il campo messaggio");
	theForm.messaggio.focus();
	return (false);
	}
}
	
  function MM_jumpMenu_1(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
  }

  function MM_jumpMenu_2(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
  }

  function MM_jumpMenu_3(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
  }
  
	function homepagelink (url,displayclass)
	{
		if (document.all)
		{
			document.write('<a href="' + url + '" target="_top" onClick="this.style.behavior=\'url(#default#homepage)\';this.setHomePage(\'' + url + '\')">');
			document.write('<span class="' + displayclass + '">Fai di eKoo la tua Home Page</span></a>');
		}
	
		// If it's Netscape 6, tell user to drag link onto Home button
		else if (document.getElementById)
		{
			document.write('<a href="' + url + '"><span class="' + displayclass + '">Fai di eKoo la tua Home Page</span></a>');
		}
	}
	
	function bookmarklink (url,title,displayclass)
	{
		var app = navigator.appName;
		var ver = parseInt(navigator.appVersion);
	
		if ((app == "Microsoft Internet Explorer") && (ver >= 4)) {
			document.write("<a href=\"javascript:window.external.AddFavorite('" + url + "',\'" + title + "')\"><span class=\"" + displayclass + "\">Aggiungi eKoo ai tuoi preferiti</span></a>");
		} else {
			document.write('<span class="' + displayclass + '">CTRL + D per aggiungere eKoo ai tuoi preferiti</span>');
		}
			return;
	}
