function togglepopup() {
	elem = document.getElementById('popup');
	if(elem.style.visibility == 'visible')
		elem.style.visibility = 'hidden';
	else
		elem.style.visibility = 'visible';

	return false;
}

function homepopup() {
	var today = new Date();
	todate = readCookie('todate');
	if((todate == "") || (today.getMonth()+'-'+today.getDate() != todate))
		document.getElementById('popup').style.visibility = 'visible';

	expire_date = new Date(today.getTime() + (8 * 7 * 86400000)); 
	document.cookie = 'todate='+today.getMonth()+'-'+today.getDate()+'; expires='+expire_date.toGMTString()+'; 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;
}