<!---

// ********** INIZIO SEZIONE
// funzioni per la gestione dei COOKIES...
// (C) 2001 Gaetano Marotta. Tutti i diritti sono riservati.

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 GetCookie

//called by function GetCookie to retrieve cookie value
function getCookieVal (offset){
        var endstr = document.cookie.indexOf (";", offset);
        if (endstr == -1)
                endstr = document.cookie.length;
        return unescape(document.cookie.substring(offset, endstr));
} // getCookieVal


                function SetCookie (name,value,expires,path,domain,secure)
                {
                  document.cookie = name + "=" + escape (value) +
                    ((expires) ? "; expires=" + expires.toGMTString() : "") +
                    ((path) ? "; path=" + path : "") +
                    ((domain) ? "; domain=" + domain : "") +
                    ((secure) ? "; secure" : "");
                }


                function TestBrowser()
                {
                  SetCookie("TestBrowserCookie","TEST", null,"/",null,false);
                  if (GetCookie("TestBrowserCookie") == null)
                  {
                    return false;
                  }
                  else
                  {
                    DeleteCookie("TestBrowserCookie","/", null);
                    return true;
                  }
                }

                //Function to delete cookie
                function DeleteCookie (name,path,domain)
                {
                  if (GetCookie(name))
                  {
                    document.cookie = name + "=" +
                      ((path) ? "; path=" + path : "") +
                      ((domain) ? "; domain=" + domain : "") +
                      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
                  }
                }

                function getLoginValues()
                {
                  var loginCookieVal=GetCookie("Login");

                  if(loginCookieVal==null)
                    return new Array(null,null);

                  var loginCookieArr= loginCookieVal.split("#");
                  return loginCookieArr;

                }


                function getDateDifference(serverTime,cookieTime,compName)
                {
                   if(serverTime == 0)
                     serverTime = new Date();
                   else
                    serverTime=new Date(serverTime);

                   cookieTime=new Date(cookieTime);
                   difference=serverTime.getTime()-cookieTime.getTime();

                   /* difference made positive if the difference is less
                      than one minute for the servertime < cookietime fix
                      because servertime is written to the GetServerTime.txt
                      only every minute and not in between
                    */

                   if(difference<0 && difference > -60000)
                   {
                       difference=Math.abs(difference);
                   }

                   lang=GetCookie('LanguageCode');

                   var index1=-1;
                   for(i=0;i<languages.length;i++)
                     if(languages[i] == lang)
                       index1=i;

                   passwdIndex=component[compName].length;
                   timeOut=component[compName][index1];

                   //Convert time out to milliseconds
                   timeOut = (timeOut * 60000);

                   if (difference > timeOut)
                   {
                     if (timeOut == 0)
                       timeOut = 60000;

                     return new Array(0,component[compName][passwdIndex-1],timeOut);
                   }
                   else
                   {
                     if (difference < 0)
                       return new Array(0,component[compName][passwdIndex-1],timeOut);

                     var diff = (timeOut - difference);
                     return new Array(1,component[compName][passwdIndex-1],diff);
                   }
                }

// ********** FINE SEZIONE


// ********** INIZIO SEZIONE

function apri_finestra(str) {
    theWin = window.open(str,'ASTAMIA','scrollbars=yes,resizable=no,width=512,height=384,status=no,location=no,toolbar=no');
    theWin.document.close()
    //theWin.refer = self;
} // apri_finestra

function apri_finestra_piccola(str) {
    theWin = window.open(str,'ASTAMIA','scrollbars=yes,resizable=no,width=300,height=200,status=no,location=no,toolbar=no');
    theWin.document.close()
    //theWin.refer = self;
} // apri_finestra_piccola

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
} // MM_jumpMenu

// ********** FINE SEZIONE


// ********** INIZIO SEZIONE

function CheckIEBrowser(IEvers,IEpassString,IEnoPassString) {
  var        theString='',
          verStr=navigator.appVersion,
          app=navigator.appName,
          version = parseFloat(verStr);

  if (app.indexOf('Microsoft') != -1) {
    if (version >= IEvers || verStr.indexOf(IEvers) != -1) {
            theString=IEpassString;
    }
  } // if...

  // se la stringa non è stata impostata...
  if (theString=='') {
          theString=IEnoPassString;
  } // if...

  // stampo la stringa...
  document.write(theString);

} // CheckIEBrowser

// ********** FINE SEZIONE

//  FINE   --->
