
/*** LETTURA DEL COOKIE ****************/
function WM_readCookie(name) {
    if(document.cookie == "") { // there's no cookie, so go no further
	return false; 
    } else { // there is a cookie
	var firstChar, lastChar;
	var theBigCookie = document.cookie;
	firstChar = theBigCookie.indexOf(name);	// find the start of 'name'
	var NN2Hack = firstChar + name.length;
	if((firstChar != -1) && (theBigCookie.charAt(NN2Hack) == '=')) { // if you found the cookie
	    firstChar += name.length + 1; // skip 'name' and '='
	    lastChar = theBigCookie.indexOf(';', firstChar); // Find the end of the value string (i.e. the next ';').
	    if(lastChar == -1) lastChar = theBigCookie.length;
	    return unescape(theBigCookie.substring(firstChar, lastChar));
	} else { // If there was no cookie of that name, return false.
	    return false;
	}
    }	
} // WM_readCookie

/*** SCRITTURA DEL COOKIE ****************/
function WM_setCookie (name, value, hours) {
var not_NN2 = (navigator && navigator.appName 
	   && (navigator.appName == 'Netscape') 
	  && navigator.appVersion 
	  && (parseInt(navigator.appVersion) == 2))?false:true;
if(hours && not_NN2) { // NN2 cannot handle Dates, so skip this part
    if ( (typeof(hours) == 'string') && Date.parse(hours) ) { // already a Date string
         var numHours = hours;
    } else if (typeof(hours) == 'number') { // calculate Date from number of hours
         var numHours = (new Date((new Date()).getTime() + hours*3600000)).toGMTString();
    }
}
document.cookie = name + '=' + escape(value) + ((numHours)?(';expires=' + numHours):'') +';path=/'; // Set the cookie, adding any parameters that were specified.
    
} // WM_setCookie


/*** CANCELLAZIONE DEL COOKIE ****************/
function WM_remCookie (name, value, hours) {
var not_NN2 = (navigator && navigator.appName 
	   && (navigator.appName == 'Netscape') 
	  && navigator.appVersion 
	  && (parseInt(navigator.appVersion) == 2))?false:true;
if(hours && not_NN2) { // NN2 cannot handle Dates, so skip this part
    if ( (typeof(hours) == 'string') && Date.parse(hours) ) { // already a Date string
         var numHours = hours;
    } else if (typeof(hours) == 'number') { // calculate Date from number of hours
         var numHours = (new Date((new Date()).getTime() + hours*3600000)).toGMTString();
    }
}
document.cookie = name + '=' + escape(value) + ((numHours)?(';expires=Fri, 02-Jan-1970 00:00:00 GMT'):'') +';path=/'; // Set the cookie, adding any parameters that were specified.
    
} // WM_remCookie



/**** UTILITY *******/
function WM_checkIn(id) {


//Usage: WM_checkIn('id')


  // This function checks for DOM strategy, then 
  // returns an object reference.
  if (document.all) {
    return document.all[id].style;
  } else if(document.layers) {
    return document.layers[id];
  }
}




/**** VISIBLE *********/


function WM_changeVisibility() {
  if (document.layers || document.all) {
    var inc, endInc=arguments.length;
    // run through the args (objects) and set the visibility of each
    for (inc=0; inc<endInc; inc+=2) {
      // get a good object reference
      var daObj = WM_checkIn(arguments[inc]);
      if (arguments[inc+1] == hidden) {
        // hide the object
        daObj.visibility = hidden;
      } else if (arguments[inc+1] == visible) {
        // show the object
        daObj.visibility = visible;
      } else if (arguments[inc+1] == toggle) {
        // toggle the object's visibility
        if (daObj.visibility == visible) {
          daObj.visibility = hidden;
        } else if (daObj.visibility == hidden) {
          daObj.visibility = visible;
        }
      }
    }
  }
}




/******** STAMPA ********/

function printit(){  
if (window.print) {
    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 = "";  
}
}
/********************chiudi finestra*************/

function chiudi(passo_corrente) {
	WM_setCookie ("INDIETROLIV1","",99999);
	WM_setCookie ("INDIETROLIV2","",99999);
	c=WM_readCookie("INDIETROLIV1");
   	 a=WM_readCookie("INDIETROLIV2");
    
    
	top.close();
}

