var __FXcurrentIdx = 0;
var __FXimgTimer = null;
var __FXimmagini = new Array();
var __FXcolleg = new Array();
var __FXfiltri = new Array();
var __FXtarget = new Array();
var __FXclick = new Array();
var __checkIt = undefined;

var __browserUtilizzato = new browserSniffer();

function nuovaLingua(nuova, vecchia)
{
var re = /lang=../;
var loc = top.location+"";

	if (loc.indexOf("lang="+vecchia) > -1)
	{
		loc = loc.replace(re, "lang="+nuova);
	}
	else
	{
		if (loc.indexOf("?") > -1)
		{
			loc = loc+"&lang="+nuova;
		}
		else
		{
			loc = loc+"?lang="+nuova;
		}
	}
	if (top.document.forms['__reloadOnLangChange'] == undefined)
	{
		top.location = loc;
	}
	else
	{
		top.document.forms['__reloadOnLangChange'].action = top.location;
		top.document.forms['__reloadOnLangChange'].elements['lang'].value = nuova;
		top.document.forms['__reloadOnLangChange'].submit();	
	}
}

function shrinkToHeight()
{
var eIds = shrinkToHeight.arguments;
var vret;
var elem;
var tmp;
var testo;
var iter = 0;
var maxHeight;
var eId;
var j;
var htmlCont;
var htmlExtra;
var htmlIdx;
	for (var i = 0; i < eIds.length; i++)
	{
		eId = eIds[i];
		j = 0;
		while ((elem = document.getElementById("s"+eId+""+j)) != undefined)
		{
			maxHeight = parseInt(document.getElementById(eId+""+j).style.height, 10);
			htmlCont = elem.innerHTML;
			testo = htmlCont;
			htmlExtra = "";
			htmlIdx = htmlCont.indexOf("<");
			if (htmlIdx > -1)
			{
				testo = htmlCont.substring(0, htmlIdx);
				htmlExtra = htmlCont.substring(htmlIdx);
			}
//	elem.innerHTML = this.titolo;
			vret = testo;
			tmp = testo + "";
			iter = 0;
			while (elem.offsetHeight > maxHeight && iter < 500)
			{
				tmp = tmp.substring(0, tmp.lastIndexOf(' '));
				vret = tmp + " ...";
				elem.innerHTML = vret+htmlExtra;
				iter += 1;
			}
			j += 1;
		}
	}
//	return vret;
}


function calcolaAppPath(loc)
{
var path = loc.pathname;
var i;
var fD = "";
var n = 0;

	if (path.charAt(0) != "/")
	{
		path = "/"+path;
	}
	for (i = 0; i < path.length; i++)
	{
		if (n < 2)
		{
			fD = fD + path.charAt(i);
			if (path.charAt(i) == '/')
			{
				n += 1;
			}
		}
	}
	return fD;
}

function checkdate(objName) 
{
var datefield = objName;
	datefield.value = chkdate(objName);
}

