<!--

// function setCookie(myName, myValue, myDate, myPath)
// function getCookie(myName) 
// function getCookieValue(myStr, myKey, myDelimiter) 
// function delCookie(myName,myPath,myDomain)


//--- Set global variables ------
// Cookie expiration date 
// var dEXPIRE = new Date("Month DD,YYYY")
var dEXPIRE = new Date("December 31, 2099 00:00:01") 
// The checkbox will appair iTIMES+1 time
var iTIMES  = 1
var sPATH = "/"


function setCookie(myName, myValue, myDate, myPath)
{
	// PURPOSE
	// Sets the cookie by updating document.cookie with the input
	// values.

	var myProperties= myName + "=" + escape(myValue)
	if(!myDate) myDate=dEXPIRE
	myProperties += ";expires="+myDate.toGMTString();

	if(!myPath) myPath= sPATH
	myProperties += ";path="+myPath;

	document.cookie=myProperties;
}

function getCookie(myName) 
{
	// PURPOSE
    	// Scans through document.cookie until the the cookie 
    	// in question is found and then returns that  cookie's value.
	myName= myName+"="
	return getCookieValue(document.cookie,myName,";")
}


function getCookieValue(myStr, myKey, myDelimiter)
{
  	// PURPOSE
    // This function scans through the input string str 
	// searching for the input key. 
    // The delimiter input specifies the delimiter which follows the key
	
	var myValue
	var iBegin
	var iEnd
	// Case A: no cookie
 	if (myStr == null) return null;
    	if (myStr.length > 0)
	{
      		iBegin = myStr.indexOf(myKey)

//alert(iBegin);
// vale sempre zero
      		if (iBegin != -1)
		{
        		iBegin += myKey.length;
        		iEnd = myStr.indexOf(myDelimiter, iBegin);
        		if (iEnd == -1)
			{
          			iEnd = myStr.length;
			}
			// Case B: cookie exists with this name
			return unescape(myStr.substring(iBegin, iEnd));
		}

/*
if (iBegin = 2)
{

dEXPIRE = new Date("December 25, 2000 18:59:59")
alert (dEXPIRE);
*/
/*	var myDate = new Date("December 25, 1971 18:59:59");
    setCookie(myName, "", new Date("December 25, 1971 18:59:59") ,sPATH);
*/
/*
}
*/

    	}
    	// Case C: no cookie with this name
 	return null;
}


/*
function delCookie(myName,myPath,myDomain)
{
	// PURPOSE
	// Delete this cookie
	var myDate = new Date("December 25, 1971 18:59:59")
    setCookie(myName, "", new Date("December 25, 1971 18:59:59") ,sPATH)
	
}
*/
//-->


