// JavaScript Document
function confirmThis(message) {
	if(confirm(message)) return true;
	return false;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}

// verifica per campi modulo checkbox e radio button in combinazione con checkfields
function WithoutCheck(ss) {
	if(ss.checked) { return false; }
	return true;
}

function NoneWithCheck(ss) {
	for(var i = 0; i < ss.length; i++) {
		if(ss[i].checked) { return false; }
		}
return true;
}


//  begin script per nasconder/visualizzare div

// quick browser tests
var ns4 = (document.layers) ? true : false;
var ie4 = (document.all && !document.getElementById) ? true : false;
var ie5 = (document.all && document.getElementById) ? true : false;
var ns6 = (!document.all && document.getElementById) ? true : false;


// serve per switchare tra  blovc e none 
// ossia visualizzaree o nascondere l'oggetto div 'obj'
// passato come variabile
   function showhide(obj)
	{
      if (document.getElementById(obj).style.display=='block') {
            // fai .....
		document.getElementById(obj).style.display='none';		
      } else {
            // fai .....
		document.getElementById(obj).style.display='block';		
      }
    }



function show(sw,obj) {
	// show/hide the divisions
	if (sw && (ie4 || ie5) ) document.all[obj].style.display = 'block';
	if (!sw && (ie4 || ie5) ) document.all[obj].style.display = 'none';
	if (sw && ns4) document.layers[obj].visibility = "visible";
	if (!sw && ns4) document.layers[obj].visibility = "hidden";
}
//  end script per nasconder/visualizzare div


//  begin script per nasconder/visualizzare div netscape

var getById = (typeof document.getElementById != "undefined");		

function toggleDisplay(obj,display1,display2){
	if(!getById) return;	
	obj = getRef(obj);	
	if(obj.style.display == display1)
		obj.style.display = display2;
	else
		obj.style.display = display1;	
	repaintFix();
}

function getRef(obj){
	if(getById)
		return(typeof obj == "string") ? document.getElementById(obj) : obj;
}

function repaintFix(obj){ 	
	if("undefined" == typeof document.body
	  || "undefined" == typeof document.body.style) return;	
	if(obj == null)
		obj == document.body;
	else obj = getRef(obj);	
	document.body.style.visibility = "hidden";
	document.body.style.visibility = "visible";
}
//  end script per nasconder/visualizzare div



defaultStatus = "Area Riservata"


<!-- rollover e rollout per icone immagine e link-->
function opacityOn(elem){
if(document.all){
elem.filters.alpha.opacity = '100';
}}

function opacityOff(elem){
if(document.all){
elem.filters.alpha.opacity = '20';
}}


<!-- finestra popup generica con variabili-->
function popup_generica (url,wname,w,h,scroll,browserloc,menubar,resizable,status,directories,toolbar) {
	var winl = (screen.width - w) / 2 - 5;
	var wint = (screen.height - h) / 2 -80;
	finestra = window.open(url,wname,'top='+wint+',left='+winl+',width='+w+',height='+h+',buttons=1,scrollbars='+scroll+',location='+browserloc+',menubar='+menubar+',resizable='+resizable+',status='+status+',directories='+directories+',toolbar='+toolbar+',copyhistory=Yes');
	finestra.focus();
}


// funzione per contare/limitare il nr di caratteri massimi da immettere

function keywordCounter(field, countfield, maxlimit) {
wordcounter=0;
separator = ",";
for (x=0;x<field.value.length;x++) {
      if (field.value.charAt(x) == separator && field.value.charAt(x-1) != separator)  {wordcounter++}  
	  if (wordcounter > maxlimit) {field.value = field.value.substring(0, x);}
      else {countfield.value = maxlimit - wordcounter;}
      }
}

function wordCounter(field, countfield, maxlimit) {
wordcounter=0;
for (x=0;x<field.value.length;x++) {
      if (field.value.charAt(x) == " " && field.value.charAt(x-1) != " ")  {wordcounter++}  
	  if (wordcounter > maxlimit) {field.value = field.value.substring(0, x);}
      else {countfield.value = maxlimit - wordcounter;}
      }
}

function textCounter(field, countfield, maxlimit) {
  if (field.value.length > maxlimit)
      {field.value = field.value.substring(0, maxlimit);}
      else
      {countfield.value = maxlimit - field.value.length;}
  }
  
// funzione per  errori personalizzati tmt + mybox  
  
function displayError(formNode, validators){

		 var errorHTML = "";
		 //costurisco il testo 
		 for(var i=0;i<validators.length;i++){
		  errorHTML += "<li><em>" + validators[i].name + "</em>: " + validators[i].message + "</li>";
		 }
		/*
		 document.getElementById("errorDisplay").style.display = "block";
		 document.getElementById("errorDisplay").innerHTML = "<ul>" + errorHTML + "</ul>";
		 */
		 MyBoxA.alert(errorHTML);		 

}



