function locationsInit(url, world_region_id, country_id) {
	if(country_id == 0) {
		$('#country').load(url + "/_fetch_areas.php?type=country&world_region_id=" + world_region_id, false, function() {
			(country !== '') ? $('#country').value = country : $('#country').value = "0";
			$.each($('#country').find('option'), function() {
				if($(this).val() == country) {
					try {
						$(this).attr("selected", "selected");
						$('#country').trigger("change");
					}
					catch(ex) {
						
					}
				}
			});
			(country !== '') ? $('#country').trigger("change", [country]) : $('#country').trigger("change", ["0"]);
		});
	
		$('#country').change(function(e, id) {
			$('#region, #sub_region').html("");
			id = (id) ? id : $(this).val();
			$.get(url + "/_fetch_areas.php", {type: "region", id: id}, function(response) {
				if(response == "") {
					$('#region').attr("disabled", "disabled");
					$('#region').trigger("change", [id]);
					
				} else {
					$('#region').attr("disabled", "");
					$('#region').html(response);
					$('#region, #sub_region').value = "";
					$('#sub_region').attr("disabled", "disabled");
					$.each($('#region').find('option'), function() {
						if($(this).val() == region) {
							try {
								$(this).attr("selected", "selected");
								$('#region').trigger("change");
							}
							catch(ex) {
								try {
									changeRegion(0);	// only ie6 will access this
								}
								catch(ex){}
							}
						}
					});
				}
			});
		});
	} else {
		$('#region').load(url + "/_fetch_areas.php?type=region&country_id=" + country_id, false, function() {
			(region !== '') ? $('#region').value = region : $('#country').value = country_id;
			$.each($('#region').find('option'), function() {
				if($(this).val() == region) {
					try {
						$(this).attr("selected", "selected");
						$('#region').trigger("change");
					}
					catch(ex) {
						changeRegion(0);
					}
				}
			});
			//(country !== '') ? $('#country').trigger("change", [country]) : $('#country').trigger("change", ["0"]);
		});
		
		
	}
	
	// ie6 function
	function changeRegion(id) { 
		if(id !== 0) {
			id = country;
			filter = "country";
		} else {
			id = region;
			filter = "region";
		}
		$.get(url + "/_fetch_areas.php", {type: "sub_region", id: id, filter: filter}, function(response) {
			if(response === "") {
				$('#sub_region').attr("disabled", "disabled");
				$('#sub_region').html("");
				
			} else {
				$('#sub_region').attr("disabled", "");
				$('#sub_region').html(response);
				$.each($('#sub_region').find('option'), function() {
					if($(this).val() == sub_region) {
						try {
							$(this).attr("selected", "selected");
						}
						catch(ex) {}
					}
				});
			}
		});
	};
	
	$('#region').change(function(e, id) { 
		if(id) {
			id = $('#country').val();
			filter = "country";
		} else {
			id = $(this).val();
			filter = "region";
		}
		$.get(url + "/_fetch_areas.php", {type: "sub_region", id: id, filter: filter}, function(response) {
			if(response == "") {
				$('#sub_region').attr("disabled", "disabled");
				$('#sub_region').html("");
				
			} else {
				$('#sub_region').attr("disabled", "");
				$('#sub_region').html(response);
				$.each($('#sub_region').find('option'), function() {
					if($(this).val() == sub_region) {
						$(this).attr("selected", "selected");
					}
				});
				
			}
		});
	});
	
};