function chkdate(objName) 
{
var strDatestyle = "EU";  //European date style
var strDate = "";
var strDateArray;
var strDay = "";
var strMonth = "";
var strYear = "";
var intday = 0;
var intMonth = 0;
var intYear = 0;
var booFound = false;
var datefield = objName;
var strSeparatorArray = new Array("-"," ","/",".");
var intElementNr;
var err = 0;
var strMonthArray = new Array(12);
var oggi = new Date();

strMonthArray[0] = "Gen";
strMonthArray[1] = "Feb";
strMonthArray[2] = "Mar";
strMonthArray[3] = "Apr";
strMonthArray[4] = "Mag";
strMonthArray[5] = "Giu";
strMonthArray[6] = "Lug";
strMonthArray[7] = "Ago";
strMonthArray[8] = "Set";
strMonthArray[9] = "Ott";
strMonthArray[10] = "Nov";
strMonthArray[11] = "Dic";
strDate = datefield.value;

	if (strDate.length < 1) 
	{
		return "";
	}

	for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) 
	{
		if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) 
		{
			strDateArray = strDate.split(strSeparatorArray[intElementNr]);
			if (strDateArray.length != 3) 
			{
				err = 1;
				return "";
			}
			else 
			{
				strDay = strDateArray[0];
				strMonth = strDateArray[1];
				strYear = strDateArray[2];
			}
			booFound = true;
	   	}
	}
	
	if (booFound == false) 
	{
		if (strDate.length>5) 
		{
			strDay = strDate.substr(0, 2);
			strMonth = strDate.substr(2, 2);
			strYear = strDate.substr(4);
	   	}
	}
	
	if (strYear.length == 2) 
	{
		intYear = parseInt(strYear, 10);
		if (isNaN(intYear))
		{
			err = 2;
			return;
		}
		else
		{
			if (intYear+2000 < oggi.getYear())
			{
				strYear = '20' + strYear;
			}
			else
			{
				strYear = '19' + strYear;
			}
		}
	}
	// US style
	if (strDatestyle == "US") 
	{
		strTemp = strDay;
		strDay = strMonth;
		strMonth = strTemp;
	}
	intday = parseInt(strDay, 10);
	if (isNaN(intday)) 
	{
		err = 2;
		return "";
	}
	intMonth = parseInt(strMonth, 10);
	if (isNaN(intMonth)) 
	{
		for (i = 0;i<12;i++) 
		{
			if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) 
			{
				intMonth = i+1;
				strMonth = strMonthArray[i];
				i = 12;
	   		}
		}
		
		if (isNaN(intMonth)) 
		{
			err = 3;
			return "";
	   	}
	}

	intYear = parseInt(strYear, 10);
	if (isNaN(intYear)) 
	{
		err = 4;
		return "";
	}

	if (intMonth>12 || intMonth<1) 
	{
		err = 5;
		return "";
	}

	if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) 
	{
		err = 6;
		return "";
	}

	if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) 
	{
		err = 7;
		return "";
	}

	if (intMonth == 2) 
	{
		if (intday < 1) 
		{
			err = 8;
			return "";
		}
	
		if (LeapYear(intYear) == true) 
		{
			if (intday > 29) 
			{
				err = 9;
				return "";
			}
		}
		else 
		{
			if (intday > 28) 
			{
				err = 10;
				return "";
			}
		}
	}

	if (intday<10){intday = "0"+intday;}
	if (intMonth<10){intMonth = "0"+intMonth;}

	return (intday + "/" + intMonth + "/" + strYear);
}

function LeapYear(intYear) 
{
	if (intYear % 100 == 0) 
	{
		if (intYear % 400 == 0) { return true; }
	}
	else 
	{
		if ((intYear % 4) == 0) { return true; }
	}
	return false;
}

function calcolaDataInizio(partenza, giorni)
{
var ms = giorni*24*3600*1000;
var inizio = new Date();
var gg, mm, aaaa;

	inizio.setTime(partenza.getTime() - ms);
	aaaa = inizio.getFullYear();
	mm = (inizio.getMonth()+1)+"";
	gg = inizio.getDate()+"";
	
	if (mm.length == 1) mm = "0"+mm;
	if (gg.length == 1) gg = "0"+gg;
	
	return gg+"/"+mm+"/"+aaaa;
}

function __FXvai(obj, op)
{
var dE = "";
var dS = "";
	if (op == 'agdata')
	{
		if (document.forms['formP'] != undefined)
		{
			if (document.forms['formP'].elements['dS'] != undefined)
			{
				dS = document.forms['formP'].elements['dS'].value;
			}
			if (document.forms['formP'].elements['dE'] != undefined)
			{
				dE = document.forms['formP'].elements['dE'].value;
			}
		}
		if (dE != "" && (dE == dS))
		{
			obj.href += "&dE="+dE;
		}
	}
}

function ricercaPerData(giorni)
{
var oggi = new Date();
var dataS = calcolaDataInizio(oggi, giorni);
var gg, mm, aaaa;
var dataS;

	aaaa = oggi.getFullYear();
	mm = (oggi.getMonth()+1)+"";
	gg = oggi.getDate()+"";
	
	if (mm.length == 1) mm = "0"+mm;
	if (gg.length == 1) gg = "0"+gg;
	
	dataF = gg+"/"+mm+"/"+aaaa;

	document.forms['__formR1'].elements['dS'].value = dataS;
	document.forms['__formR1'].elements['dE'].value = dataF;
	document.forms['__formR1'].submit();
}

