var country_okres = new Array();
country_okres[0] = new String('0;-');
country_okres[255] = new String('255;?');

function loadOkresSelectAndShowOrHide(sCountryVariable, sOkresVariable) {
  iCountrySelected = document.forms['settingsform'].elements[sCountryVariable].options[document.forms['settingsform'].elements[sCountryVariable].selectedIndex].value;
  loadOkresSelect(iCountrySelected, sOkresVariable);
  sSuffix = sOkresVariable.substring(sOkresVariable.length-1); //last character of Variable
  if (iCountrySelected == 0 || iCountrySelected == 255) {
    document.getElementById('location_chooser_' + sSuffix).className = 'hidden';
  } else {
    document.getElementById('location_chooser_' + sSuffix).className = 'visible';
  }
}

function loadOkresSelect(country, sOkresVariable, iDefaultOkresID) {
  var select = document.forms['settingsform'].elements[sOkresVariable];
  select.options.length = 0;
  var okres_name = country_okres[country].split('|');
  while (id_with_okres = okres_name.pop()) {
    var okres = id_with_okres.split(';');
    selected = iDefaultOkresID == okres[0] ? true : false;
    select.options[select.options.length] = new Option(okres[1], okres[0], false, selected);
  }
}

