var Restaurants = { loaded : false, data : null, plint : null, interval : null, events : { /** * Lets cycle in and get all the restaurants that we need */ getFullRestaurantList : function( searchId ) { location.href="#MAP_ELEMENT"; LTMapSystem(); if ( Restaurants.loaded == false ) { var dim = hotelmap_lite.utility.dimensions(); var plint = hotelmap_lite.utility.element("div", {'zIndex':'99999','position':'absolute','left':'0px','top':"0px",'width':dim[0]+'px','height':dim[1]+'px','backgroundColor':'#000000'}, null ); var ref = hotelmap_lite.utility.element("img", {'position':'absolute','left':((dim[0]/2)-15)+'px','top':((dim[1]/2)-15)+'px'}, {'src':'/LondonRestaurantDeals/res/images/rest_load.gif'} ); plint.appendChild(ref); hotelmap_lite.utility.transparency(plint,60); Restaurants.plint = plint; document.body.appendChild(plint); Restaurants.loaded = true; Restaurants.ajax.remote.get("/LondonRestaurantDeals/availability?jsonRequest=true&resultsPerPage=true&searchId="+searchId); } try { try { clearInterval(Restaurants.interval); } catch ( rex1 ) {} Restaurants.interval = setInterval( function(){ if ( !window.location.href.match("#MAP_ELEMENT")) { LTMapSystem(); clearInterval(Restaurants.interval); } },1000 ); } catch ( exceptionMapTick ) { //empty } }, populate : function( data ) { Restaurants.data = data; var metaLocation = { location : null, poi : [], points : [] }; for ( var i = 0 ; i < data.length ; i++ ) { metaLocation.points.push(data[i]); hotelmap_lite.utility.scrolls.new_article_entry(data[i],hotelmap_lite.utility.scrolls.internal_contents); } if ( metaLocation.points.length > 0 ) { for ( var i = 0 ; i < metaLocation.points.length ; i++ ) { hotelmap_lite.utility.pointers._custom_restaurant_pointer(metaLocation.points[i]); } } /* Now lets assess whether we have the scroll bar or not */ try { var isTargetScrolling = ( parseInt( hotelmap_lite.utility.scrolls.field_container.style.height ) < parseInt( hotelmap_lite.utility.scrolls.field_container.scrollHeight ) ) ? true : false ; if ( !isTargetScrolling ) { var count = 0; var targets = document.getElementsByTagName("div") ; for ( var i = 0 ; i < targets.length ; i++ ) { if ( targets[i].id == 'article_element' ) { count++; targets[i].style.width = '364px'; } } hotelmap_lite.utility.scrolls.cr_major_container.style.height = ( parseInt(count) * 102 ) + 73 + "px"; } else { var targets = document.getElementsByTagName("div") ; for ( var i = 0 ; i < targets.length ; i++ ) { if ( targets[i].id == 'article_element' ) { count++; targets[i].style.width = '368px'; targets[i].contentMode.style.width = '240px'; } } } } catch ( scrollBarExistException ) { // Empty } try { Restaurants.plint.style.display = 'none'; setTimeout(function(){ hotelmap_lite.imin.shut(); hotelmap_lite.imin.masternode.show(); },1000); } catch ( ssdf ) {} } }, 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 ) { console.log("Errpr@ " + exception.message); } } } } ajaxHandle.open("GET", url, true); ajaxHandle.send(null); } } } } };