function __FXaggiornaImmagine()
{
var elem = document.images['FXimmaTrans'];
var elemLnk = document.getElementById('FXimmaTransLnk');
	if (elem != undefined)
	{
		if (__FXimgTimer == null)
		{
			__FXimgTimer = setInterval("__FXaggiornaImmagine()", 3000);
		}
		elemLnk.href = __FXcolleg[__FXcurrentIdx];
		elemLnk.target = __FXtarget[__FXcurrentIdx];
		elemLnk.onclick = new Function (__FXclick[__FXcurrentIdx]);
		
		if (elem.style.filter) elem.style.filter = __FXfiltri[__FXcurrentIdx];
		
		if (elem.filters)
		{
    		elem.filters[0].apply();
		}
		elem.src = __FXimmagini[__FXcurrentIdx];
	
		if (elem.filters)
		{
	    	elem.filters[0].play();
	    }
	
	
		__FXcurrentIdx += 1;
		if (__FXcurrentIdx >= __FXimmagini.length)
		{
			__FXcurrentIdx = 0;
		}
	}
}

function DL_GetElementTop(eElement)
{
    var nTopPos = eElement.offsetTop;            // initialize var to store calculations
    var eParElement = eElement.offsetParent;     // identify first offset parent element  
    while (eParElement != null)
    {                                            // move up through element hierarchy
        nTopPos += eParElement.offsetTop;        // appending top offset of each parent
        eParElement = eParElement.offsetParent;  // until no more offset parents exist
    }
    return nTopPos;                              // return the number calculated
}

function DL_GetElementLeft(eElement)
{
    var nLeftPos = eElement.offsetLeft;          // initialize var to store calculations
    var eParElement = eElement.offsetParent;     // identify first offset parent element  
    while (eParElement != null)
    {                                            // move up through element hierarchy
        nLeftPos += eParElement.offsetLeft;      // appending left offset of each parent
        eParElement = eParElement.offsetParent;  // until no more offset parents exist
    }
    return nLeftPos;                             // return the number calculated
}

function spostaEVisualizzaMenuSX(elemento, pElemento)
{
/*
	document.getElementById(elemento).style.left = (DL_GetElementLeft(pElemento)+pElemento.clientWidth-4)+'px';
	document.getElementById(elemento).style.top = DL_GetElementTop(pElemento)+'px';
*/	
	document.getElementById(elemento).style.visibility = 'visible'; 
	document.getElementById(elemento).style.display = '';
	
}

function checkUserInput(elemento)
{
	if (__checkIt != undefined) clearTimeout(__checkIt);

	__checkIt = setTimeout("closeSubMenuSX('"+elemento+"')",100);
	
}

function checkUserInput(elemento, intv)
{
	if (__checkIt != undefined) clearTimeout(__checkIt);

	__checkIt = setTimeout("closeSubMenuSX('"+elemento+"')",intv);
	
}

function unCheckUserInput()
{
	if (__checkIt != undefined) clearTimeout(__checkIt);
	__checkit = undefined;
//	__checkIt = setTimeout('closeSubMenuSX(1)',5000);
}

function closeSubMenuSX(elemento)
{
	if (document.getElementById(elemento))
	{
		document.getElementById(elemento).style.visibility = 'hidden'; 
		document.getElementById(elemento).style.display = 'none';
	}
}

