function ler_cookie()
{
	crunch_cookie_inicio = document.cookie.indexOf("crunch_cookie=");
	crunch_cookie_inicio = crunch_cookie_inicio + "crunch_cookie".length + 1;
	crunch_cookie_fim = document.cookie.indexOf(";", crunch_cookie_inicio);
	if (crunch_cookie_fim==-1)
		{crunch_cookie_fim = document.cookie.length;}
	crunch_vis = document.cookie.substring(crunch_cookie_inicio, crunch_cookie_fim);
}

var hoje=new Date();
var crunch_vis;
hoje.setDate(hoje.getDate()+365);
	
function crunch_action()
{
	ler_cookie();

	if (crunch_vis == "" || crunch_vis == "on")
		{document.cookie="crunch_cookie=off;expires="+hoje.toGMTString();}
	else
		{document.cookie="crunch_cookie=on;expires="+hoje.toGMTString();}
		
	ler_cookie();
			
	if (crunch_vis == "" || crunch_vis == "on")//Fechar
		{
			document.getElementById("crunchtext").style.paddingTop="23px";
			document.getElementById("crunchtext").innerHTML="NOOOOOOOOOOO!";
			window.setTimeout("crunch_hide()", 1000);
		}
	else//Abrir
		{
			
			document.getElementById("crunchtext").style.paddingTop="13px";
			document.getElementById("crunchtext").innerHTML="Oh yeah! Crunch<br />is in the house!";
			document.getElementById("crunch").style.display="";
			document.getElementById("arrow_crunch").src="images/icons/arrow_up.gif";
			document.getElementById("arrow_crunch").title="Make Crunch go away!";
		}
}

function crunch_hide()
{
	document.getElementById("crunch").style.display="none";
	document.getElementById("arrow_crunch").src="images/icons/arrow_down.gif";
	document.getElementById("arrow_crunch").title="Let Crunch come out and play!";
}