
<!--

// Gestione foto ingrandite

function MakeBigger(i) {

  var winH = 550;
 parent.document.getElementById("BigImg").src = i;
 parent.document.getElementById("BigImg").style.height = winH;
 parent.document.getElementById("DivImgClose").style.top = 10;
 parent.document.getElementById("DivImgClose").style.left = 10;
// parent.document.getElementById("DivImgClose").style.top = parent.document.getElementById("BigImg").height - 30;
// parent.document.getElementById("DivImgClose").style.left = parent.document.getElementById("BigImg").width - 30;
 parent.document.getElementById("DivImg").style.visibility = "visible";

}

function MakeSmaller() {

 document.getElementById("DivImg").style.visibility = "hidden";

}

// Data
function oggi()
{
  var  d  = new Date ();
  var gs  = d.getDay();
  var gg  = d.getDate();
  var mm  = d.getMonth()+1;
  var aa  = d.getFullYear();
  var hh  = d.getHours();
  var min = d.getMinutes();

  var giorni = new Array("Domenia", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato");
  var mesi = new Array("Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto","Settembre",
            "Ottobre","Novembre","Dicembre");

  if (gg < 10)
    gg = "0"+gg;

  if (mm < 10)
    mm = "0"+mm;

  if (hh < 10)
    hh = "0"+hh;

  if (min < 10)
    min = "0"+min;

  document.write (giorni[gs]+" "+gg+" "+mesi[mm-1]+" "+aa);

}

// Orologio
function sivamtime() {
if (document.timeForm) {

  now=new Date();
  hour=now.getHours();
  min=now.getMinutes();
  sec=now.getSeconds();

if (min<=9) { min="0"+min; }
if (sec<=9) { sec="0"+sec; }
if (hour>12) { hour=hour-12; add="pm"; }
else { hour=hour; add="am"; }
if (hour==12) { add="pm"; }

document.timeForm.orologio.value = ((hour<=9) ? "0"+hour : hour) + ":" + min + ":" + sec + " " + add;

setTimeout("sivamtime()", 1000);
}
}

window.onload = sivamtime;

// FInd Object Position

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}
	return [curleft,curtop];
}
// PopUpMessage ---------------------------------------------------------
var PopMsgDisp = 0;
var PopMsgObj = "";

function PopMsg(mess,obj,w,l,d) {

if (PopMsgObj != obj) {
   PopMsgDisp = 0;
   PopMsgObj = obj;
}

var coors = findPos(obj);

if (PopMsgDisp == 0) {
document.all.popmessage.style.left=coors[0]+l + "px" ;
document.all.popmessage.style.top=coors[1]+d + "px" ;
document.all.popmessage.style.width=w + "px";
document.all.popmessage.innerHTML="<table><tr><td class='list' bgcolor='#ffffff'>" + mess + "</td></tr></table>";
document.all.popmessage.style.visibility="visible";
PopMsgDisp = 1;
}
else
{
document.all.popmessage.style.visibility="hidden";
PopMsgDisp = 0;
}
return false
}
// PopUpMenu ---------------------------------------------------------
var defaultMenuWidth="200px" //set default menu width.


// l'elenco delle voci di Menù deve essere inserito nella pagina


var ie5=document.all && ! window.opera
var ns6=document.getElementById

if (ie5||ns6)
document.write('<div id="popitmenu" onMouseover="clearhidemenu();" onMouseout="dynamichide(event)"></div>')

function iecompattest(){
return (document.compatMode && document.compatMode.indexOf("CSS")!=-1)? document.documentElement : document.body
}

function showmenu(e, which, optWidth,obj,t,l){

var coors = findPos(obj);

if ( ! document.all&&!document.getElementById)
return
clearhidemenu()
menuobj=ie5? document.all.popitmenu : document.getElementById("popitmenu")
menuobj.innerHTML=which
menuobj.style.width=(typeof optWidth!="undefined")? optWidth : defaultMenuWidth
menuobj.contentwidth=menuobj.offsetWidth
menuobj.contentheight=menuobj.offsetHeight
eventX=ie5? event.clientX : e.clientX
eventY=ie5? event.clientY : e.clientY
//Find out how close the mouse is to the corner of the window
var rightedge=ie5? iecompattest().clientWidth-eventX : window.innerWidth-eventX
var bottomedge=ie5? iecompattest().clientHeight-eventY : window.innerHeight-eventY
//if the horizontal distance isn't enough to accomodate the width of the context menu
menuobj.style.left=ie5? coors[0]+l + "px" : coors[0]+l + "px"
menuobj.style.top=ie5? coors[1]+t + "px" : coors[1]+t + "px"
menuobj.style.visibility="visible"
return false
}

