var default_name = document.getElementById("country").options[0].text;
var groups=document.getElementById("region").options.length;
var group=new Array(groups)
for (i=0; i<groups; i++) group[i]=new Array();

function unescapeHTML(html) {
	var htmlNode = document.createElement("DIV");
	htmlNode.innerHTML = html;
	if(htmlNode.innerText)
		return htmlNode.innerText; // IE
	return htmlNode.textContent; // FF
}

function redirect(x){
  for (m=document.getElementById("country").options.length-1;m>0;m--)
    document.getElementById("country").options[m]=null
  for (i=0;i<group[x].length;i++){
    document.getElementById("country").options[i]=new Option(unescapeHTML(group[x][i].text),group[x][i].value)
  }
  document.getElementById("country").options[0].selected=true
}

function go( selector ){
	if( !selector )
	  document.location=document.getElementById("country").options[document.getElementById("country").selectedIndex].value;
	else
	  document.location=selector.options[selector.selectedIndex].value;
}
function redirect_lang(x, lang){
  for (m=document.getElementById("country_" + lang).options.length-1;m>0;m--)
    document.getElementById("country_" + lang).options[m]=null
  for (i=0;i<group[x].length;i++){
    document.getElementById("country_" + lang).options[i]=new Option(unescapeHTML(group[x][i].text),group[x][i].value)
  }
  document.getElementById("country_" + lang).options[0].selected=true
}

