// JavaScript Document


//read cookies
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;
}

//Add the extra text on the font page
document.cookie = "addParaCookie=NEW; path=/";
function addPara(text,spaceID) {
	if (readCookie('addParaCookie') != "NEW"){
		document.getElementById(readCookie('addParaCookie')).innerHTML = " &gt; &gt; &gt; ";
	}
	document.getElementById(spaceID).innerHTML = text;
	document.cookie = "addParaCookie=" + spaceID + "; path=/";
}

//the pop-out menus on the front page
var timeout	= 500;
var closetimer	= 0;
var ddmenuitem	= 0;

function mopen(id){	
	mcancelclosetime();
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';
}

function mclose(){
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

function mclosetime(){
	closetimer = window.setTimeout(mclose, timeout);
}

function mcancelclosetime(){
	if(closetimer){
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

document.onclick = mclose; 
