function set_cookie(name, value, days, path, domain, secure) {
	try {
		days = 0+parseInt(days);
		var expires = new Date();
		expires.setTime( expires.getTime() + days * 1000 * 60 * 60 * 24 );
	
		document.cookie = (name) + "=" + escape( value ) +
			"; expires=" + expires.toGMTString() + 
			( ( domain ) ? "; domain=" + domain : "" ) +
			( ( path ) ? "; path=" + path : "" ) + 
			( ( secure ) ? "; secure" : "" );
	} catch (err) {
		alert("s_c " + err.toString());
	}
}

// this function gets the cookie, if it exists
function get_cookie( name ) {
	try {
		var start = document.cookie.indexOf( name + "=" );
		var len = start + name.length + 1;
		
		if ( !start && name != document.cookie.substring(0, name.length) ) {
			return null;
		}
		
		if ( start == -1 ) return null;
		
		var end = document.cookie.indexOf( ";", len );
		if ( end == -1 ) {
			end = document.cookie.length;
		}
		
		return unescape( document.cookie.substring(len, end) );
	} catch (err) {
		alert("g_c " + err.toString());
	}
	
	return null;
}

// this deletes the cookie when called
function del_cookie( name, path, domain ) {
if ( get_cookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
	