//pagina impostazioni  x verificare il campo
function VerificaCampo(campo)
{
        
         var cifre= "abcdefABCDEF0123456789#";
         var verifica= campo.value;
         var allValid = true;

         var allNum = "";
         for ( i = 0; i < verifica.length; i++ )
         {
                ch = verifica.charAt( i );
                for ( j = 0; j < cifre.length; j++ )
                 if ( ch == cifre.charAt( j ))
                        break;
                if ( j == cifre.length )
                {
                 allValid = false;
                 break;
                }
                allNum += ch;
         }
         if (!allValid)
         {
                alert( "Hai scritto un carattere non consentito in questo campo" );
                campo.focus();
                return ( false );
         }
        return ( true );
}
function VerificaCampo2(campo)
{
        
         var cifre2= "abcdefghilmnopqrstuvzxwjkjy123456789'.\"\%^?$£()&/;_*-òèéàù£ABCDEFGHILMNOPQRSTUVZXWYKJ0! ";
         var verifica2= campo.value;
         var allValid2 = true;

         var allNum2 = "";
         for ( i = 0; i < verifica2.length; i++ )
         {
                ch = verifica2.charAt( i );
                for ( j = 0; j < cifre2.length; j++ )
                 if ( ch == cifre2.charAt( j ))
                        break;
                if ( j == cifre2.length )
                {
                 allValid2 = false;
                 break;
                }
                allNum2 += ch;
         }
         if (!allValid2)
         {
                alert( "Nel campo Nome e Descrizione non sono consentiti caratteri speciali" );
                campo.focus();
                return ( false );
         }
        return ( true );
}
function verificacaratteri(campo2)
   {
   Filtro2 = /[a-zA-Z0-9]$/;
   valore = campo2.value
   if (!Filtro2.test(valore))
      {
      alert("hai immesso un carattere non consentito");
      campo2.focus();
   }
   }
//***dgt solo numeri
function checkIt(evt) {
    evt = (evt) ? evt : window.event
    var charCode = (evt.which) ? evt.which : evt.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
		alert( "Puoi digitare solo numeri" );
        return false
    }
    status = ""
    return true
}
//bohhhhhhhhhh
function Trim(stringa)
   {
   reTrim=/\s+$|^\s+/g;
   return stringa.replace(reTrim,"");
   }
//controlla codice fiscale
function controlla(campo)
   {
   cod=campo.value ;
   if (cod.length!=16)
      alert( "Il campo deve contenere almeno 16 cifre" );
      else
      {
		codfisc = campo.value;
   Filtro = /^[a-zA-Z]{6}\d{2}[a-zA-Z]\d{2}[a-zA-Z]\d{3}[a-zA-Z]$/;
   if (Filtro.test(codfisc))
      return true;
   else
      {
      alert("Il codice fiscale inserito non è esatto");
      campo.focus();
      return false;
      }
      }
   return ( true );
   }
//controlala mail
function ControllaMail()
{
EmailAddr = document.modulo.email.value;
Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
if (Filtro.test(EmailAddr))
  return true;
else
  {
  alert("l'indirizzo di e-mail inserito non è valido");
  document.modulo.email.focus();
  return false;
  }
}
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
/***********************************************
* Cool DHTML tooltip script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var offsetxpoint=-60 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thecolor, thewidth){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px"

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.visibility="visible"
}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}

document.onmousemove=positiontip
//************************
//apertura popup
	function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';
  window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}
//cancella
function cancella() {
{
return confirm("Cancellare?");
}
}
//apertura popup foto

function PrevFoto(img){
  foto1= new Image()
  foto1.src=(img)
  Controlla(img)
}
function Controlla(img){
  if((foto1.width!=0)&&(foto1.height!=0)){
    viewFoto(img);
  }
  else{
    funzione="Controlla('"+img+"')";
    intervallo=setTimeout(funzione,20);
  }
}
function viewFoto(img){
  largh=foto1.width+15
  altez=foto1.height+25
  posY=50
  posX=100
  stringa="width="+largh+",height="+altez+",top="+posX+",left="+posY;
  finestra=window.open(img,"",stringa);
}
//menu a tendina
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//--> controllo password admin
function checkMe()
{
  if (document.form1.PWD1.value == document.form1.PWD2.value)
  {
    document.form1.xpasswordgen.value=document.form1.PWD1.value;
    document.form1.submit();
  }
  else
    alert("Le password immesse non corrispondono!");
}
//-->

