<!-- 
//funzione per il menu di IE
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("menu");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}
window.onload=startList;

//funzione per contare i caratteri di una textarea
//Begin
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
else
countfield.value = maxlimit - field.value.length;
}

//funzioni per controllare che vengano inseriti tutti i campi 
//nelle form

function chk_txt(oggetto, messaggio, min, max){
        // Toglie spazi iniziali e finali
        oggetto.value = oggetto.value.replace(/^\s*/, '');
        oggetto.value = oggetto.value.replace(/\s*$/, '');
        switch(arguments.length){
                case 2:
                        if(oggetto.value.length <= 0){
                                alert(messaggio);
                                oggetto.focus();
                                return false;
                        }
                        break;
                case 3:
                        if(min == 0 && oggetto.value.length == 0)
                                return true;
                        else{
                                if(oggetto.value.length < min){
                                        alert(messaggio);
                                        oggetto.focus();
                                        return false;
                                }
                        }
                        break;
                case 4:
                        if(min == 0 && oggetto.value.length == 0) return true;
                        else{
                                if(oggetto.value.length < min || oggetto.value.length > max){
                                        alert(messaggio);
                                        oggetto.focus();
                                        return false;
                                }
                        }
                        break;
                default:
                        return false;
                        break;
        }
        return true;
}
 
function chk_float(o,d){
        if(o.value.search('^[0-9]{1,}(\.[0-9]{0,3})?$') == -1){
                alert(d);
                o.focus();
                return false;
        }
        return true;
}
 
function chk_int(o,d){
        if(!o.value || o.value.search('[^0-9]') != -1){
                alert(d);
                o.focus();
                return false;
        }
        return true;
}
 
function chk_url(o,d){
        if(o.value.search('[a-z]+://[a-zA-Z0-9]+\.[a-zA-Z0-9]+') == -1){
                alert(d);
                o.focus();
                return false;
        }
        return true;
}
 
function chk_email(o,d){
        if(o.value.search("^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-.]?[0-9a-zA-Z])*\\.[a-zA-Z]{2,3}$") == -1){
                alert(d);
                o.focus();
                return false;
        }
        return true;
}
 
function chk_select(o,d){
        if(!o[o.selectedIndex].value || !o.selectedIndex){
                alert(d);
                o.focus();
                return false;
        }
        return true;
}

//controlla se un campo e` vuoto
function chk_empty(o,d){
                if(!o.value) {
			alert(d);
			o.focus();
                        return false;
        }
        return true;
}

//funzione per stampare la pagina
function printpage()
{
window.print()
}
// End -->
