// JavaScript Document
<!-- Begin Script

		/*Exemplos:
		var Nome = GetCookie('Nome')
		Nome = prompt("Quem é você?");
		SetCookie ('Nome', Nome, 30);
		*/

//  ********************* General Cookie handling *********************
//  Cookie Functions - Second Helping  (21-Jan-96)
//  Written by:  Bill Dortch, hIdaho Design <bdortch@netw.com>
//  The following functions are released to the public domain.

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 SetCookie (name, value) {  
			
	var argv = SetCookie.arguments;  
	var argc = SetCookie.arguments.length;  
	var expires = (argc > 2) ? argv[2] : null;  
	var expiresInterval= (argc > 3) ? argv[3] : null;   //padrao é dia, pode ser também 'm' de minutos ou 'h' de horas
	var path = (argc > 4) ? argv[4] : null;  
	var domain = (argc > 5) ? argv[5] : null;  
	var secure = (argc > 6) ? argv[6] : false;  


	if (expires!=null) //num de dias pra expirar
	{
		var exp = new Date(); 
		switch(expiresInterval) {
		case 'm':
			exp.setTime(exp.getTime() + (expires*60*1000));
			break;
		case 'h':
			exp.setTime(exp.getTime() + (expires*60*60*1000));
			break;
		default:
			exp.setTime(exp.getTime() + (expires*24*60*60*1000));
		}
	}

	document.cookie = name + "=" + escape (value) + 
	((expires == null) ? "" : ("; expires=" + exp.toGMTString())) + 
	((path == null) ? "" : ("; path=" + path)) +  
	((domain == null) ? "" : ("; domain=" + domain)) +    
	((secure == true) ? "; secure" : "");
}


function DeleteCookie (name) {  
	var exp = new Date();  
	exp.setTime (exp.getTime() - 1);  
	// This cookie is history  
	var cval = GetCookie (name);  
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();

}

-->