<!--

window.onerror=null;
bVer = parseInt(navigator.appVersion);

NS=(document.layers) ? true:false;
IE=(document.all)?true:false;

NS4=(document.layers) ? true : false;
IE4=((document.all)&&(bVer>=4)) ? true : false;
ver4 = (NS4 || IE4) ? true : false;

function hideIt(){
	if(NS4 || IE4)
		{
	 	if(NS4)
		   document.divLoadCont.visibility="hidden"
		else
		   divLoadCont.style.visibility="hidden"
		}
	}

function stampa_pagina() {
	if (document.images)
		{
		if (NS4)
			window.print();  
		else
			{
			var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
			document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
			WebBrowser1.ExecWB(6, 2);	//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
			}
		}
	}

function CreaNuovaFinestra(path, larghezza, altezza, res, scroll) {
	st = "toolbar=0,directories=0,menubar=0,location=0,resizable=" + res + ", scrollbars="+scroll;
	if(larghezza != -1)
		st=st+",width="+larghezza;
	if(altezza != -1)
		st=st+",height="+altezza;
	popupWin=window.open(path,"window",st);
	}

function VisualizzaImmagine(path, larghezza, altezza, titolo, res, scroll) {
	st="toolbar=0,directories=0,menubar=0,location=0,resizable="+res + ", scrollbars="+scroll;
	if(larghezza != -1)
		st=st+",width="+larghezza;
	if(altezza != -1)
		st=st+",height="+altezza;
	msg=window.open("", "", st);
	st="<HEAD><TITLE>"+titolo+"</TITLE></HEAD>";
	msg.document.write(st);
	msg.document.write("<BODY TOPMARGIN=0 BGCOLOR=#FFFFFF LEFTMARGIN=0>");
	msg.document.write("<CENTER>");	
	st="<CENTER><IMG SRC="+path+" BORDER=0></CENTER>";
	msg.document.write(st);
	msg.document.write("</BODY>");
	}

function AfterLoad(who, status){
	// if (document.all)
	//	document.body.onmousedown=new Function("if (event.button==2||event.button==3) alert('Spiacenti, il tasto destro del mouse è disabilitato')");

	window.defaultStatus=status;
	//who.Focus();
	BodyOnLoad();
	}

function setCookie(name, value, expire){
	document.cookie = name + "=" + escape(value) + ((expire ==null) ? "" : ("; expires=" + expire.toGMTString()));
	}

function getCookie(Name){
	var search = Name + "=";
	if (document.cookie.length > 0){
		offset = document.cookie.indexOf(search);
		if (offset != -1){
			offset += search.length;
			end = document.cookie.indexOf(";", offset);
			if (end == -1)
				end = document.cookie.length;
			return unescape(document.cookie.substring(offset, end));
			} 
		else
			return "";
		} 
	else
		return "";
	}

function solo_lettere(AString){
	// ... solo lettere, no numeri
  	var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
	var checkStr = AString;
	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;
	   		}
	 	}
	return(allValid);
	}

function solo_numeri(AString){
	// ... solo numeri, no lettere
	var checkOK = "0123456789";
	var checkStr = AString;
	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;
	   		}
	 	}
	return(allValid);
	}

function check_codice(ACodice){
	var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ0123456789-.-";
	var checkStr = ACodice;
	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;
    			}
		}
	return(allValid);
	}

function check_telefono(ATelefono){
	var checkOK = "0123456789-/-.";
	var checkStr = ATelefono;
	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;
			}
		}
	return(allValid);
	}

/* funzione di validazione dell'indirizzo e-mail */
function ValidEmail(item) {
	 /* carattere @ non presente */
	 if(item.indexOf('@',0) == -1)
		return false; 
	/* carattere @ come primo carattere ovvero manca la prima parte dell'indirizzo di e-mail */ 
	if(item.indexOf('@',0) == 0)
		return false; 
	/* campo senza testo */
	if(item.length == 0)
		return false;  
	return true;
	}

function textlist()	{
   	var n=textlist.arguments.length;
	for (i=0; i<n; i++)
		this[i]=textlist.arguments[i];
	this.max=n;
	}

function show(titolo, blocco) {
	if (!document.layers&&!document.all)
	 		return

	mySpiega="<div class=greater12><FONT color=#993333><b>"+titolo+"</b></font></div>"

	t=eval("t"+blocco);
	if(t) {
		for (i=0; i<t.max; i++)
			mySpiega=mySpiega + "<br>" + t[i];
		}
	else
		mySpiega="&nbsp;";

	if (document.layers) {
	   document.layers.spiega.document.write(mySpiega)
	   document.layers.spiega.document.close()
	   }
	else
		if (document.all)
		   spiega.innerHTML=mySpiega
	}

function addbookmark(){
	if (document.all)
		window.external.AddFavorite(bookmarkurl,bookmarktitle)
	}

function openlink(xlink){
	window.open("./linkesterni.shtml?" + xlink, "xpage");
	}

function openlinkex(xlink){
	window.open("./pagine/linkesterni.shtml?" + xlink, "xpage");
	}

function openwindow(path, nome, larghezza, altezza, res, scroll, left, top) {
	st = "title=0,toolbar=0,directories=0,menubar=0,location=0,resizable=" + res + ", scrollbars="+scroll;
	if(larghezza != -1)
		st=st+",width="+larghezza;
	if(altezza != -1)
		st=st+",height="+altezza;
	if(left != -1)
		st=st+",left="+left;
	if(top != -1)
		st=st+",top="+top;
	window.open(path, nome, st);
	}

function crea()
	{
	for (i = 0; i<crea.arguments.length; i++)
		this[i+1] = crea.arguments[i];
	}

function crea()
	{
	for (i = 0; i<crea.arguments.length; i++)
		this[i] = crea.arguments[i];
	}

function visualizza_data()
	{
	var mesi = new crea('Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre');
	var date = new Date();
	var gg = date.getDate();
	var mese = date.getMonth();
	var yy = date.getYear();
	var yyyy = (yy < 1000) ? yy + 1900 : yy;

	document.write(gg + " " + mesi[mese] + " " + yyyy);
	}

function go(url, tool, menu, loc, scroll, resize, status, left, top, width, height) {
	OpenWin = this.open(url, "CtrlWindow", "toolbar=" + tool + ",menubar=" + menu + ",location=" + loc + ",scrollbars=" + scroll + ",resizable=" + resize + ",status=" + status + ",left=" + left + ",top=" + top + ",width=" + width + ",height=" + height);
	}

function BodyOnLoad()
	{
	// nothing;
	}

function AutoCompleteDate_DDMMAAAA(obj)
	{
	// Check if the key is a number
	var sKeyPressed;
	sKeyPressed = new String(event.keyCode);
	if (event.keyCode < 48 || event.keyCode > 57)
		{
		// don't insert last non-numeric character
		event.keyCode = 0;
		}
	else
		{
		if (obj.value.length == 2)
			{
			obj.value += "/";
			}
		else if (obj.value.length == 5)
			{
			obj.value += "/";
			}
		else if (obj.value.length > 9)
			{
		var selText = (document.all) ? document.selection.createRange().text : document.getSelection();
			if( selText.length == 0 )
			{
				// make sure the field doesn't exceed the maximum length
				event.keyCode = 0;
			}
			}
		}
	}


//-->