function cleanupWordStyles(elem)
{
var eCo;
var i;
var e;
var a;
var str;
var re;

//	alert(elem.innerHTML);
	eCo = elem.getElementsByTagName("p");
//	alert(eCo.length);
	for (i = 0; i < eCo.length; i++)
	{
		e = eCo.item(i);
		if (e.getAttribute("style"))
		{
			e.removeAttribute("style", 0);
		}
		if (e.getAttribute("class"))
		{
			e.removeAttribute("class", 0);
		}
		if (e.getAttribute("className"))
		{
			e.removeAttribute("className", 0);
		}
	}
	eCo = elem.getElementsByTagName("span");
//	alert(eCo.length);
	for (i = 0; i < eCo.length; i++)
	{
		e = eCo.item(i);
		if (e.getAttribute("style"))
		{
			e.removeAttribute("style", 0);
		}
		if (e.getAttribute("class"))
		{
			e.removeAttribute("class", 0);
		}
		if (e.getAttribute("className"))
		{
			e.removeAttribute("className", 0);
		}
	}
	eCo = elem.getElementsByTagName("font");
//	alert(eCo.length);
	for (i = 0; i < eCo.length; i++)
	{
		e = eCo.item(i);
		if (e.getAttribute("style"))
		{
			e.removeAttribute("style", 0);
		}
		if (e.getAttribute("class"))
		{
			e.removeAttribute("class", 0);
		}
		if (e.getAttribute("className"))
		{
			e.removeAttribute("className", 0);
		}
	}
//	alert(elem.innerHTML);
	eCo = elem.getElementsByTagName("table");
//	alert(eCo.length);
	for (i = 0; i < eCo.length; i++)
	{
		e = eCo.item(i);
//		alert(e.outerHTML);
		if (e.getAttribute("style"))
		{
			e.removeAttribute("style", 0);
		}
		if (e.getAttribute("class"))
		{
			e.removeAttribute("class", 0);
		}
		if (e.getAttribute("className"))
		{
			e.removeAttribute("className", 0);
		}
		if (e.getAttribute("width"))
		{
			e.removeAttribute("width", 0);
		}
		
//		alert(e.outerHTML);
	}
	eCo = elem.getElementsByTagName("tr");
//	alert(eCo.length);
	for (i = 0; i < eCo.length; i++)
	{
		e = eCo.item(i);
		if (e.getAttribute("style"))
		{
			e.removeAttribute("style", 0);
		}
		if (e.getAttribute("class"))
		{
			e.removeAttribute("class", 0);
		}
		if (e.getAttribute("className"))
		{
			e.removeAttribute("className", 0);
		}
		if (e.getAttribute("width"))
		{
			e.removeAttribute("width", 0);
		}
	}
	eCo = elem.getElementsByTagName("td");
//	alert(eCo.length);
	for (i = 0; i < eCo.length; i++)
	{
		e = eCo.item(i);
		if (e.getAttribute("style"))
		{
			e.removeAttribute("style", 0);
		}
		if (e.getAttribute("class"))
		{
			e.removeAttribute("class", 0);
		}
		if (e.getAttribute("className"))
		{
			e.removeAttribute("className", 0);
		}
		if (e.getAttribute("width"))
		{
			e.removeAttribute("width", 0);
		}
	}
	eCo = elem.getElementsByTagName("td");
//	alert(eCo.length);
	for (i = 0; i < eCo.length; i++)
	{
		e = eCo.item(i);
//		alert(e.outerHTML);
		str = e.innerHTML;
		str = str.replace(/nbsp/g,"-");
		str = str.replace(/&-;/g,"");
		e.innerHTML = str;
//		alert("pippo");
//		alert(e.outerHTML);
	}

}
function browserSniffer()
{
    var agt=navigator.userAgent.toLowerCase();
    var appVer = navigator.appVersion.toLowerCase();

    // *** BROWSER VERSION ***

    this.is_minor = parseFloat(appVer);
    this.is_major = parseInt(this.is_minor);

    this.is_opera = (agt.indexOf("opera") != -1);
    this.is_opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
    this.is_opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
    this.is_opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
    this.is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
    this.is_opera6 = (agt.indexOf("opera 6") != -1 || agt.indexOf("opera/6") != -1); // new 020128- abk
    this.is_opera7 = (agt.indexOf("opera 7") != -1 || agt.indexOf("opera/7") != -1); // new 021205- dmr
    this.is_opera5up = (this.is_opera && !this.is_opera2 && !this.is_opera3 && !this.is_opera4);
    this.is_opera6up = (this.is_opera && !this.is_opera2 && !this.is_opera3 && !this.is_opera4 && !this.is_opera5); // new020128
    this.is_opera7up = (this.is_opera && !this.is_opera2 && !this.is_opera3 && !this.is_opera4 && !this.is_opera5 && !this.is_opera6); // new021205 -- dmr

    // Note: On IE, start of appVersion return 3 or 4
    // which supposedly is the version of Netscape it is compatible with.
    // So we look for the real version further on in the string

    var iePos  = appVer.indexOf('msie');
    if (iePos !=-1) {
       this.is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)))
       this.is_major = parseInt(this.is_minor);
    }

    // ditto Konqueror
                                      
    this.is_konq = false;
    var kqPos   = agt.indexOf('konqueror');
    if (kqPos !=-1) {                 
       this.is_konq  = true;
       this.is_minor = parseFloat(agt.substring(kqPos+10,agt.indexOf(';',kqPos)));
       this.is_major = parseInt(this.is_minor);
    }                                 

    this.is_getElementById   = (document.getElementById) ? "true" : "false"; // 001121-abk
    this.is_getElementsByTagName = (document.getElementsByTagName) ? "true" : "false"; // 001127-abk
    this.is_documentElement = (document.documentElement) ? "true" : "false"; // 001121-abk

    this.is_safari = ((agt.indexOf('safari')!=-1)&&(agt.indexOf('mac')!=-1))?true:false;
    this.is_khtml  = (this.is_safari || this.is_konq);

    this.is_gecko = ((!this.is_khtml)&&(navigator.product)&&(navigator.product.toLowerCase()=="gecko"))?true:false;
    this.is_gver  = 0;
    if (this.is_gecko) this.is_gver=navigator.productSub;

    this.is_moz   = ((agt.indexOf('mozilla/5')!=-1) && (agt.indexOf('spoofer')==-1) &&
                    (agt.indexOf('compatible')==-1) && (agt.indexOf('opera')==-1)  &&
                    (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)     &&
                    (this.is_gecko) && 
                    ((navigator.vendor=="")||(navigator.vendor=="Mozilla")||(navigator.vendor=="Debian")));
    this.is_fb = ((agt.indexOf('mozilla/5')!=-1) && (agt.indexOf('spoofer')==-1) &&
                 (agt.indexOf('compatible')==-1) && (agt.indexOf('opera')==-1)  &&
                 (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)     &&
                 (this.is_gecko) && (navigator.vendor=="Firebird"));
    this.is_fx = ((agt.indexOf('mozilla/5')!=-1) && (agt.indexOf('spoofer')==-1) &&
                 (agt.indexOf('compatible')==-1) && (agt.indexOf('opera')==-1)  &&
                 (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)     &&
                 (this.is_gecko) && (navigator.vendor=="Firefox"));
    if ((this.is_moz)||(this.is_fb)||(this.is_fx)) {  // 032504 - dmr
       this.is_moz_ver = (navigator.vendorSub)?navigator.vendorSub:0;
       if(!(this.is_moz_ver)) {
           this.is_moz_ver = agt.indexOf('rv:');
           this.is_moz_ver = agt.substring(this.is_moz_ver+3);
           this.is_paren   = this.is_moz_ver.indexOf(')');
           this.is_moz_ver = this.is_moz_ver.substring(0,this.is_paren);
       }
       this.is_minor = this.is_moz_ver;
       this.is_major = parseInt(this.is_moz_ver);
    }
   this.is_fb_ver = this.is_moz_ver;
   this.is_fx_ver = this.is_moz_ver;

    this.is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)
                && (!this.is_khtml) && (!(this.is_moz)) && (!this.is_fb) && (!this.is_fx));

    // Netscape6 is mozilla/5 + Netscape6/6.0!!!
    // Mozilla/5.0 (Windows; U; Win98; en-US; m18) Gecko/20001108 Netscape6/6.0
    // Changed this to use navigator.vendor/vendorSub - dmr 060502   
    // var nav6Pos = agt.indexOf('netscape6');
    // if (nav6Pos !=-1) {
    if ((navigator.vendor)&&
        ((navigator.vendor=="Netscape6")||(navigator.vendor=="Netscape"))&&
        (this.is_nav)) {
       this.is_major = parseInt(navigator.vendorSub);
       // here we need this.is_minor as a valid float for testing. We'll
       // revert to the actual content before printing the result. 
       this.is_minor = parseFloat(navigator.vendorSub);
    }

    this.is_nav2 = (this.is_nav && (this.is_major == 2));
    this.is_nav3 = (this.is_nav && (this.is_major == 3));
    this.is_nav4 = (this.is_nav && (this.is_major == 4));
    this.is_nav4up = (this.is_nav && this.is_minor >= 4);  // changed to this.is_minor for
                                                // consistency - dmr, 011001
    this.is_navonly      = (this.is_nav && ((agt.indexOf(";nav") != -1) ||
                          (agt.indexOf("; nav") != -1)) );

    this.is_nav6   = (this.is_nav && this.is_major==6);    // new 010118 mhp
    this.is_nav6up = (this.is_nav && this.is_minor >= 6) // new 010118 mhp

    this.is_nav5   = (this.is_nav && this.is_major == 5 && !this.is_nav6); // checked for ns6
    this.is_nav5up = (this.is_nav && this.is_minor >= 5);

    this.is_nav7   = (this.is_nav && this.is_major == 7);
    this.is_nav7up = (this.is_nav && this.is_minor >= 7);

    this.is_ie   = ((iePos!=-1) && (!this.is_opera) && (!this.is_khtml));
    this.is_ie3  = (this.is_ie && (this.is_major < 4));

    this.is_ie4   = (this.is_ie && this.is_major == 4);
    this.is_ie4up = (this.is_ie && this.is_minor >= 4);
    this.is_ie5   = (this.is_ie && this.is_major == 5);
    this.is_ie5up = (this.is_ie && this.is_minor >= 5);
    
    this.is_ie5_5  = (this.is_ie && (agt.indexOf("msie 5.5") !=-1)); // 020128 new - abk
    this.is_ie5_5up =(this.is_ie && this.is_minor >= 5.5);                // 020128 new - abk
	
    this.is_ie6   = (this.is_ie && this.is_major == 6);
    this.is_ie6up = (this.is_ie && this.is_minor >= 6);

