function GetListHotel(CnNm,CtNm,Search,SortBy,PageNum)
{
	var Cbo = new CallBackObject();
	Cbo.OnError    = GetListHotel_OnError;
	Cbo.OnComplete = GetListHotel_Complete;
	var URL = "/Catalog/ListHotel.aspx";
	var Query = "City="+ CtNm +
				"&Country="+ CnNm+
				"&Search=" + escapeURI(Search)+
				"&SortBy="+SortBy+
				"&Page="+PageNum; 
	$("btSearch").disabled=true;
	$("Name").readOnly=true;
	var sr = $("SearchResult");
	sr.innerHTML = msgWaitWeSearch; // "Wait. We search ... ";
	Cbo.DoCallBack(URL,Query,1);
	return true;

}

function escapeURI(La){
if(encodeURIComponent) return encodeURIComponent(La);
if(escape) return escape(La)}


function GetListHotel_OnError(status, statusText, responseText){
	alert("OnError: " + status + "\r"+ statusText+"\r"+responseText);
	$("btSearch").disabled=false;
	$("Name").readOnly=false;
	$("SearchResult").innerHTML = msgErrorSearch; // "error search";
}

function GetListHotel_Complete(responseText, responseXML)
{
	$("btSearch").disabled=false;
	$("Name").readOnly=false;$("Name").focus();

	var len = String(responseText).trim().length;	 
	var msg = "";
// window.status = len + String(responseText).trim().substring(0,10);	  
	if(len>0)
		if($("radioSearchCity").checked){
			$("tdListHotel").innerHTML = responseText;
			if(SetPageVar && $("countPages")) 
			   SetPageVar(1,$("countPages").value,$("FirstPage").value,$("LastPage").value);
		}
		else
		{
			action = $("URLSearchHotelCountry").value+$("Name").value;
			document.forms[0].action = action;
			var ws = $("__VIEWSTATE");
			if(ws == null){
				var _ws = document.getElementsByName("__VIEWSTATE");
				ws = _ws[0];
			}
			ws.name = "_VIEW_STATE";
			ws.id = "_VIEW_STATE";
			document.forms[0].submit();
			ws.name = "__VIEWSTATE";
			ws.id = "__VIEWSTATE";
		}	
	else msg = msgNotFound; // "Nothing is found ";
	$("SearchResult").innerHTML = msg;
}

function GetPanelSponsor(CnId, CtId, Lang)
{
// alert("GetPanelSponsor(): " + CnId + " " + CtId + " " + Lang);
$("divSponsor").style.display = 'none';
var Cbo = new CallBackObject();
Cbo.OnError    = GetPanelSponsor_OnError;
Cbo.OnComplete = GetPanelSponsor_Complete;
var URL = "/catalog/PanelSponsor.aspx";
var Query = "&CnId="+CnId+"&CtId="+CtId+"&Lang="+Lang; 
Cbo.DoCallBack(URL,Query);
return true;
}

function GetPanelSponsor_OnError(status, statusText, responseText){
	alert("GetPanelSponsor_OnError: " + status + "\r"+ statusText+"\r"+responseText);
}

function GetPanelSponsor_Complete(responseText, responseXML)
{
// alert("GetPanelSponsor_Complete():\n" + responseText);
if(String(responseText).toLowerCase().indexOf("<title>error</title>")==-1){
	$("LabelAdvText").innerHTML = String(responseText).trim();
	var st = $("divSponsor").style;
	st.display = 'block';
	st.visibility = "visible"}
else window.status = '<title>error</title>'
}

function showChain(){
	$('chain_more').style.display = '';
	$('chain_show').style.display = 'none';
	$('chain_hide').style.display = '';
}

function hideChain(){
	$('chain_more').style.display = 'none';
	$('chain_show').style.display = '';
	$('chain_hide').style.display = 'none';
}

function shPN(NP)
{
	// lhSearch
	// lhPage
	// lhSort
	GetListHotel($("Country").value,$("City").value,$("lhSearch").value,$("lhSort").value,NP);
	return false;
}

function shSB(Sort)
{
	// alert("shSB(): " + Sort);
	GetListHotel($("Country").value,$("City").value,$("lhSearch").value, Sort,"1");
}
