VanPetrol 0 Light Poster

Hi,
This is my first ever "real" php script, so excuse any stupid code.
Unfortunately the thing always return english, even if i'm on a chinese computer.

/*Get the language that should be used.
First check cookies, as this may be set from a previous session.
Then check browser language. Can only one of the supported languages.
Default to english, and always set cookie again. */
function get_user_lang()
{
$supported_languages = array('en-us' => 'English', 'zh-cn' => 'Chinese', 'ja-jp' => 'Japanese');
$lang = ''; 
if ( isset($_COOKIE["lang"]) ) 
$lang = strtolower( $_COOKIE["lang"] );
if ( array_key_exists( $lang,$supported_languages )== false && isset( $_SERVER["HTTP_ACCEPT_LANGUAGE"] ) ) 
$lang = strtolower( $_SERVER["HTTP_ACCEPT_LANGUAGE"] ); 
if ( array_key_exists( $lang,$supported_languages ) == false )
$lang = 'en-us';
setcookie( "lang", $lang, time()+31536000 );
return $lang;
}

The idea is that if the user have been here before, go to the same language he used then.
If not, get the browser language.
Seeing we only support english, japanese and chinese, go to english if it's another language.
Default to English