// KNOWN BUG: On AOL4, returns false if IE3 is embedded browser
    // or if this is the first browser window opened.  Thus the
    // variables this.is_aol, this.is_aol3, and this.is_aol4 aren't 100% reliable.

    this.is_aol   = (agt.indexOf("aol") != -1);
    this.is_aol3  = (this.is_aol && this.is_ie3);
    this.is_aol4  = (this.is_aol && this.is_ie4);
    this.is_aol5  = (agt.indexOf("aol 5") != -1);
    this.is_aol6  = (agt.indexOf("aol 6") != -1);
    this.is_aol7  = ((agt.indexOf("aol 7")!=-1) || (agt.indexOf("aol7")!=-1));
    this.is_aol8  = ((agt.indexOf("aol 8")!=-1) || (agt.indexOf("aol8")!=-1));

    this.is_webtv = (agt.indexOf("webtv") != -1);
    
    // new 020128 - abk
    
    this.is_TVNavigator = ((agt.indexOf("navio") != -1) || (agt.indexOf("navio_aoltv") != -1)); 
    this.is_AOLTV = this.is_TVNavigator;

    this.is_hotjava = (agt.indexOf("hotjava") != -1);
    this.is_hotjava3 = (this.is_hotjava && (this.is_major == 3));
    this.is_hotjava3up = (this.is_hotjava && (this.is_major >= 3));

    // end new
	
    // *** JAVASCRIPT VERSION CHECK ***
    // Useful to workaround Nav3 bug in which Nav3
    // loads <SCRIPT LANGUAGE="JavaScript1.2">.
    // updated 020131 by dragle
    this.is_js;
    if (this.is_nav2 || this.is_ie3) this.is_js = 1.0;
    else if (this.is_nav3) this.is_js = 1.1;
    else if ((this.is_opera5)||(this.is_opera6)) this.is_js = 1.3; // 020214 - dmr
    else if (this.is_opera7up) this.is_js = 1.5; // 031010 - dmr
    else if (this.is_khtml) this.is_js = 1.5;   // 030110 - dmr
    else if (this.is_opera) this.is_js = 1.1;
    else if ((this.is_nav4 && (this.is_minor <= 4.05)) || this.is_ie4) this.is_js = 1.2;
    else if ((this.is_nav4 && (this.is_minor > 4.05)) || this.is_ie5) this.is_js = 1.3;
    else if (this.is_nav5 && !(this.is_nav6)) this.is_js = 1.4;
    else if (this.is_hotjava3up) this.is_js = 1.4; // new 020128 - abk
    else if (this.is_nav6up) this.is_js = 1.5;

    // NOTE: In the future, update this code when newer versions of JS
    // are released. For now, we try to provide some upward compatibility
    // so that future versions of Nav and IE will show they are at
    // *least* JS 1.x capable. Always check for JS version compatibility
    // with > or >=.

    else if (this.is_nav && (this.is_major > 5)) this.is_js = 1.4;
    else if (this.is_ie && (this.is_major > 5)) this.is_js = 1.3;
    else if (this.is_moz) this.is_js = 1.5;
    else if (this.is_fb||this.is_fx) this.is_js = 1.5; // 032504 - dmr
    
    // what about ie6 and ie6up for js version? abk
    
    // HACK: no idea for other browsers; always check for JS version 
    // with > or >=
    else this.is_js = 0.0;
    // HACK FOR IE5 MAC = js vers = 1.4 (if put inside if/else jumps out at 1.3)
    if ((agt.indexOf("mac")!=-1) && this.is_ie5up) this.is_js = 1.4; // 020128 - abk
    
    // Done with this.is_minor testing; revert to real for N6/7
    if (this.is_nav6up) {
       this.is_minor = navigator.vendorSub;
    }

    // *** PLATFORM ***
    this.is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
    // NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all
    //        Win32, so you can't distinguish between Win95 and WinNT.
    this.is_win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));

    // is this a 16 bit compiled version?
    this.is_win16 = ((agt.indexOf("win16")!=-1) ||
               (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) ||
               (agt.indexOf("windows 16-bit")!=-1) );

    this.is_win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) ||
                    (agt.indexOf("windows 16-bit")!=-1));
	
	this.is_winme = ((agt.indexOf("win 9x 4.90")!=-1));    // new 020128 - abk
    this.is_win2k = ((agt.indexOf("windows nt 5.0")!=-1) || (agt.indexOf("windows 2000")!=-1)); // 020214 - dmr
    this.is_winxp = ((agt.indexOf("windows nt 5.1")!=-1) || (agt.indexOf("windows xp")!=-1)); // 020214 - dmr

    // NOTE: Reliable detection of Win98 may not be possible. It appears that:
    //       - On Nav 4.x and before you'll get plain "Windows" in userAgent.
    //       - On Mercury client, the 32-bit version will return "Win98", but
    //         the 16-bit version running on Win98 will still return "Win95".
    this.is_win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1));
    this.is_winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));
    this.is_win32 = (this.is_win95 || this.is_winnt || this.is_win98 ||
                    ((this.is_major >= 4) && (navigator.platform == "Win32")) ||
                    (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));

    this.is_os2   = ((agt.indexOf("os/2")!=-1) ||
                    (navigator.appVersion.indexOf("OS/2")!=-1) ||
                    (agt.indexOf("ibm-webexplorer")!=-1));

    this.is_mac    = (agt.indexOf("mac")!=-1);
    if (this.is_mac) { this.is_win = !this.is_mac; } // dmr - 06/20/2002
    this.is_mac68k = (this.is_mac && ((agt.indexOf("68k")!=-1) ||
                               (agt.indexOf("68000")!=-1)));
    this.is_macppc = (this.is_mac && ((agt.indexOf("ppc")!=-1) ||
                                (agt.indexOf("powerpc")!=-1)));

    this.is_sun   = (agt.indexOf("sunos")!=-1);
    this.is_sun4  = (agt.indexOf("sunos 4")!=-1);
    this.is_sun5  = (agt.indexOf("sunos 5")!=-1);
    this.is_suni86= (this.is_sun && (agt.indexOf("i86")!=-1));
    this.is_irix  = (agt.indexOf("irix") !=-1);    // SGI
    this.is_irix5 = (agt.indexOf("irix 5") !=-1);
    this.is_irix6 = ((agt.indexOf("irix 6") !=-1) || (agt.indexOf("irix6") !=-1));
    this.is_hpux  = (agt.indexOf("hp-ux")!=-1);
    this.is_hpux9 = (this.is_hpux && (agt.indexOf("09.")!=-1));
    this.is_hpux10= (this.is_hpux && (agt.indexOf("10.")!=-1));
    this.is_aix   = (agt.indexOf("aix") !=-1);      // IBM
    this.is_aix1  = (agt.indexOf("aix 1") !=-1);
    this.is_aix2  = (agt.indexOf("aix 2") !=-1);
    this.is_aix3  = (agt.indexOf("aix 3") !=-1);
    this.is_aix4  = (agt.indexOf("aix 4") !=-1);
    this.is_linux = (agt.indexOf("inux")!=-1);
    this.is_sco   = (agt.indexOf("sco")!=-1) || (agt.indexOf("unix_sv")!=-1);
    this.is_unixware = (agt.indexOf("unix_system_v")!=-1);
    this.is_mpras    = (agt.indexOf("ncr")!=-1);
    this.is_reliant  = (agt.indexOf("reliantunix")!=-1);
    this.is_dec   = ((agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) ||
           (agt.indexOf("dec_alpha")!=-1) || (agt.indexOf("alphaserver")!=-1) ||
           (agt.indexOf("ultrix")!=-1) || (agt.indexOf("alphastation")!=-1));
    this.is_sinix = (agt.indexOf("sinix")!=-1);
    this.is_freebsd = (agt.indexOf("freebsd")!=-1);
    this.is_bsd = (agt.indexOf("bsd")!=-1);
    this.is_unix  = ((agt.indexOf("x11")!=-1) || this.is_sun || this.is_irix || this.is_hpux ||
                 this.is_sco ||this.is_unixware || this.is_mpras || this.is_reliant ||
                 this.is_dec || this.is_sinix || this.is_aix || this.is_linux || this.is_bsd || this.is_freebsd);

    this.is_vms   = ((agt.indexOf("vax")!=-1) || (agt.indexOf("openvms")!=-1));
