var HSSearch =
{
test1 : function()
{
try {
try { notice.collapse(); } catch ( asdasd ) {}
if ( document.getElementById("geoh").value == '' || document.getElementById("geov").value == '' || document.getElementById("geoh").value == '0' || document.getElementById("geov").value == '0' )
{
document.getElementById("loction_search").value = '';
document.getElementById("loction_search").style.backgroundImage='url(/hotels/resource/images/progress/central_london4.jpg)';
document.getElementById("new_hotel-type").style.display = "";
}
else
{
//alert("Woot " + document.getElementById("geoh").value + "// " + document.getElementById("geov").value);
document.getElementById("loction_search").value = document.getElementById("locid").value;
document.getElementById("new_hotel-type").style.display = "none";
}
var roomCountElement = document.getElementById("num-of-rooms");
var roomCount = parseInt(roomCountElement.options[roomCountElement.selectedIndex].value);
if ( roomCount < 10 )
{
for (var i = 1 ; i <= 9; i++ )
{
var nodeBuildName = "room-" + i;
var roomSelectNode = document.getElementById(nodeBuildName);
roomSelectNode.style.display = ( i<=roomCount ) ? "" : "none";
}
}
HSSearch.checkDate();
} catch ( eee ) {}
},
toggleRoomCount:function(ref){
var room_count=ref.options[ref.selectedIndex].value;
if ( room_count == "10" )
{
if ( confirm("We are going to take you to the group bookings page?"))
{
location.href="http://www.londontown.com/hotels/London-Group-Hotel-Booking/";
}
}
else
{
for ( var i = 1 ; i <= 9 ; i++ )
{
document.getElementById( ("room-"+i) ).style.display = (i<=room_count) ? "" : "none";
// Child CHeck Element
rt_run_child_check();
}
}
},
addFilterToggle : function( name, state,code ){
if ( name == "STARS/ST5" ) name = "5 star hotels";
if ( name == "STARS/ST3" ) name = "3 star hotels";
if ( name == "STARS/ST4" ) name = "4 star hotels";
//sname = name.split("/"); name = name[0];
var toggle = document.createElement("div");
toggle.className = 'FILTER_toggle';
var check_house = document.createElement("div");
check_house.className = 'FILTER_floatLeft';
var check_item = document.createElement("input");
check_item.type="checkbox";
check_item.name = name;
check_item.code = code;
check_item.onclick=function(){ HSScreenSwitch.ShowWaitWithURI("?filterAddition="+this.code+"&pid=","Updating "+this.name+" filter"); }
if ( state ) check_item.checked = "checked";
check_house.appendChild(check_item);
toggle.appendChild(check_house);
var text = document.createElement("div");
text.className = 'FILTER_Text';
text.innerHTML = name;
toggle.appendChild(text);
var image_house = document.createElement("div");
image_house.className = 'FILTER_Image';
image_house.code=code;
image_house.state=state;
image_house.onclick=function(){
if ( this.state ) {
HSScreenSwitch.ShowWaitWithURI("?filterAddition="+this.code+"&removeRecent="+this.code+"&pid=", "Remove saved filter "+name);
}
else
{
HSScreenSwitch.ShowWaitWithURI("?removeRecent="+this.code+"&pid=", "Remove saved filter "+name);
}
}
image_house.innerHTML = '
';
toggle.appendChild(image_house);
var clear = document.createElement("div");
clear.className = 'FILTER_Clear';
toggle.appendChild(clear);
document.getElementById("filter_toggle_adder").insertBefore(toggle, document.getElementById("end_el"));
},
addCardToggle : function( name, state,code ){
var toggle = document.createElement("div");
toggle.className = 'FILTER_toggle';
var check_house = document.createElement("div");
check_house.className = 'FILTER_floatLeft';
var check_item = document.createElement("input");
check_item.type="checkbox";
check_item.name = name;
check_item.code = code;
check_item.onclick=function(){ HSScreenSwitch.ShowWaitWithURI("?card_check="+this.code+"&pid=","Updating "+this.name+" filter"); }
if ( state ) check_item.checked = "checked";
check_house.appendChild(check_item);
toggle.appendChild(check_house);
var text = document.createElement("div");
text.className = 'FILTER_Text';
text.innerHTML = name;
toggle.appendChild(text);
var image_house = document.createElement("div");
image_house.className = 'FILTER_Image';
image_house.code=code;
image_house.state=state;
image_house.onclick=function(){
HSScreenSwitch.ShowWaitWithURI("?card_check="+this.code+"&pid=", "Remove saved filter "+name);
}
image_house.innerHTML = '
';
toggle.appendChild(image_house);
var clear = document.createElement("div");
clear.className = 'FILTER_Clear';
toggle.appendChild(clear);
document.getElementById("filter_toggle_adder").insertBefore(toggle, document.getElementById("end_el"));
},
growFilter : function()
{
var d = document.getElementById("filter_bar");
d.style.display = '';
var dest = (d.scrollHeight)?parseInt(d.scrollHeight)-5:36;
//console.log("dest: " + dest);
var it = setInterval(function(){
var p = (parseInt(d.style.height)) ?parseInt(d.style.height) : 1;
if ( p=dest ) { p=dest; clearInterval(it); }
d.style.height=p+"px";
}
},30);
},
pop:function(taburi){
window.open ("/hotels/services/comportal/customer_service?tab_target="+taburi,"mywindow","menubar=1,resizable=1,width=358,height=392");
},
ge:function(d){return document.getElementById(d).options[document.getElementById(d).selectedIndex].value; },
/*---------------------------------------------------------------------------------------------------
* checkDate
* Checks the current date, sorts the days and possible date conflicts
*/
checkDate : function()
{
try{
var ops = ['arrivalDay','arrivalMonth','departureDay','departureMonth'];
var values = {};
for ( var i = 0; i 0 ) node.style.display = '';
if (document.getElementById("loction_search").value=='' )
{
document.getElementById("locid").value = "";
document.getElementById("geoh").value = "";
document.getElementById("geov").value = "";
document.getElementById("budget_check").checked = true;
document.getElementById("luxury_check").checked = true;
document.getElementById("basePriority").value = ""
document.getElementById("new_hotel-type").style.display = "";
}
},
responseCall:null,
resultCounter : 0,
Parse : function( responseData )
{
HSSearch.resultCounter = 0 ;
HSSearch.responseCall=responseData;
document.getElementById("loction_search").style.backgroundImage='';
document.getElementById("rem_search_fill").style.display = "";
var node = document.getElementById("search_results");
node.innerHTML = '';
node.style.zIndex = '999999';
node.onmouseover = function(){
HSSearch.activeCell = true;
}
node.onmouseout = function(){
HSSearch.activeCell = false;
}
if ( responseData.data.results == 0)
{
document.getElementById("locid").value = "";
document.getElementById("geoh").value = "";
document.getElementById("geov").value = "";
document.getElementById("budget_check").checked = true;
document.getElementById("luxury_check").checked = true;
document.getElementById("basePriority").value = "";
var result_node = HSSearch.element("div", {'borderBottom':'1px solid #CCCCCC','padding':'4px','fontFamily':'arial','fontSize':'12px','color':'#000000'},{'innerHTML':'No Results Found'});
node.appendChild(result_node);
node.noresults=true;
}
else
{
node.noresults=false;
for ( var i = 0; i < responseData.data.length; i++ )
{
var result_node = HSSearch.element("div", {'cursor':'pointer','padding':'4px','fontFamily':'arial','fontSize':'12px','color':'#000000'},{'base':responseData.data[i].base,'geoh':responseData.data[i].geoh,'geov':responseData.data[i].geov,'name':responseData.data[i].name,'innerHTML':responseData.data[i].hl});
result_node.id = "result_" + HSSearch.resultCounter ;
HSSearch.resultCounter++;
result_node.selectorOn=function(){
this.style.backgroundColor = '#CCCCCC';
};
result_node.selectorOff=function(){
this.style.backgroundColor = '#FFFFFF';
};
result_node.onmouseover=function(){
if ( HSSearch.keyDownNode != null ) try { HSSearch.keyDownNode.selectorOff(); } catch ( e1 ) {};
this.style.backgroundColor = '#CCCCCC';
};
result_node.onmouseout=function(){
this.style.backgroundColor = '#FFFFFF';
};
result_node.onmousedown = result_node.onclick = result_node.makeActive = function()
{
/**
* Removes the reference to Central London allowiing the internal
* CL reference to take priority. deb rqst: jh/aug/12
* Added "All London Hotels" - db rqst: jh/spt/12
*/
if ( this.name != 'Central London' && this.name != 'All London Hotels')
{
location.href="#!/search/" + this.name.replace(" ","_");
HSSearch.activeCell = false;
HSSearch.RemoveCell();
document.getElementById("loction_search").value = this.name;
HSSearch.currentPhrase = this.name;
document.getElementById("locid").value = this.name;
document.getElementById("geoh").value = this.geoh;
document.getElementById("geov").value = this.geov;
document.getElementById("budget_check").checked = true;
document.getElementById("luxury_check").checked = true;
document.getElementById("new_hotel-type").style.display = "none";
document.getElementById("basePriority").value = (this.base) ? this.base : "";
}
else
{
HSSearch.activeCell = false;
HSSearch.RemoveCell();
HSSearch.clearSearch();
}
}
node.appendChild(result_node);
// node.style.display = '';
//console.log("Appending Child Node");
}
}
node.style.display = '';
},
KeyPress : function( object )
{
document.getElementById("rem_search_fill").style.display = "none";
document.getElementById("loction_search").style.backgroundImage='';
if ( object.value == '')
{
document.getElementById("rem_search_fill").style.display = "none";
document.getElementById("locid").value = ""
document.getElementById("geoh").value = "";
document.getElementById("geov").value = "";
document.getElementById("budget_check").checked = true;
document.getElementById("luxury_check").checked = true;
document.getElementById("basePriority").value = "";
document.getElementById("new_hotel-type").style.display = "";
}
try { clearInterval(HSSearch.searchTimer); } catch ( clearIntervalException ) {}
if ( object.value != HSSearch.currentPhrase && object.value != '' )
{
HSSearch.searchTimer = setTimeout(
function()
{
document.getElementById("locid").value = ""
document.getElementById("geoh").value = "";
document.getElementById("geov").value = "";
document.getElementById("budget_check").checked = true;
document.getElementById("luxury_check").checked = true;
document.getElementById("basePriority").value = "";
try {
document.getElementById("loction_search").style.backgroundPosition = '302px 2px';
document.getElementById("loction_search").style.backgroundImage='url(/hotels/resource/images/searching/load1.gif)'; } catch (fE){}
HSSearch.currentPhrase = object.value;
ajax.remote.get("/hotels/live/search?query=" + object.value+"&language=","ignore_setter" );
}, 400
);
}
},
addLocation : function( name, geoh, geov )
{
location.href="#!/autoname/" + name.replace(" ","_");
document.getElementById("loction_search").value = name;
HSSearch.currentPhrase = name;
document.getElementById("locid").value = name;
document.getElementById("geoh").value = geoh;
document.getElementById("geov").value = geov;
document.getElementById("budget_check").checked = true;
document.getElementById("luxury_check").checked = true;
document.getElementById("loction_search").style.backgroundImage='';
document.getElementById("rem_search_fill").style.display = "";
document.getElementById("basePriority").value = "";
document.getElementById("new_hotel-type").style.display = "none";
},
keyDownIncrement : 0 ,
keyDownNode : null,
keyLastType : null,
keyDownCheck:function(event){ //40 down 38 up
event=(event)?event:window.event;
var keycode = (event.keyCode)?event.keyCode:event.which;
if ((keycode==13||keycode==40||keycode==38)&&HSSearch.resultCounter>0&&document.getElementById("search_results").style.display=="")
{
if ( keycode == 13 && HSSearch.keyDownNode )
{
HSSearch.keyDownNode.makeActive();
keycode=0;
try { event.preventDefault(); } catch ( e0 ) {}
try { window.event.cancelBubble = true; } catch ( e1 ) {}
try { event.stopPropagation(); } catch ( e2 ) {}
return false;
}
else
{
if ( HSSearch.keyDownNode != null ) try { HSSearch.keyDownNode.selectorOff(); } catch ( e1 ) {}
if ( keycode == 38 ) HSSearch.keyDownIncrement = HSSearch.keyDownIncrement - 1;
if ( HSSearch.keyLastType==40&&keycode==38 ) HSSearch.keyDownIncrement = HSSearch.keyDownIncrement - 1;
if ( HSSearch.keyLastType==38&&keycode==40 ) HSSearch.keyDownIncrement = HSSearch.keyDownIncrement + 1;
if ( HSSearch.keyDownIncrement < 0 ) HSSearch.keyDownIncrement = 0;
var formatted_id = "result_" + (HSSearch.keyDownIncrement);
HSSearch.keyDownNode = document.getElementById(formatted_id);
HSSearch.keyDownNode.selectorOn();
if ( keycode == 40 ) HSSearch.keyDownIncrement++;
if ( HSSearch.keyDownIncrement >= HSSearch.resultCounter ) HSSearch.keyDownIncrement = HSSearch.resultCounter - 1;
HSSearch.keyLastType = keycode;
}
}
}
};
var ajax =
{
remote :
{
get : function( url, handler )
{
if ( handler != "ignore_setter") url = url + "&keycode="+Math.random()+"&_hdl="+escape(handler)+"&dnr=1";
var ajaxHandle = null;
if ( window.XMLHttpRequest ) { ajaxHandle = new XMLHttpRequest(); }
else if ( window.ActiveXObject ) {
_msxml_progid=['MSXML2.XMLHTTP.6.0','MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP'];
for ( var i = 0 ; i < _msxml_progid.length; i++ ) try { ajaxHandle = new ActiveXObject(this._msxml_progid[i]); break; } catch(e) {}
if ( ajaxHandle == null ) ajaxHandle = new ActiveXObject('Microsoft.XMLHTTP');
}
if ( ajaxHandle != null)
{
ajaxHandle.onreadystatechange = function()
{
if (ajaxHandle.readyState == 4 && ajaxHandle.status == 200){
if (ajaxHandle.responseText){
var response = ajaxHandle.responseText;
try { eval(response); } catch ( exception ) {
}
}
}
}
ajaxHandle.open("GET", url, true);
ajaxHandle.send(null);
}
},
post : function( url, post, handler )
{
var ajaxHandle = null;
if ( window.XMLHttpRequest ) { ajaxHandle = new XMLHttpRequest(); }
else if ( window.ActiveXObject ) {
_msxml_progid=['MSXML2.XMLHTTP.6.0','MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP'];
for ( var i = 0 ; i < _msxml_progid.length; i++ ) try { ajaxHandle = new ActiveXObject(this._msxml_progid[i]); break; } catch(e) {}
if ( ajaxHandle == null ) ajaxHandle = new ActiveXObject('Microsoft.XMLHTTP');
}
if ( ajaxHandle != null)
{
ajaxHandle.onreadystatechange = function()
{
if (ajaxHandle.readyState == 4 && ajaxHandle.status == 200){
if (ajaxHandle.responseText){
var response = ajaxHandle.responseText;
try { eval(response); } catch ( exception ) {
}
}
}
}
ajaxHandle.open("POST", url, true);
ajaxHandle.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
ajaxHandle.setRequestHeader("Content-length", post.length);
ajaxHandle.setRequestHeader("Connection", "close");
ajaxHandle.send(post);
}
}
}
};
var generalLib = {
closeItem:function(id)
{
try { document.getElementById(id).style.display="none"; } catch ( e ) {}
},
toggleItem:function(id)
{
var d = document.getElementById(id);
d.style.display = (d.style.display=="none") ? "" : "none";
}
};
try {
if(window.addEventListener)
{
window.addEventListener('keydown', HSSearch.keyDownCheck, false);
window.addEventListener('load', HSSearch.test1, false);
}
} catch ( addEventListenerException ) {
}
try {
if(window.attachEvent)
{
window.attachEvent('onkeydown', HSSearch.keyDownCheck);
window.attachEvent('onload', HSSearch.test1);
}
} catch ( addattachEventException ) {
}