function displayContentById(contentid)
{
	if (content = document.getElementById(contentid))
		content.style.display = 'block';
}

function hideContentById(contentid)
{
	if (content = document.getElementById(contentid))
		content.style.display = 'none';
}

function initialArchives()
{
    var showArchive = readCookie("HushShowArchive");
    if (showArchive == null) showArchive = "YES";
    if (showArchive != "YES")
        switchArchives();
}

function writeCookie(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);
}


function switchArchives()
{
	if (link = document.getElementById('archive-link')) {
		if (link.innerHTML  == 'Show Archive List') {
			displayContentById('archive-box');
			writeCookie("HushShowArchive", "YES");
			link.innerHTML = 'Hide Archive List';
		} else {
			hideContentById('archive-box');
			writeCookie("HushShowArchive", "NO");
			link.innerHTML = 'Show Archive List';
		}
	}
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=550,left = 760,top = 325');");
}

