
function launchRadioCookie( track )	{
	var tomorrow = expiration( 1 );	
	setCookie( "uo_sound", track, tomorrow );
}

function getCookie( name )	{
	var search = name + "=";
	if( document.cookie.length > 0 )	{ // if there are any cookies
		offset = document.cookie.indexOf( search );
		if( offset != -1 )	{ //if the cookie exists
			offset+= search.length;
			end = document.cookie.indexOf( ";", offset );
			if( end == -1 )	{
				end = document.cookie.length;
			}
			return unescape( document.cookie.substring( offset, end ) );
		}
	} else {
		return false
	}
}	

function expiration( days )	{
	var expires = new Date();
	var today = new Date();
	expires.setTime( today.getTime() + 
	 ( 1000*60*60*24*parseInt( days ) ) );
	return expires;
}

function setCookie( name, value, expire )	{
	document.cookie = name + "=" + escape( value ) +
	 ( ( expire==null ) ? "" : ( "; expires=" +
	 expire.toGMTString() ) );
}

function soundOn() {
   setCookie( "uo_sound","on",expiration(7) );
   location.href = "/official/lordoftherings/bfme2/us/home.jsp";
}

function soundOff() {
   setCookie( "uo_sound","off",expiration(7) );
   location.href = "/official/lordoftherings/bfme2/us/home.jsp";
}