//country select form scripts
var countryOriginalOptions = new Array;
function setCountryOptions(region,lang) {
  if (countryOriginalOptions.length == 0) {
    for (var i = 0; i < region.options.length; i++) {
        countryOriginalOptions[i] = region.options[i];
    }
  }
  var regionCountries = {
    Asia_Pacific:   ['Please Select...', 'Japan', 'North Korea', 'South Korea', 'China', 'Malaysia', 'Australia', 'Rest of Asia'],
    Europe:         ['Please Select...', 'Germany', 'Spain', 'France', 'Italy', 'Greece', 'Portugal', 'United Kingdom', 'Rest of Europe'],
    North_America:  ['Please Select...', 'United States', 'Canada', 'Mexico', 'Caribbean', 'Other']
  }
  
  //Allow for german translation of countries:
  if('de' == lang) {
		regionCountries = {
	    Asia_Pacific:   ['Please Select...', 'Japan', 'Nordkorea', 'Sudkorea', 'China', 'Malaysia', 'Australien', 'andere asiatische Lander'],
	    Europe:         ['Please Select...', 'Deutschland', 'Spanien', 'Frankreich', 'Italien', 'Griechenland', 'Portugal', 'Gro&szlig;britannien', 'andere europaische Lander'],
	    North_America:  ['Please Select...', 'Vereinigte Staaten', 'Kanada', 'Mexiko', 'Karibik', 'andere Lander']
	  }  	
  }

  //Allow for french translation of countries:
  else if('fr' == lang) {
		regionCountries = {
    Asia_Pacific:   ['Selectionner...', 'Japon', 'Coree du Nord', 'Coree du Sud', 'Chine', 'Malaisie', 'Australie', 'Reste de l\'Asie'],
    Europe:         ['Selectionner...', 'Allemagne', 'Espagne', 'France', 'Italie', 'Grece', 'Portugal', 'Royaume-Uni', 'Reste de l\'Europe'],
    North_America:  ['Selectionner...', 'Etats-Unis', 'Canada', 'Mexique', 'Caraibes', 'Autre']
	  }  	
  }
  
  
  //var newOptions = countryOriginalOptions;
  var newOptions = new Array();
  for (var regionS in regionCountries) {
    if (region.options[region.selectedIndex].value == regionS.replace(/_/, ' ')) {
      var newCountries = regionCountries[regionS];
      newOptions = new Array();
      for (var i = 0; i < newCountries.length; i++) {
          newOptions[i] = new Option(newCountries[i], (newCountries[i] == 'Please Select...') ? '' : newCountries[i]);
      }
    }
  }
  var countrySelect = document.getElementById('Country');
  //var countryTR = document.getElementById('CountryTR');
  if (newOptions.length > 0) {
    countrySelect.disabled = false;
    //countryTR.style.display = 'inline';
    for (var i = 0; i < countrySelect.options.length; i++) {
        countrySelect.options[i] = null;
    }
    countrySelect.options.length = 0;
    for (var i = 0; i < newOptions.length; i++) {
        countrySelect.options[i] = newOptions[i];
    }
  } else {
      //countryTR.style.display = 'none';
      countrySelect.disabled = true;
  }
}