// JavaScript Document


// These first three scripts were originally written by Scott Andrew (http://www.scottandrew.com/)
function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}


function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}


function eraseCookie(name)
{
	createCookie(name,"",-1);
}





// 0 = closed, 1 = open
function openTab(x)
{
		// set this tabs cookie value to open
		createCookie('tab'+x,1,7);
		// Switch the tab and show the corresponding content panel
		//document.getElementById('tab'+x+'_show').style.display='none';
		//document.getElementById('tab'+x+'_hide').style.display='block';
		document.getElementById('tab'+x+'_content').style.display='block';
}

function closeTab(x)
{
		// set this tabs cookie value to open
		createCookie('tab'+x,0,7);
		// Switch the tab and show the corresponding content panel
		//document.getElementById('tab'+x+'_show').style.display='block';
		//document.getElementById('tab'+x+'_hide').style.display='none';
		document.getElementById('tab'+x+'_content').style.display='none';
}



function init()
{
	openTab(0);
	for (var i=1;i<=6;i++) {
		var x = readCookie('tab'+i);
		if (x==1) {
			openTab(i);
		} else{
			closeTab(i);
		}
	}
}

function eraseAll()
{
	for (var i=0;i<=6;i++) {
		eraseCookie('tab'+i);
	}
}

