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)'; } else { //alert("Woot " + document.getElementById("geoh").value + "// " + document.getElementById("geov").value); document.getElementById("loction_search").value = document.getElementById("locid").value; } HSSearch.checkDate(); } catch ( eee ) {} }, 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 = ""; } }, 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 = ""; 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() { 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; //alert("BaseID: " + this.base ); } 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 = ""; } 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 = ""; 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,"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("loction_search").style.backgroundImage=''; document.getElementById("rem_search_fill").style.display = ""; }, keyDownIncrement : 0 , keyDownNode : null, keyLastType : null }; 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); } } } };