var today = new Date();
var expiry = new Date(today.getTime() + 7 * 24 * 60 * 60 * 1000);


function getCookie(name)
{
// concatenate '=' to the cookie name 
var cookieName = name + "="
// assign document.cookie to a variable
var docCookie = document.cookie
var cookieStart
var end
if (docCookie.length>0)
{
/* search for the location of the named cookie
in the document.cookie object string which may 
contain more than one cookie separated by '; ' */
	cookieStart = docCookie.indexOf(cookieName)
	// if the cookie does not exist then return false
	if (cookieStart != -1)
	{
	// if the cookie exists then go to the end of the cookie name
		cookieStart = cookieStart + cookieName.length
		/* look for the ';' that defines the end of the named
		 cookie we need, beginning at cookieStart */
		end = docCookie.indexOf(";",cookieStart)
		if (end == -1)
		{
			end = docCookie.length
		}
		// finally extract the required string
		return unescape(docCookie.substring(cookieStart,end))
	}
}
return false
}


function deleteCookie(name)
{
// set the expiry date to the past
document.cookie = name + "=;expires=Thu, 01-Jan-1970 00:00:01 GMT" + ";path=/"
}


function setCookie(name,value,expires){
document.cookie=name+"="+value+";path=/"+((expires==null)?"":";expires="+expiry.toGMTString())
}


function initialize() {
	/*	if(getCookie('bannerCookie') == 'closed') {
			$('header_image').setStyle({display: 'none'});
			$('show-hide').setStyle({backgroundPosition: '0 0'});
			window.opened = false;
		} else {
			deleteCookie('bannerCookie');
			setCookie('bannerCookie', 'open', 14);
			window.opened = true;
		}*/
}
function toggle_visibility(image) {
	element = $$('#header > div')[1];
	Effect.toggle(element, 'blind', { duration: .5});
	
	if (opened && element.getHeight() == 164) {
		opened = false;
		$('show-hide').setStyle({backgroundPosition: '0 0'});
		deleteCookie('bannerCookie');
		setCookie('bannerCookie','closed', 14);
	} else if (element.getStyle('display') == "none"){
		opened = true;
		
		$('show-hide').setStyle({backgroundPosition: '0 20px'});
		deleteCookie('bannerCookie');
		setCookie('bannerCookie','open', 14);
	}
}

function open_link() {
	// go nowhere
	return false;
}