function contains_ns6(a, b) {
//Determines if 1 element in contained in another- by Brainjar.com
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function hidemenu(){
  if (window.menuobj)
    menuobj.style.visibility="hidden"
}

function dynamichide(e){
if (ie5&&!menuobj.contains(e.toElement))
hidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
hidemenu()
}

function delayhidemenu(){
delayhide=setTimeout("hidemenu()",500)
}

function clearhidemenu(){
if (window.delayhide)
clearTimeout(delayhide)
}
// Eliminato per gestire l'onclick invece del onmouseover
//if (ie5||ns6)
//document.onclick=hidemenu

// End PopUpMenu ---------------------------------------------------------


// Gestione barra di navigazione tipo BreadCrumbs -------------------------
function BreadCrumbs(opt)
{
//
// opt = 0 ripulisce il cookie
// opt = 1 mantiene solo il primo link
// opt = 2 mette la pagina corrente come primo link
// opt = 3 accoda i link
//

var brdcrbs = "<font class='brdcrbs'>";
var pr = GetCookie("brdcrbs");
switch (opt)
{
  case 0:
    DeleteCookie("brdcrbs");
    return "";
    break;
  case 1:
    if (pr != null ) {
      var el = pr.split(",");
      pr = "";
      MemCookie("brdcrbs",el[0] + "," + el[1]);
    }
    return "";
    break;
  case 2:
    MemCookie("brdcrbs",window.document.title + "," + document.location);
    return "";
    break;
  case 3:
    if (pr == null ) pr = "";
    else
    {
    var el1 = pr.split(",");
    pr = "";
    for (i=0;i<el1.length;i+=2) {
      var stringa = "" + document.location;
     if (el1[i + 1] == stringa.replace("%20"," ")) break;
	    else
	    {
	     pr = pr + el1[i] + "," + el1[i + 1] + ",";
	     brdcrbs = brdcrbs + "<a href='" + el1[i + 1] +"' >"+ el1[i] + "</a> » ";
     }
     }
    }
    MemCookie("brdcrbs",pr + window.document.title + "," + document.location );
    brdcrbs = brdcrbs + " " + window.document.title; + "</font>"
    return brdcrbs;
    break;
  case 4:
    if (pr == null ) pr = "";
    else
    {
    var el1 = pr.split(",");
    pr = "";
    for (i=0;i<el1.length;i+=2) {
      var stringa = "" + window.document.title;
     if (el1[i] == stringa.replace("%20"," ")) break;
	    else
	    {
	     pr = pr + el1[i] + "," + el1[i + 1] + ",";
	     brdcrbs = brdcrbs + "<a href='" + el1[i + 1] +"' >"+ el1[i] + "</a> » ";
     }
     }
    }
    MemCookie("brdcrbs",pr + window.document.title + "," + document.location );
    brdcrbs = brdcrbs + " " + window.document.title; + "</font>"
    return brdcrbs;
    break;
  default:
    return "errore opzione BreadCrumbs";
    break;

 }
}

function MemCookie (variabile,valore)
{
var expDays = 1;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
expdate=exp.toGMTString();
document.cookie = variabile+"="+ valore+"; expires ="+ expdate+"; path=/";
}

function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}

function DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
// END Gestione barra di navigazione tipo BreadCrumbs -------------------------

// Check Intrusion -------------------------

function CheckIntrusion(us)
{
 gk = GetCookie("DIAPortalProfile");
 if ( gk.lenght == 0 ) {
   document.write("Accesso non Autorizzato");
   document.close();
 }
 else  {
   if ( gk.match(us) != us ) {
        document.write("Autorizzazioni non sufficienti");
        document.location.href("http://"+location.hostname+":"+location.port);
    }
 }

}
//-->

