/*
|----------------------------------------------------------------------------------------------------------------------------------
| show popup
|----------------------------------------------------------------------------------------------------------------------------------
|
|
|
*/

showOnce('ftw_popup');

/*
|----------------------------------------------------------------------------------------------------------------------------------
| display once
|----------------------------------------------------------------------------------------------------------------------------------
|
|	displays a style="display:none" element with id='freetheweb' once - then a cookie is put down 
|	and the div isn't displayed again for another month.
|
|
*/

function showOnce(popupName){
	if (get_cookie('ftw_cookie')!='seen'){
		document.getElementById(popupName).style.display='block';
		set_cookie ('ftw_cookie','seen',30);	 // store for 30 days
	}
}

/*
|----------------------------------------------------------------------------------------------------------------------------------
| set_cookie
|----------------------------------------------------------------------------------------------------------------------------------
|
|	sets a cookie for a given number of days.
|
|
|
*/
function set_cookie(c_name,value,expiredays){
	
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}


/*
|----------------------------------------------------------------------------------------------------------------------------------
| get_cookie
|----------------------------------------------------------------------------------------------------------------------------------
|
|	gets the value of a cookie, given a cookie name
|
|
|
*/
function get_cookie(name){

	var results = document.cookie.match ( '(^|;) ?' + name + '=([^;]*)(;|$)' );
	if ( results ) return ( unescape ( results[2] ) );
}