//  ------------------------------------------------------
// IDENTIFICATION OF BROWSER VERSION
// This function returns a code to identify
// which browser is currently used at client side


function browserVersion() {
        var version = 0;
        if (navigator.userAgent.indexOf("MSIE") != -1) return (1);
        else if (navigator.userAgent.indexOf("Netscape7") != -1) return(7); 
        else if (navigator.userAgent.indexOf("Netscape6") != -1) return(6); 
        else if (navigator.userAgent.indexOf("Mozilla/5") != -1) return(5); 
        else if (navigator.userAgent.indexOf("Mozilla/4") != -1) version=4;
        else if (navigator.userAgent.indexOf("Mozilla/3") != -1) version=3;
        else if (navigator.userAgent.indexOf("Mozilla/2") != -1) version=2;
        else if (navigator.userAgent.indexOf("Opera") != -1) return (1);
        if (navigator.appVersion.indexOf("Mac") != -1) return(0);
        return (version);
}


// AUTOMATIC LAST-UPDATED-ON
// This functions automatically inserts the date of the last
// modification of a page in the format: Month Day, Year
var months = new Array(13);
months[1] = "January";
months[2] = "February";
months[3] = "March";
months[4] = "April";
months[5] = "May";
months[6] = "June";
months[7] = "July";
months[8] = "August";
months[9] = "September";
months[10] = "October";
months[11] = "November";
months[12] = "December";

function last_update() {
  dateObj = new Date(document.lastModified);
  lmonth = months[dateObj.getMonth() + 1];
  date = dateObj.getDate();
  fyear = dateObj.getYear();
  if (browserVersion() != 1) {
     fyear += 1900; }
  document.write(lmonth + " " + date + ", " + fyear);
}


// ------------------------------------------------------
// OPEN AUXILIARY MENU WINDOW (NO SCROLLBARS)
// This function opens an auxiliary browser window, without
// toolbar, menu, status bar and scroll bar.
// Purpose: to display context sensitive help information 
// or additional menu 
// Input parameters: 
//     loc = URL of the file to be loaded in the window
//     ww = width of the window (pixel)
//     wh = height of the window (pixel)

function openWindow(loc,ww,wh) {
    output=window.open(loc,"aux",'alwaysRaised=yes,toolbar=no,scrollbars=no,directories=no,status=no,menubar=no,width='+ww+',height='+wh);
   }


// ------------------------------------------------------
// OPEN AUXILIARY MENU WINDOW (WITH SCROLLBARS)
// This function opens an auxiliary browser window, without
// toolbar, menu, status bar but with scroll bar enabled.
// Purpose: to display auxiliary context sensitive information 
// Input parameters: 
//     loc = URL of the file to be loaded in the window
//     ww = width of the window (pixel)
//     wh = height of the window (pixel)

function openScrollWindow(loc,ww,wh) {
    output=window.open(loc,"aux",'alwaysRaised=yes,toolbar=no,scrollbars=yes,directories=no,status=no,menubar=no,width='+ww+',height='+wh);
   }

// Zoom image in overlay
function zoom(fullImgUrl) {
	var el = document.getElementById("overlay");
	if ( el.style.display != 'inline' ) el.style.display = 'inline';
	newHTML ="<img src=\""+fullImgUrl+"\" alt=\"Zoomed image\" />"
	newHTML +="<p><a href=\"#\" style=\"color: #FFFFFF\" onclick=\"toggle('overlay')\" title=\"Chiudi\">Chiudi</a></p>";
	document.getElementById("foto").innerHTML=newHTML;
	}

// toggle visibility
function toggle(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != 'none' ) {
		el.style.display = 'none';
		}
	else {
		el.style.display = 'inline';
		}
	}

