// for ajax based dropdown for getting city from province code in restaurant
function getCity(ProvinceCode, IndexPage)
{
	if(ProvinceCode)
	{
		IndexPage = typeof(IndexPage) != 'undefined' ? IndexPage : 0;
		$.ajax({
			type: "GET",
			url: "ajax-get-city.php",
			data: "ProvinceCode="+ProvinceCode+"&IndexPage="+IndexPage,
			cache: false,
			error: function(){
        		//alert('Error loading AJAX');
    		},			
			success: function(msg){
				var divArea = "";
				var divLoading = "";
				
				//alert(IndexPage);
				
				if(IndexPage == 2)
				{
					divArea = "#divCityArea2";
					divLoading = "#loading2";					
				}
				else
				{
					divArea = "#divCityArea";
					divLoading = "#loading";
				}
				
				$(divArea).html(msg);
			}
		});

		
		// if version 2 is called
		if(IndexPage == 2)
		{
			//alert(IndexPage);
			$("#loading2").bind("ajaxSend", function(){
				$(this).show();
			}).bind("ajaxComplete", function(){
				$(this).hide();				
			});
			
			$("#loading").unbind("ajaxSend");
			//$("#loading").unbind("ajaxComplete");
		}
		else
		{
			//alert(IndexPage);
			$("#loading").bind("ajaxSend", function(){
				$(this).show();
			}).bind("ajaxComplete", function(){
				$(this).hide();
			});
			
			$("#loading2").unbind("ajaxSend");
			//$("#loading2").unbind("ajaxComplete");
		}
	}
	else
	{
		if(IndexPage != 2)
			var City = document.getElementById('City');
		else
			var City = document.getElementById('City2');
		City.selectedIndex = 0;
		City.disabled = true;
	}
}
