var localSearch=new GlocalSearch();var map;var icon=new GIcon();icon.image="/images/bed_icon.png";icon.iconSize=new GSize(44,42);icon.shadow=null;icon.iconAnchor=new GPoint(22,21);icon.infoWindowAnchor=new GPoint(22,1);var homeIcon=new GIcon();homeIcon.image="/images/venue_icon.png";homeIcon.iconSize=new GSize(44,42);homeIcon.shadow=null;homeIcon.iconAnchor=new GPoint(22,21);homeIcon.infoWindowAnchor=new GPoint(22,1);var points=new Array();var directions;var loadedHotels=0;String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"");};function Rating(b,a,c){this.title=b;this.count=a;this.image=c;}function RateCard(a,c,d,b){this.name=a;this.description=c;this.postcode=d;this.ref=b;this.getDirections=function(){var f=this;var e=document.getElementById("inputPostCode").value;usePointFromPostcode(e,function(g){f.addDirections.apply(f,new Array(g));});};this.addDirections=function(h){map.getInfoWindow().hide();var g=$("divMapDirections");var e=$("divMapInfo");g.style.display="block";e.style.display="none";directions=new GDirections(map,document.getElementById("divGoogleDirections"));var f="from: 53.43, -3.06 to: "+this.point.toString();var f="from: "+h.lat()+", "+h.lng()+" to: "+this.point.lat()+", "+this.point.lng();directions.load(f,{locale:"en_GB"});obj=this;document.getElementById("divCloseDirections").onclick=function(){obj.resetView.apply(obj);};};this.resetView=function(){var f=$("divMapDirections");var e=$("divMapInfo");f.style.display="none";e.style.display="block";directions.clear();setBoundsToMarkers();};}RateCard.prototype.addPlaceDetails=function(){var b=new Element("div");b.setProperty("class","divPlaceName");var c=document.createElement("p");var a=document.createElement("img");a.src=this.icon.image;GEvent.bindDom(b,"click",this,this.showInfoWindow);b.onmouseover=function(){b.style.backgroundImage="url('../images/map/map_bg_ovr.gif')";};b.onmouseout=function(){b.style.backgroundImage="none";};c.appendChild(a);c.innerHTML+="<span>"+this.name+"</span>";b.appendChild(a);b.innerHTML+=this.name;$("divPlaces").appendChild(b);};RateCard.prototype.addMarkerAtPoint=function(a){this.marker=new GMarker(a,this.icon);this.point=a;map.addOverlay(this.marker);GEvent.bind(this.marker,"click",this,this.showInfoWindow);this.addPlaceDetails();points.push(a);};RateCard.prototype.showInfoWindow=function(){var a="<div style='width: 300px'><b>"+this.name+"</b><br/>";a+=this.description;a+="<hr/>";a+="<b>Enter your postcode</b><br/>";a+="<input id='inputPostCode'/>";a+="<a href='#' id='linkDirections'>Get Directions</a></div>";var b=document.createElement("div");b.innerHTML=a;var c=this;GEvent.bind(this.marker,"infowindowopen",this,function(){document.getElementById("linkDirections").onclick=function(){c.getDirections.apply(c);return false;};});this.marker.openInfoWindow(a,{maxWidth:340});};RateCard.prototype.icon=homeIcon;Hotel.prototype=new RateCard();Hotel.prototype.constructor=Hotel;Hotel.prototype.parent=RateCard.prototype;Hotel.prototype.icon=icon;function Hotel(b,j,h,a,k,d,e,c,f,g,l){this.postcode=c;this.id=b;this.name=j;this.address1=h;this.address2=a;this.town=k;this.county=d;this.country=e;this.proximity=f;this.rate=g;this.marker;this.ratings=l;this.showInfoWindow=function(){var m="<b>"+this.name+"</b>";m+="<p>";m+=this.address1+"<br/>";if(this.address2.trim()!=""){m+=a+"<br/>";}if(this.town.trim()!=""){m+=k+"<br/>";}if(this.county.trim()!=""){m+=d+"<br/>";}if(this.country.trim()!=""){m+=e+"<br/>";}m+=c+"<br/>";m+="<b>Booking Hotline:</b> +44 (0)800 158 44 00<br/>";for(i=0;i<this.ratings.length;i++){m+="<b>"+this.ratings[i].title+":</b>";for(z=0;z<this.ratings[i].count;z++){m+="<img src='../images/"+this.ratings[i].image+"'/>";}m+="<br/>";}m+="<b>Proximity to Venue:</b> "+this.proximity+"<br/>";m+="<b>Discounted Rate:</b> "+this.rate+"<br/>";m+="<a href='https://www.jigsawconferences.co.uk/DotCom/BookingForm.aspx?vid="+this.id+"&rcref="+rateCard.ref+"'><img style='margin: 4px auto;display: block' src='../images/book-btn.gif'/></a>";m+="<hr/>";m+="<b>Enter your postcode</b><br/>";m+="<input id='inputPostCode'/>";m+="<a href='#' id='linkDirections'>Get Directions</a>";var n=document.createElement("div");n.innerHTML=m;var o=this;GEvent.bind(this.marker,"infowindowopen",this,function(){document.getElementById("linkDirections").onclick=function(){o.getDirections.apply(o);return false;};});this.marker.openInfoWindow(m,{maxWidth:340});};}Hotel.prototype.addMarkerAtPoint=function(a){this.parent.addMarkerAtPoint.apply(this,[a]);addNextVenue();};function load(){if(GBrowserIsCompatible()){if($("lbOverlay")==null){this.backgroundDiv=new Element("div",{id:"lbOverlay"}).injectInside(document.body);}else{this.backgroundDiv=$("lbOverlay");}$("lbOverlay").addClass("background");this.backgroundDiv.setStyle("opacity",0);var a=new Fx.Tween(this.backgroundDiv);a.start("opacity",0,0.8);var b=$("divMapHolder");b.style.display="block";b.style.position="fixed";b.setStyle("z-index",2001);b.style.top=(window.getHeight()/2)-(b.getSize().y/2)+"px";b.style.left=(window.getWidth()/2)-(b.getSize().x/2)+"px";if(loadedHotels==1){return;}$("divCloseWindow").onclick=function(){b.style.display="none";$("lbOverlay").setStyle("opacity",0);};GEvent.addDomListener($("linkResetView"),"click",function(){map.getInfoWindow().hide();setBoundsToMarkers();});map=new GMap2(document.getElementById("divMap"));map.addControl(new GSmallMapControl());usePointFromPostcode(rateCard.postcode,function(c){map.setCenter(c,13);rateCard.addMarkerAtPoint(c);addNextVenue();});}}function addNextVenue(){if(hotels.length!=0){var a=hotels.pop();usePointFromPostcode(a.postcode,function(b){a.addMarkerAtPoint(b);});}else{setBoundsToMarkers();loadedHotels=1;}}function setBoundsToMarkers(){var a=new GLatLngBounds();for(i=0;i<points.length;i++){a.extend(points[i]);}var b=a.getCenter();map.setZoom(map.getBoundsZoomLevel(a));map.setCenter(b);$("divLoading").style.display="none";}function usePointFromPostcode(b,a){localSearch.setSearchCompleteCallback(null,function(){if(localSearch.results[0]){var d=localSearch.results[0].lat;var c=localSearch.results[0].lng;var e=new GLatLng(d,c);a(e);}else{alert("Postcode not found!");}});localSearch.execute(b+", UK");}function listPlaces(){}