// the site redirects to the relevant language home page based on the language reported by the browser

// first check to see if there is a # symbol in the url
			
// if there is one then we do nothing

// if there is not one then sniff the language from the browser and redirect using a url with a # 
// to stop infinite loops

// if(location.href.indexOf('#') == -1){
	
	// if (navigator.browserLanguage){
		// var language = navigator.browserLanguage;
	// } else if (navigator.language){
		// var language = navigator.language;
	// } else if (navigator.userLanguage){
		// var language = navigator.userLanguage;
	// }

	
	// if (language.indexOf('fr') > -1) {
		// document.location.href =  location.pathname + '?lang=fr#/home/';
	// } else if(language.indexOf('es') > -1) {
		// document.location.href = location.pathname + '?lang=es#/home/';
	// }	else {
		// document.location.href = location.pathname + '?lang=en#/home/';
	// }
// }

//changes the language metatag accordinglly to the url
window.onload = function (){
	
	url = document.location.href;
	url = url.slice(url.lastIndexOf("="),2);
	var meta = document.getElementsByName('Content-Language');
	if (url.indexOf('fr') > -1) {
		meta[0].setAttribute("content","fr-FR");
	} else if(url.indexOf('es') > -1) {
		meta[0].setAttribute("content","es-ES");
	}	else {
		meta[0].setAttribute("content","en-UK");
	}
}

