function CountryChanged(lang)
{
	var ctry_obj = document.getElementById('country');
	var ctry_id = ctry_obj.options[ctry_obj.selectedIndex].value;
	var s_obj = window.frames['frame2'].document.getElementById('country'+ctry_id);
	if (s_obj == null){
		window.frames['frame1'].location.replace('/ctryregions.php?id='+ctry_id+'&lang='+lang);
	}else{
		FillRegions();
	}
}
function FillRegions()
{
	var ctry_obj = document.getElementById('country');
	var ctry_id = ctry_obj.options[ctry_obj.selectedIndex].value;
	var s_obj = window.frames['frame2'].document.getElementById('country'+ctry_id);
	var r_obj = document.getElementById('region');
	if (s_obj != null)
	{
		for (var i = r_obj.options.length - 1; i >= 0; i--)
			r_obj.options[i] = null;
		for (var i = 0; i < s_obj.options.length; i++)
			r_obj.options[i] = new Option(s_obj.options[i].text, s_obj.options[i].value);
	}
}
function OnFrame1()
{
	var ctry_obj = document.getElementById('country');
	var ctry_id = ctry_obj.options[ctry_obj.selectedIndex].value;
	var s_obj = window.frames['frame1'].document.getElementById('country'+ctry_id);
	if (s_obj != null)
		window.frames['frame2'].document.write('<SELECT NAME="country'+ctry_id+'" ID="country'+ctry_id+'">'+s_obj.innerHTML+'</SELECT>');
	FillRegions();
}