// additional checks, abk
	this.is_anchors = (document.anchors) ? "true":"false";
	this.is_regexp = (window.RegExp) ? "true":"false";
	this.is_option = (window.Option) ? "true":"false";
	this.is_all = (document.all) ? "true":"false";
// cookies - 990624 - abk
	document.cookie = "cookies=true";
	this.is_cookie = (document.cookie) ? "true" : "false";
	this.is_images = (document.images) ? "true":"false";
	this.is_layers = (document.layers) ? "true":"false"; // gecko m7 bug?
// new doc obj tests 990624-abk
	this.is_forms = (document.forms) ? "true" : "false";
	this.is_links = (document.links) ? "true" : "false";
	this.is_frames = (window.frames) ? "true" : "false";
	this.is_screen = (window.screen) ? "true" : "false";

// java
	this.is_java = (navigator.javaEnabled());

// Flash checking code adapted from Doc JavaScript information; 
// see http://webref.com/js/column84/2.html

   this.is_Flash        = false;
   this.is_FlashVersion = 0;

   if ((this.is_nav||this.is_opera||this.is_moz)||
       (this.is_mac&&this.is_ie5up)) {
      var plugin = (navigator.mimeTypes && 
                    navigator.mimeTypes["application/x-shockwave-flash"] &&
                    navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) ?
                    navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
      if (plugin) {
         this.is_Flash = true;
         this.is_FlashVersion = parseInt(plugin.description.substring(plugin.description.indexOf(".")-1));
      }
   }

   if (this.is_win&&this.is_ie4up)
   {
      document.write(
         '<scr' + 'ipt language=VBScript>' + '\n' +
         'Dim hasPlayer, playerversion' + '\n' +
         'hasPlayer = false' + '\n' +
         'playerversion = 10' + '\n' +
         'Do While playerversion > 0' + '\n' +
            'On Error Resume Next' + '\n' +
            'hasPlayer = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & playerversion)))' + '\n' +
            'If hasPlayer = true Then Exit Do' + '\n' +
            'playerversion = playerversion - 1' + '\n' +
         'Loop' + '\n' +
         'this.is_FlashVersion = playerversion' + '\n' +
         'this.is_Flash = hasPlayer' + '\n' +
         '<\/sc' + 'ript>'
      );
   }
}   

