function getlanguage(){

	cook = WM_readCookie("hali_lang");
	if (cook) language = cook;
	else language=navigator.language? navigator.language : navigator.userLanguage;
	//alert(language);
	if(language){language=language.substring(0,2);}
	else{language="z";}
	//alert(language);
	switch (language){
	   case "en" :
	//      window.location="index.htm";
	      break;
	   case "de" :
	      window.location="index_de.htm";
	      break;
	   case "fr" :
	      window.location="index_fr.htm";
	      break;
	   default :
	 //window.location="index_no.htm";
	}
}

function setLanguage(lang){
	//alert("setting lang "+lang);
	document.cookie = "hali_lang="+lang;
}

function WM_readCookie(name) {

	if (document.cookie == '') { 
    
   // there's no cookie, so go no further
    
	return false;

	} else {
    
   // there is a cookie

	var firstChar, lastChar;

	var theBigCookie = document.cookie;

	firstChar = theBigCookie.indexOf(name);
	
   // find the start of 'name'

	if(firstChar != -1)  {
	
   // if you found the cookie

	firstChar += name.length + 1;
	    
   // skip 'name' and '='
	   
	lastChar = theBigCookie.indexOf(';', firstChar);
	    
   // Find the end of the value string (i.e. the next ';').
	    
	if(lastChar == -1) lastChar = theBigCookie.length;
	    
	return unescape(theBigCookie.substring(firstChar, lastChar));

	} else {
	
   // If there was no cookie of that name, return false.
	
	return false;
	
	}

    }
}
