function switchLanguages() {
	talen = getTalen();
	var elem = document.getElementById('country');	
	var sel = elem.options[elem.selectedIndex].value;
	var taal = talen[sel];
	
	var selectBox = document.getElementById('mojoWebsiteId');	
	selectBox.options.length = null;
	selectBox.options[selectBox.options.length] = new Option('Select language','');
	for(key in taal) {
	  selectBox.options[selectBox.options.length] = new Option(taal[key].unescapeHtml(),key);
	}
}	

function redirect() {
	var selectBox = document.getElementById('mojoWebsiteId');	
	var id = selectBox.value;
	for (var i=0; i<websiteUrls.length; i++) {
		var urlRec = websiteUrls[i];
		if (urlRec.id==id) document.location.href=urlRec.url;
	}	
}

function getTalen() {
	
	var talen = { "France":	{ "119":'Fran&ccedil;ais', "178":'English'},
								"Nederland": { "2":'Nederlands', "166":'English'},
								'Belgique': { "179":'Fran&ccedil;ais', "2":'Nederlands', "166":'English',"180":'Deutsch'},
								'Luxembourg':{ "180":'Deutsch', "179":'Fran&ccedil;ais', "166":'English'}
						};
	var talen = { 
								"Nederland": { "2":'Nederlands', "166":'English'},
								'Belgique': { "179":'Fran&ccedil;ais', "2":'Nederlands', "166":'English',"180":'Deutsch'},
								'Luxembourg':{ "180":'Deutsch', "179":'Fran&ccedil;ais', "166":'English'}
						};
	return talen;
}

function setLanden() {	
	talen = getTalen();
	var selectBox = document.getElementById('country');	
	selectBox.options.length = null;
	selectBox.options[selectBox.options.length] = new Option('Select country','');
	for(key in talen) {
	  selectBox.options[selectBox.options.length] = new Option(key,key);
	}
}

String.prototype.unescapeHtml = function () {
    var temp = document.createElement("div");
    temp.innerHTML = this;
    var result = temp.childNodes[0].nodeValue;
    temp.removeChild(temp.firstChild)
    return result;
	}
	
$(document).ready(setLanden);	