function addEvent(obj, evType, fn)
{ 
	if (obj.addEventListener)
	{ 
    	obj.addEventListener(evType, fn, true); 
	    return true; 
	 } else if (obj.attachEvent)
	 { 
    	var r = obj.attachEvent("on"+evType, fn); 
	    return r; 
	 } else 
	 { 
	    return false; 
	 } 
} 

function oninputfocus(e) 
{
 /* Cookie-cutter code to find the source of the event */
 	if (typeof e == 'undefined') 
 	{
 	  var e = window.event;
 	}
 var source;
 	if (typeof e.target != 'undefined') 
 	{
 	   source = e.target;
 	} else if (typeof e.srcElement != 'undefined') 
 	{
    	source = e.srcElement;
 	} else 
 	{
   		return;
 	}
 /* End cookie-cutter code */
 	source.style.border='2px solid #cccccc';
 	source.style.backgroundColor = '#FFFFF0';
}

function oninputblur(e) 
{
 /* Cookie-cutter code to find the source of the event */
	if (typeof e == 'undefined') 
	{
   		var e = window.event;
 	}
 	var source;
 	if (typeof e.target != 'undefined') 
 	{
    	source = e.target;
 	} 
 	else if (typeof e.srcElement != 'undefined') 
 	{
    	source = e.srcElement;
 	} else 
 	{
   		return;
 	}
 /* End cookie-cutter code */
 	source.style.border='2px inset';
 	source.style.backgroundColor = '#F5F5F5';
} 

function visualizzaElemento(elmId)
{
var elem = document.getElementById(elmId);
var nascondi = false;

	if (elem)
	{
		if (elem.style.visibility)
		{
			if (elem.style.visibility == 'visible')
			{
				nascondi = true;
			}
			else
			{
				nascondi = false;
			}
		}
		else
		{
			nascondi = false;
		}
		if (nascondi == true)
		{
			elem.style.display = 'none';
			elem.style.visibility = 'hidden';
		}
		else
		{
			elem.style.display = '';
			elem.style.visibility = 'visible';
		}
	}
	
}

