function MarkerClusterer(b,k,a){var r=[];var u=b;var h=null;var n=this;var j=60;var A=[53,56,66,78,90];var f=[];var e=[];var q=null;var l=0;for(l=1;l<=5;++l){f.push({url:"http://gmaps-utility-library.googlecode.com/svn/trunk/markerclusterer/images/m"+l+".png",height:A[l-1],width:A[l-1]})}if(typeof a==="object"&&a!==null){if(typeof a.gridSize==="number"&&a.gridSize>0){j=a.gridSize}if(typeof a.maxZoom==="number"){h=a.maxZoom}if(typeof a.styles==="object"&&a.styles!==null&&a.styles.length!==0){f=a.styles}}function v(){if(e.length===0){return}var i=[];for(l=0;l<e.length;++l){n.addMarker(e[l],true,null,null,true)}e=i}this.getStyles_=function(){return f};this.clearMarkers=function(){for(var B=0;B<r.length;++B){if(typeof r[B]!=="undefined"&&r[B]!==null){r[B].clearMarkers()}}r=[];e=[];GEvent.removeListener(q)};function x(i){return u.getBounds().containsLatLng(i.getLatLng())}function w(E){var B=E.length;var D=[];for(var C=B-1;C>=0;--C){n.addMarker(E[C].marker,true,E[C].isAdded,D,true)}v()}this.addMarker=function(G,D,L,E,M){if(M!==true){if(!x(G)){e.push(G);return}}var H=L;var J=E;var I=u.fromLatLngToDivPixel(G.getLatLng());if(typeof H!=="boolean"){H=false}if(typeof J!=="object"||J===null){J=r}var C=J.length;var K=null;for(var F=C-1;F>=0;F--){K=J[F];var B=K.getCenter();if(B===null){continue}B=u.fromLatLngToDivPixel(B);if(I.x>=B.x-j&&I.x<=B.x+j&&I.y>=B.y-j&&I.y<=B.y+j){K.addMarker({isAdded:H,marker:G});if(!D){K.redraw_()}return}}K=new Cluster(this,b);K.addMarker({isAdded:H,marker:G});if(!D){K.redraw_()}J.push(K);if(J!==r){r.push(K)}};this.removeMarker=function(B){for(var C=0;C<r.length;++C){if(r[C].remove(B)){r[C].redraw_();return}}};this.redraw_=function(){var C=this.getClustersInViewport_();for(var B=0;B<C.length;++B){C[B].redraw_(true)}};this.getClustersInViewport_=function(){var D=[];var C=u.getBounds();for(var B=0;B<r.length;B++){if(r[B].isInBounds(C)){D.push(r[B])}}return D};this.getMaxZoom_=function(){return h};this.getMap_=function(){return u};this.getGridSize_=function(){return j};this.getTotalMarkers=function(){var B=0;for(var C=0;C<r.length;++C){B+=r[C].getTotalMarkers()}return B};this.getTotalClusters=function(){return r.length};this.resetViewport=function(){var H=this.getClustersInViewport_();var G=[];var F=0;for(var C=0;C<H.length;++C){var I=H[C];var J=I.getCurrentZoom();if(J===null){continue}var K=u.getZoom();if(K!==J){var D=I.getMarkers();for(var B=0;B<D.length;++B){var E={isAdded:false,marker:D[B].marker};G.push(E)}I.clearMarkers();F++;for(B=0;B<r.length;++B){if(I===r[B]){r.splice(B,1)}}}}w(G);this.redraw_()};this.addMarkers=function(C){for(var B=0;B<C.length;++B){this.addMarker(C[B],true)}this.redraw_()};if(typeof k==="object"&&k!==null){this.addMarkers(k)}q=GEvent.addListener(u,"moveend",function(){n.resetViewport()})}function Cluster(e){var b=null;var j=[];var h=e;var i=e.getMap_();var f=null;var a=i.getZoom();this.getMarkers=function(){return j};this.isInBounds=function(r){if(b===null){return false}if(!r){r=i.getBounds()}var k=i.fromLatLngToDivPixel(r.getSouthWest());var v=i.fromLatLngToDivPixel(r.getNorthEast());var u=i.fromLatLngToDivPixel(b);var n=true;var l=e.getGridSize_();if(a!==i.getZoom()){var q=i.getZoom()-a;l=Math.pow(2,q)*l}if(v.x!==k.x&&(u.x+l<k.x||u.x-l>v.x)){n=false}if(n&&(u.y+l<v.y||u.y-l>k.y)){n=false}return n};this.getCenter=function(){return b};this.addMarker=function(k){if(b===null){b=k.marker.getLatLng()}j.push(k)};this.removeMarker=function(k){for(var l=0;l<j.length;++l){if(k===j[l].marker){if(j[l].isAdded){i.removeOverlay(j[l].marker)}j.splice(l,1);return true}}return false};this.getCurrentZoom=function(){return a};this.redraw_=function(n){if(!n&&!this.isInBounds()){return}a=i.getZoom();var k=0;var l=e.getMaxZoom_();if(l===null){l=i.getCurrentMapType().getMaximumResolution()}if(a>=l||this.getTotalMarkers()===1){for(k=0;k<j.length;++k){if(j[k].isAdded){if(j[k].marker.isHidden()){j[k].marker.show()}}else{i.addOverlay(j[k].marker);j[k].isAdded=true}}if(f!==null){f.hide()}}else{for(k=0;k<j.length;++k){if(j[k].isAdded&&(!j[k].marker.isHidden())){j[k].marker.hide()}}if(f===null){f=new ClusterMarker_(b,this.getTotalMarkers(),h.getStyles_(),h.getGridSize_());i.addOverlay(f)}else{if(f.isHidden()){f.show()}f.redraw(true)}}};this.clearMarkers=function(){if(f!==null){i.removeOverlay(f)}for(var k=0;k<j.length;++k){if(j[k].isAdded){i.removeOverlay(j[k].marker)}}j=[]};this.getTotalMarkers=function(){return j.length}}function ClusterMarker_(i,f,e,h){var a=0;var b=f;while(b!==0){b=parseInt(b/10,10);a++}if(e.length<a){a=e.length}this.url_=e[a-1].url;this.height_=e[a-1].height;this.width_=e[a-1].width;this.textColor_=e[a-1].opt_textColor;this.anchor_=e[a-1].opt_anchor;this.latlng_=i;this.index_=a;this.styles_=e;this.text_=f;this.padding_=h}ClusterMarker_.prototype=new GOverlay();ClusterMarker_.prototype.initialize=function(f){this.map_=f;var j=document.createElement("div");var i=this.latlng_;var h=f.fromLatLngToDivPixel(i);h.x-=parseInt(this.width_/2,10);h.y-=parseInt(this.height_/2,10);var e="";if(document.all){e='filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="'+this.url_+'");'}else{e="background:url("+this.url_+");"}if(typeof this.anchor_==="object"){if(typeof this.anchor_[0]==="number"&&this.anchor_[0]>0&&this.anchor_[0]<this.height_){e+="height:"+(this.height_-this.anchor_[0])+"px;padding-top:"+this.anchor_[0]+"px;"}else{e+="height:"+this.height_+"px;line-height:"+this.height_+"px;"}if(typeof this.anchor_[1]==="number"&&this.anchor_[1]>0&&this.anchor_[1]<this.width_){e+="width:"+(this.width_-this.anchor_[1])+"px;padding-left:"+this.anchor_[1]+"px;"}else{e+="width:"+this.width_+"px;text-align:center;"}}else{e+="height:"+this.height_+"px;line-height:"+this.height_+"px;";e+="width:"+this.width_+"px;text-align:center;"}var a=this.textColor_?this.textColor_:"black";j.style.cssText=e+"cursor:pointer;top:"+h.y+"px;left:"+h.x+"px;color:"+a+";position:absolute;font-size:11px;font-family:Arial,sans-serif;font-weight:bold";j.innerHTML=this.text_;f.getPane(G_MAP_MAP_PANE).appendChild(j);var b=this.padding_;GEvent.addDomListener(j,"click",function(){var q=f.fromLatLngToDivPixel(i);var k=new GPoint(q.x-b,q.y+b);k=f.fromDivPixelToLatLng(k);var n=new GPoint(q.x+b,q.y-b);n=f.fromDivPixelToLatLng(n);var l=f.getBoundsZoomLevel(new GLatLngBounds(k,n),f.getSize());f.setCenter(i,l)});this.div_=j};ClusterMarker_.prototype.remove=function(){this.div_.parentNode.removeChild(this.div_)};ClusterMarker_.prototype.copy=function(){return new ClusterMarker_(this.latlng_,this.index_,this.text_,this.styles_,this.padding_)};ClusterMarker_.prototype.redraw=function(a){if(!a){return}var b=this.map_.fromLatLngToDivPixel(this.latlng_);b.x-=parseInt(this.width_/2,10);b.y-=parseInt(this.height_/2,10);this.div_.style.top=b.y+"px";this.div_.style.left=b.x+"px"};ClusterMarker_.prototype.hide=function(){this.div_.style.display="none"};ClusterMarker_.prototype.show=function(){this.div_.style.display=""};ClusterMarker_.prototype.isHidden=function(){return this.div_.style.display==="none"};bp=new GIcon();bp.iconSize=new GSize(47,63);bp.iconAnchor=new GPoint(24,63);bp.infoWindowAnchor=new GPoint(24,2);bp.shadow="/images/markers/shadow.png";bp.shadowSize=new GSize(79,63);var p=[];p.c=[];p.e=[];p.s=[];p.c[1]=new GIcon(bp);p.c[1].image="/images/markers/c-1.png";p.c[2]=new GIcon(bp);p.c[2].image="/images/markers/c-2.png";p.c[3]=new GIcon(bp);p.c[3].image="/images/markers/c-3.png";p.e[1]=new GIcon(bp);p.e[1].image="/images/markers/e-1.png";p.e[2]=new GIcon(bp);p.e[2].image="/images/markers/e-2.png";p.s[1]=new GIcon(bp);p.s[1].image="/images/markers/s.png";var m,t,g,o,s;$(window).unload(GUnload);$(function(){var a=$("#form_search");a.val(a.attr("title")).addClass("tmp").focus(function(){var b=$(this);if(b.attr("title")===b.val()){b.val("").removeClass("tmp")}}).blur(function(){var b=$(this);if(!b.val()){b.addClass("tmp").val(b.attr("title"))}}).keyup(function(){searchMap(this)})});function countyMap(a){var b=a.value;if(b){showArea([new GLatLng(c[b][0],c[b][1]),new GLatLng(c[b][2],c[b][3])])}}function showArea(f){var e=new GLatLngBounds();var b=f.length;for(var a=0;a<b;a++){e.extend(f[a])}showAreaBounds(e)}function showAreaBounds(a){m.setCenter(a.getCenter());m.setZoom(m.getBoundsZoomLevel(a))}function searchMap(a){a=$(a);if(a.val()!=s&a.val().length>1){s=a.val();a.removeClass("error").addClass("loading");clearTimeout(t);t=setTimeout(function(){g.getLocations(a.val()+", UK",function(f){if(f.Status.code==200){var e=f.Placemark[0].ExtendedData.LatLonBox;if(o){m.removeOverlay(o)}var h=new GLatLng(e.north,e.east);var b=new GLatLng(e.south,e.west);o=new GPolygon([h,new GLatLng(e.north,e.west),b,new GLatLng(e.south,e.east),h],"#0000FF",2,0.8,"#0000FF",0.1);m.addOverlay(o);setTimeout(function(){m.removeOverlay(o)},4000);showArea([h,b])}else{a.addClass("error")}});a.removeClass("loading")},1000)}}var z=[],y=[],mc,mco,iwo;$(window).load(function(){if(GBrowserIsCompatible()){m=new GMap2($("#map").get(0));g=new GClientGeocoder();m.setUIToDefault();m.addControl(new GOverviewMapControl());m.addControl(new FullScreenToggle());mco={maxZoom:14,styles:[{height:35,width:84,opt_anchor:[2],url:"/images/markers/cluster.png"}]};iwo={maxWidth:300};$("#mapSelect input").click(markers);if(d){showArea([GLatLng.fromUrlValue(d.sw),GLatLng.fromUrlValue(d.ne)]);switch(d.t){case"h":m.setMapType(G_HYBRID_MAP);break;case"k":m.setMapType(G_SATELLITE_MAP);break;case"p":m.setMapType(G_PHYSICAL_MAP);break;default:m.setMapType(G_NORMAL_MAP);break}markers()}else{markers(true)}var b=new Image();b.src="/images/markers/loading.png";var a=new Image();a.src="/images/formLoading.gif"}});function markers(a){if(mc){mc.clearMarkers()}$.get("/xml/markers.php?"+$("#mapSelect").serialize(),function(i){var j=[],e;if(a===true){var f=[],b,h;$(i).find("m").each(function(){h=$(this);b=new GLatLng(h.attr("x"),h.attr("y"));e=createMarker(b,h.attr("i"),h.attr("t"),h.attr("c"));f.push(b);j.push(e)});showArea(f)}else{$(i).find("m").each(function(){h=$(this);e=createMarker(new GLatLng(h.attr("x"),h.attr("y")),h.attr("i"),h.attr("t"),h.attr("c"));j.push(e)})}mc=new MarkerClusterer(m,j,mco)},"xml")}function createMarker(b,i,h,a){var f=p[h];f=f[a];var e=new GMarker(b,{icon:f});GEvent.addListener(e,"click",function(){if(z[i]){this.openInfoWindowHtml(z[i],iwo);return}this.setImage("/images/markers/loading.png");switch(h){case"c":var k="/caterer/json.php?id="+i,j="/caterer/"+i;break;case"e":var k="/event/json.php?id="+i,j="/event/"+i;break}$.getJSON(k,function(r){var q='<h1 style="font-size:20px;margin-bottom:10px"><a href="'+j+'">'+r.n+"</a></h1>";if(r.l){q+='<p style="margin-bottom:10px;font-size:11px">'+r.l+"</p>"}if(r.o){q+='<p style="margin-bottom:10px;font-size:11px">'+r.o+"</p>"}if(r.p){q+='<ul class="mapWindowPhotos">';var l=r.p.length;for(var n=0;n<l;n++){q+='<li style="height:48px;padding:3px 4px 5px 4px"><img src="/images/photos/'+r.p[n].i+'_68x48.jpg" width="'+r.p[n].w+'" height="'+r.p[n].h+'" alt="'+r.n+'" /></li>'}q+='</ul><div class="clear"></div>'}q+='<p style="margin-top:10px"><a href="#" onclick="return closeup('+b.lat()+","+b.lng()+')"><img src="/images/mapWindow/zoom.png" alt="Zoom In" /></a> <a href="'+j+'"><img src="/images/mapWindow/details.png" alt="View Full Details" /></a></p>';z[i]=q;e.openInfoWindowHtml(q,iwo);e.setImage(f.image);pageTracker._trackEvent("Map","Window",r.n+" ("+i+")")})});return e}function countyAdvert(a){if(a.value){$("#banner").empty();var b=a.value;if(y[b]){displayCountyAdvert(y[b]);return}$.getJSON("/bannerAdvert/json.php?id="+b,function(e){y[b]=e;displayCountyAdvert(e)})}}function displayCountyAdvert(f){if(!f.e){$("#banner").empty();var e=$("<img/>").attr({src:"/images/bannerAdverts/"+f.i+".jpg",alt:f.n,title:f.n});if(f.u){var b=$("<a/>").attr("href",f.u);e.appendTo(b);b.appendTo("#banner")}else{e.appendTo("#banner")}}}function closeup(b,a){m.setCenter(new GLatLng(b,a),18,G_HYBRID_MAP);return false}function FullScreenToggle(){}FullScreenToggle.prototype=new GControl();FullScreenToggle.prototype.initialize=function(f){var i=document.createElement("div");i.setAttribute("id","fullScreenControl");var b=document.createElement("a"),h="Exit",e="/";if(!document.location.href.match(/fullscreen/)){h="View";e+="fullscreen";b.setAttribute("class","home")}b.setAttribute("href",e);b.appendChild(document.createTextNode(h+" Full Screen"));$(b).click(function(){var a=f.getBounds();top.location.href=$(this).attr("href")+"?sw="+a.getSouthWest().toUrlValue()+"&ne="+a.getNorthEast().toUrlValue()+"&t="+f.getCurrentMapType().getUrlArg();return false});i.appendChild(b);f.getContainer().appendChild(i);return i};FullScreenToggle.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(7,31))};var c=[];c[1]=[52.322973,-0.143951,51.805093,-0.702178];c[2]=[51.559323,-0.527971,51.342466,-1.550909];c[3]=[51.54442,-2.510429,51.397279,-2.72358];c[4]=[52.081531,-0.475828,51.485469,-1.140696];c[5]=[52.740003,0.514462,52.005789,-0.500009];c[6]=[53.387388,-1.974789,52.947166,-3.128282];c[7]=[51.522161,-0.0733813,51.5068,-0.112442];c[8]=[50.931266,-4.1638348,49.9536734,-5.747552];c[9]=[55.18898,-2.159018,54.039638,-3.640623];c[10]=[53.5405569,-1.166486,52.696534,-2.03409];c[11]=[51.246985,-2.88666,50.201448,-4.6809542];c[12]=[51.080993,-1.681669,50.512847,-2.961666];c[13]=[54.806044,-1.531403,54.735907,-1.605842];c[14]=[54.176613,0.149835,53.570614,-1.103565];c[15]=[51.147454,0.867868,50.7333287,-0.13586];c[16]=[52.092638,1.296605,51.5007211,-0.023651];c[17]=[52.112587,-1.615201,51.577588,-2.687546];c[18]=[51.691672,0.334433,51.286606,-0.5093057];c[19]=[53.544603,-2.147026,53.340121,-2.319934];c[20]=[51.383949,-0.729341,50.705526,-1.957284];c[21]=[52.395495,-2.337972,51.825945,-3.141926];c[22]=[52.080547,0.195574,51.599522,-0.745786];c[23]=[50.7678382,-1.062719,50.5743399,-1.5924607];c[24]=[51.482172,1.4520156,50.910472,0.033526];c[25]=[54.239565,-2.045072,53.48278,-3.084551];c[26]=[52.977618,-0.664106,52.392167,-1.597547];c[27]=[53.616383,0.357961,52.640236,-0.820647];c[28]=[53.557282,-2.600796,53.316661,-3.175913];c[29]=[52.992729,1.744525,52.355354,0.153561];c[30]=[54.562149,-0.211278,53.62111,-2.564736];c[31]=[52.643797,-0.341602,51.977274,-1.332346];c[32]=[55.8116485,-1.459312,54.782373,-2.689783];c[33]=[53.502496,-0.6662,52.78941,-1.34459];c[34]=[52.16848,-0.870066,51.459413,-1.719504];c[35]=[52.759841,-0.428371,52.524803,-0.821758];c[36]=[52.998413,-2.2329,52.306272,-3.235575];c[37]=[51.332998,-2.24441,50.820646,-3.83983];c[38]=[53.645038,-0.950948,53.315484,-1.770437];c[39]=[53.226242,-1.585281,52.423262,-2.470842];c[40]=[52.550244,1.768926,51.9318386,0.339981];c[41]=[51.471669,0.058108,51.072304,-0.848927];c[42]=[54.8630245,-1.4244419,54.8567293,-1.4307371];c[43]=[52.687249,-1.171946,51.955399,-1.962204];c[44]=[52.5118086,-1.9595574,52.5055134,-1.9658526];c[45]=[51.167405,0.044551,50.721824,-0.957597];c[46]=[53.944725,-1.255273,53.547779,-2.141563];c[47]=[51.703278,-1.485729,50.944976,-2.365608];c[48]=[52.4553949,-1.757411,51.966555,-2.663216];c[49]=[51.6480306,-3.955143,51.6417354,-3.962413];c[50]=[53.308143,-3.772768,53.262183,-3.8785];c[51]=[53.357351,-3.077545,52.861973,-3.601971];c[52]=[53.361909,-2.920279,53.072144,-3.400604];c[53]=[53.072619,-2.945803,53.031355,-3.014328];c[54]=[51.6287683,-3.95861,51.6224731,-3.973044];c[55]=[52.142404,-3.647142,51.644958,-4.782402];c[56]=[52.562447,-3.658182,52.026951,-4.713528];c[57]=[52.120968,-4.485545,51.589551,-5.364147];c[58]=[51.6328131,-3.961183,51.6265179,-3.969044];c[59]=[51.825486,-3.106045,51.681285,-3.310101];c[60]=[51.593803,-3.192663,51.549683,-3.2451954];c[61]=[51.796264,-2.95888,51.606672,-3.143872];c[62]=[51.98314,-2.649808,51.517207,-3.157358];c[63]=[51.621386,-2.970463,51.549936,-3.07195];c[64]=[53.277509,-3.436785,52.534626,-4.808092];c[65]=[53.436587,-4.019651,53.126003,-4.703088];c[66]=[51.5120576,-3.5399524,51.5057624,-3.5462476];c[67]=[51.524506,-3.5676056,51.49527,-3.6025143];c[68]=[51.777668,-3.33849,51.733092,-3.4242091];c[69]=[51.830127,-3.236189,51.499038,-3.593706];c[70]=[52.901584,-2.949629,51.752749,-3.929369];c[71]=[51.4087705,-3.203007,51.4024753,-3.224592];c[72]=[51.5465853,-3.082587,51.447362,-3.278624];c[73]=[51.5031476,-3.3301857,51.4968524,-3.3364809];c[74]=[51.435113,-3.549002,51.4276292,-3.5552973];c[75]=[51.810342,-3.561889,51.527164,-3.936329];c[76]=[51.68983,-3.8621388,51.598834,-4.029331];c[77]=[54.8119708,-5.986707,54.5681731,-6.4961136];c[78]=[54.4687472,-6.3545614,54.1791663,-6.8780633];c[79]=[54.4957997,-5.5155166,54.1670706,-6.0756166];c[80]=[54.6103023,-7.1417179,54.1135701,-8.176558];c[81]=[55.19828,-6.482359,54.688743,-7.364842];c[82]=[54.920444,-6.510912,54.35038,-7.75];