//var langcodes=["nl", "es"];
//var langcodes=["es"];
var langcodes=["nl"];

// Browser Language Redirect script
// copyright 3rd January 2006, Stephen Chapman
// permission to use this Javascript on your web page is granted
// provided that all of the code in this script (with the sole exception
// of the langcodes array entries) is used without any alteration

var langCode = navigator.language || navigator.systemLanguage;
var lang = langCode.toLowerCase(); 

lang = lang.substr(0,2); 
var source = window.location.href; 
var dest = "index-en.html"; 
if (source.lastIndexOf("html") == -1) {
	dest = source + "index-en.html"
}
for (i=langcodes.length-1;i >= 0; i--){
    if (lang==langcodes[i]){
		if (source.lastIndexOf("html") == -1) {
			dest = source + 'index-' + lang.substr(0,2) + ".html"; 
		}
		else {
			dest = source.substr(0,source.lastIndexOf('.')) + '-' + lang.substr(0,2) + source.substr(source.lastIndexOf('.')); 
		}
    }
}
window.location=dest;

