function OnChange(source, value)
{
	switch (source)
	{
		case "countryid":
			OnChangeCountry(value);
			Clear("itemid");
			break;
			
		case "regionid":
			OnChangeRegion(value);
			break;
		
		case "itemid":
			OnChangeItem(value);
			break;
			
		case "catalogid":
			OnChangeCatalog(value);
			break;
	}
}

function Clear(name)
{
	getElementByAlias(name).options.length = 0;
}

function OnChangeCountry(id)
{
	var xmlRequest;
	
	xmlRequest = new XmlRequest();
	xmlRequest.ServerPage = applicationPath + "XmlHttp/LoadRegions.aspx";
	xmlRequest.ExecuteIntoSelect("<root><id>" + id + "</id></root>", getElementByAlias("regionid"));
}

function OnChangeRegion(id)
{
	var xmlRequest;
	
	xmlRequest = new XmlRequest();
	xmlRequest.ServerPage = applicationPath + "XmlHttp/LoadHotels.aspx";
	xmlRequest.ExecuteIntoSelect("<root><id>" + id + "</id></root>", getElementByAlias("itemid"));
}

function OnChangeItem(id)
{
	var xmlRequest;
	
	xmlRequest = new XmlRequest();
	xmlRequest.ServerPage = applicationPath + "XmlHttp/SelectHotel.aspx";
	xmlRequest.ExecuteNonQuery("<root><id>" + id + "</id></root>", getElementByAlias("itemid"));
	if (id != "")
	{
		window.location.href = "hotel.aspx?ciid=" + id;
	}
}

function OnChangeCatalog(id)
{
	window.location.href = id + ".aspx";
}

function Goto()
{
	var xmlRequest;
	
	xmlRequest = new XmlRequest();
	xmlRequest.ServerPage = applicationPath + "XmlHttp/Goto.aspx";
	window.location.href = applicationPath + xmlRequest.ExecuteScalar("<root/>");
}