function getCookie(c_name){
	if (document.cookie.length>0)
	  {
	  c_start=document.cookie.indexOf(c_name + "=");
	  if (c_start!=-1)
	    {
	    c_start=c_start + c_name.length+1;
	    c_end=document.cookie.indexOf(";",c_start);
	    if (c_end==-1) c_end=document.cookie.length;
	    return unescape(document.cookie.substring(c_start,c_end));
	    }
	  }
	return "";
}

function setCookie(c_name,value,expiredays){
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function preupdateH(){
	alerts=getCookie('alerts');
	if(!alerts){
		setCookie('alerts', 'yes', 7)
		setTimeout("new Effect.Move('main', { x: 0, y: -37, mode: 'relative' });new Effect.BlindDown('notice');new Effect.Appear('removenotice');", 12000);
	}else if(alerts=='yes'){
			new Effect.Move('main', { x: 0, y: -37, mode: 'relative' });
			new Effect.BlindDown('notice');
			new Effect.Appear('removenotice');
			updateH();
	}
}

function removeNotice(){
	new Effect.BlindUp('notice');
	new Effect.Fade('removenotice');
	new Effect.Move('main', { x: 0, y: 0, mode: 'relative' });
	setCookie('alerts', 'no', 7)
}

function updateH(){
	alerts=getCookie('alerts')
	if(!alerts||alerts=='yes'){
		new Effect.Fade('notices');
		setTimeout("new Ajax.Updater('notices', '/includes/notices.php', {onComplete:function(){Effect.Appear('notices');}});",1500);
	}
}

var refreshId = setInterval(function() {
	updateH()
}, 12000);

window.onload=preupdateH;
