eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('5 4(b,a){1.q=a;1.o=a.M||"";1.G=a.1i||"1c";1.r=a.X||k P(0,0);1.t=(a.1u==m)?m:n;1.w=a.C||"";1.f=n;1.e=n;6(a.u){a.u=m}8.d(1,9)}4.3=k 8(k O(0,0));4.3.L=5(b){8.3.L.d(1,9);1.K=b;1.2=1x.1t("1q");1.2.1m=1.G;1.2.A=1.o;1.2.7.1f="1e";6(1.t){1.2.7.1d="1b"}1.2.C=1.w;6(!1.e){1.s()}1.h();b.16(15).12(1.2);6(1.t){g a=[\'Y\',\'W\',\'V\',\'U\',\'T\',\'S\'];R(g i=0;i<a.Q;i++){g c=a[i];j.10(1.2,c,j.11(j,j.1z,1,c,1.l()))}}};4.3.J=5(a){8.3.J.d(1,9);1.v()};4.3.v=5(){g p=1.K.1y(1.l());g z=1w.1s(1.l().1r());1.2.7.1p=(p.x+1.r.1l)+"B";1.2.7.1j=(p.y+1.r.1h)+"B";1.2.7.1g=z};4.3.N=5(){j.1k(1.2);6(1.2.H){1.2.H=""}6(1.2.E){1.2.E.1n(1.2)}1.2=1o;8.3.N.d(1,9)};4.3.1a=5(){g a=k 4(1.l(),1.q);a.f=1.f;a.e=1.e;I a};4.3.D=5(){8.3.D.d(1,9);1.e=n;1.h()};4.3.s=5(){8.3.s.d(1,9);1.e=m;1.h()};4.3.19=5(a){1.f=a;1.h()};4.3.18=5(){I 1.f};4.3.h=5(){6(1.2){6((!1.17())&&1.f){1.2.7.F=\'1v\'}14{1.2.7.F=\'13\'}}};4.3.Z=5(a){1.o=a;1.2.A=a;1.q.M=a};',62,98,'|this|div_|prototype|LabeledMarker|function|if|style|GMarker|arguments||||apply|ownVisibility_|labelVisibility_|var|applyLabelVisibility_||GEvent|new|getLatLng|false|true|labelText_||opts_|labelOffset_|hide|clickable_|draggable|redrawLabel_|title_||||innerHTML|px|title|show|parentNode|display|labelClass_|outerHTML|return|redraw|map_|initialize|labelText|remove|GLatLng|GSize|length|for|mouseout|mouseover|mouseup|mousedown|dblclick|labelOffset|click|setLabelText|addDomListener|callback|appendChild|none|else|G_MAP_MARKER_PANE|getPane|isHidden|getLabelVisibility|setLabelVisibility|copy|pointer|LabeledMarker_markerLabel|cursor|absolute|position|zIndex|height|labelClass|top|clearInstanceListeners|width|className|removeChild|null|left|div|lat|getZIndex|createElement|clickable|block|GOverlay|document|fromLatLngToDivPixel|trigger'.split('|'),0,{}));function MarkerClusterer(map,opt_markers,opt_opts){var clusters_=[];var map_=map;var maxZoom_=null;var me_=this;var gridSize_=60;var sizes=[53,56,66,78,90];var styles_=[];var leftMarkers_=[];var mcfn_=null;var calculator_=function(markers){var index=0;var count=markers.length;var dv=count;while(dv!==0){dv=parseInt(dv/10,10);index++;}
var stylesCount=this.getStyles().length;if(stylesCount<index){index=stylesCount;}
return{'text':count,'index':index};};var i=0;for(i=1;i<=5;++i){styles_.push({'url':'http://gmaps-utility-library.googlecode.com/svn/trunk/markerclusterer/images/m'+i+'.png','height':sizes[i-1],'width':sizes[i-1]});}
if(typeof opt_opts==='object'&&opt_opts!==null){if(typeof opt_opts.gridSize==='number'&&opt_opts.gridSize>0){gridSize_=opt_opts.gridSize;}
if(typeof opt_opts.maxZoom==='number'){maxZoom_=opt_opts.maxZoom;}
if(typeof opt_opts.styles==='object'&&opt_opts.styles!==null&&opt_opts.styles.length!==0){styles_=opt_opts.styles;}
if(typeof opt_opts.calculator==='function'){calculator_=opt_opts.calculator;}}
this.setCalculator=function(calculator){calculator_=calculator;};this.getCalculator=function(){return GEvent.callback(this,calculator_);};function addLeftMarkers_(){if(leftMarkers_.length===0){return;}
var leftMarkers=[];for(i=0;i<leftMarkers_.length;++i){if(isMarkerInViewport_(leftMarkers_[i])){me_.addMarker(leftMarkers_[i],true,null,null,true);}else{leftMarkers.push(leftMarkers_[i]);}}
leftMarkers_=leftMarkers;}
this.getStyles=function(){return styles_;};this.clearMarkers=function(){for(var i=0;i<clusters_.length;++i){if(typeof clusters_[i]!=="undefined"&&clusters_[i]!==null){clusters_[i].clearMarkers();}}
clusters_=[];leftMarkers_=[];};function isMarkerInViewport_(marker){return map_.getBounds().containsLatLng(marker.getLatLng());}
function reAddMarkers_(markers){var len=markers.length;var clusters=[];for(var i=len-1;i>=0;--i){me_.addMarker(markers[i].marker,true,markers[i].isAdded,clusters,true);}
addLeftMarkers_();}
this.addMarker=function(marker,opt_isNodraw,opt_isAdded,opt_clusters,opt_isNoCheck){if(opt_isNoCheck!==true){if(!isMarkerInViewport_(marker)){leftMarkers_.push(marker);return;}}
var isAdded=opt_isAdded;var clusters=opt_clusters;var pos=map_.fromLatLngToDivPixel(marker.getLatLng());if(typeof isAdded!=="boolean"){isAdded=false;}
if(typeof clusters!=="object"||clusters===null){clusters=clusters_;}
var length=clusters.length;var cluster=null;for(var i=length-1;i>=0;i--){cluster=clusters[i];var center=cluster.getCenter();if(center===null){continue;}
center=map_.fromLatLngToDivPixel(center);if(pos.x>=center.x-gridSize_&&pos.x<=center.x+gridSize_&&pos.y>=center.y-gridSize_&&pos.y<=center.y+gridSize_){cluster.addMarker({'isAdded':isAdded,'marker':marker});if(!opt_isNodraw){cluster.redraw_();}
return;}}
cluster=new Cluster(this,map);cluster.addMarker({'isAdded':isAdded,'marker':marker});if(!opt_isNodraw){cluster.redraw_();}
clusters.push(cluster);if(clusters!==clusters_){clusters_.push(cluster);}};this.removeMarker=function(marker){for(var i=0;i<clusters_.length;++i){if(clusters_[i].removeMarker(marker)){clusters_[i].redraw_();$("div.LabeledMarker_markerLabel p").hide();$("div.LabeledMarker_markerLabel p."+speed).show();return;}}};this.redraw_=function(){var clusters=this.getClustersInViewport_();for(var i=0;i<clusters.length;++i){clusters[i].redraw_(true);}
$("div.LabeledMarker_markerLabel p").hide();$("div.LabeledMarker_markerLabel p."+speed).show();};this.getClustersInViewport_=function(){var clusters=[];var curBounds=map_.getBounds();for(var i=0;i<clusters_.length;i++){if(clusters_[i].isInBounds(curBounds)){clusters.push(clusters_[i]);}}
return clusters;};this.getMaxZoom_=function(){return maxZoom_;};this.getMap_=function(){return map_;};this.getGridSize_=function(){return gridSize_;};this.getTotalMarkers=function(){var result=0;for(var i=0;i<clusters_.length;++i){result+=clusters_[i].getTotalMarkers();}
return result;};this.getTotalClusters=function(){return clusters_.length;};this.resetViewport=function(){var clusters=this.getClustersInViewport_();var tmpMarkers=[];var removed=0;for(var i=0;i<clusters.length;++i){var cluster=clusters[i];var oldZoom=cluster.getCurrentZoom();if(oldZoom===null){continue;}
var curZoom=map_.getZoom();if(curZoom!==oldZoom){var mks=cluster.getMarkers();for(var j=0;j<mks.length;++j){var newMarker={'isAdded':false,'marker':mks[j].marker};tmpMarkers.push(newMarker);}
cluster.clearMarkers();removed++;for(j=0;j<clusters_.length;++j){if(cluster===clusters_[j]){clusters_.splice(j,1);}}}}
reAddMarkers_(tmpMarkers);this.redraw_();};this.addMarkers=function(markers){for(var i=0;i<markers.length;++i){this.addMarker(markers[i],true);}
this.redraw_();};if(typeof opt_markers==="object"&&opt_markers!==null){this.addMarkers(opt_markers);}
mcfn_=GEvent.addListener(map_,"moveend",function(){me_.resetViewport();});}
function Cluster(markerClusterer){var center_=null;var markers_=[];var markerClusterer_=markerClusterer;var map_=markerClusterer.getMap_();var clusterMarker_=null;var zoom_=map_.getZoom();this.getMarkers=function(){return markers_;};this.isInBounds=function(bounds){if(center_===null){return false;}
if(!bounds){bounds=map_.getBounds();}
var sw=map_.fromLatLngToDivPixel(bounds.getSouthWest());var ne=map_.fromLatLngToDivPixel(bounds.getNorthEast());var centerxy=map_.fromLatLngToDivPixel(center_);var inViewport=true;var gridSize=markerClusterer.getGridSize_();if(zoom_!==map_.getZoom()){var dl=map_.getZoom()-zoom_;gridSize=Math.pow(2,dl)*gridSize;}
if(ne.x!==sw.x&&(centerxy.x+gridSize<sw.x||centerxy.x-gridSize>ne.x)){inViewport=false;}
if(inViewport&&(centerxy.y+gridSize<ne.y||centerxy.y-gridSize>sw.y)){inViewport=false;}
return inViewport;};this.getCenter=function(){return center_;};this.addMarker=function(marker){if(center_===null){center_=marker.marker.getLatLng();}
markers_.push(marker);};this.removeMarker=function(marker){for(var i=0;i<markers_.length;++i){if(marker===markers_[i].marker){if(markers_[i].isAdded){map_.removeOverlay(markers_[i].marker);}
markers_.splice(i,1);return true;}}
return false;};this.getCurrentZoom=function(){return zoom_;};this.redraw_=function(isForce){if(!isForce&&!this.isInBounds()){return;}
zoom_=map_.getZoom();var i=0;var mz=markerClusterer.getMaxZoom_();if(mz===null){mz=map_.getCurrentMapType().getMaximumResolution();}
if(zoom_>mz||this.getTotalMarkers()===1){for(i=0;i<markers_.length;++i){if(markers_[i].isAdded){if(markers_[i].marker.isHidden()){markers_[i].marker.show();}}else{map_.addOverlay(markers_[i].marker);markers_[i].isAdded=true;}}
if(clusterMarker_!==null){clusterMarker_.hide();}}else if(this.getTotalMarkers()>1){for(i=0;i<markers_.length;++i){if(markers_[i].isAdded&&(!markers_[i].marker.isHidden())){markers_[i].marker.hide();}}
var sums=markerClusterer_.getCalculator()(this.getRealMarkers());if(clusterMarker_===null){clusterMarker_=new ClusterMarker_(center_,sums,markerClusterer_.getStyles(),markerClusterer_.getGridSize_());map_.addOverlay(clusterMarker_);}else{if(clusterMarker_.isHidden()){clusterMarker_.show();}
clusterMarker_.setSums(sums);clusterMarker_.redraw(true);}}};this.clearMarkers=function(){if(clusterMarker_!==null){map_.removeOverlay(clusterMarker_);}
for(var i=0;i<markers_.length;++i){if(markers_[i].isAdded){map_.removeOverlay(markers_[i].marker);}}
markers_=[];};this.getTotalMarkers=function(){return markers_.length;};this.getRealMarkers=function(){var result=[];for(var i=0;i<markers_.length;++i){result.push(markers_[i].marker);}
return result;};}
function ClusterMarker_(latlng,sums,styles,padding){var index=sums.index;this.useStyle(styles[index-1]);this.styleDirty_=false;this.latlng_=latlng;this.index_=index;this.styles_=styles;this.text_=sums.text+" Tests";this.padding_=padding;this.sums_=sums;}
ClusterMarker_.prototype=new GOverlay();ClusterMarker_.prototype.useStyle=function(style){this.url_=style.url;this.height_=style.height;this.width_=style.width;this.textColor_=style.opt_textColor;this.anchor_=style.opt_anchor;};ClusterMarker_.prototype.initialize=function(map){this.map_=map;var div=document.createElement("div");var latlng=this.latlng_;var pos=this.getPosFromLatLng(latlng);div.style.cssText=this.createCss(pos);div.innerHTML=this.text_;map.getPane(G_MAP_MAP_PANE).appendChild(div);var padding=this.padding_;GEvent.addDomListener(div,"click",function(){var pos=map.fromLatLngToDivPixel(latlng);var sw=new GPoint(pos.x-padding,pos.y+padding);sw=map.fromDivPixelToLatLng(sw);var ne=new GPoint(pos.x+padding,pos.y-padding);ne=map.fromDivPixelToLatLng(ne);var zoom=map.getBoundsZoomLevel(new GLatLngBounds(sw,ne),map.getSize());map.setCenter(latlng,zoom);});this.div_=div;};ClusterMarker_.prototype.getPosFromLatLng=function(latlng){var pos=this.map_.fromLatLngToDivPixel(latlng);pos.x-=parseInt(this.width_/2,10);pos.y-=parseInt(this.height_/2,10);return pos;};ClusterMarker_.prototype.createCss=function(pos){var mstyle="";if(document.all){mstyle='filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="'+this.url_+'");';}else{mstyle="background:url("+this.url_+");";}
if(typeof this.anchor_==="object"){if(typeof this.anchor_[0]==="number"&&this.anchor_[0]>0&&this.anchor_[0]<this.height_){mstyle+='height:'+(this.height_-this.anchor_[0])+'px;padding-top:'+this.anchor_[0]+'px;';}else{mstyle+='height:'+this.height_+'px;line-height:'+this.height_+'px;';}
if(typeof this.anchor_[1]==="number"&&this.anchor_[1]>0&&this.anchor_[1]<this.width_){mstyle+='width:'+(this.width_-this.anchor_[1])+'px;padding-left:'+this.anchor_[1]+'px;';}else{mstyle+='width:'+this.width_+'px;text-align:center;';}}else{mstyle+='height:'+this.height_+'px;line-height:'+this.height_+'px;';mstyle+='width:'+this.width_+'px;text-align:center;';}
var txtColor=this.textColor_?this.textColor_:'black';return mstyle+'cursor:pointer;top:'+pos.y+"px;left:"+
pos.x+"px;color:"+txtColor+";position:absolute;font-size:11px;"+'font-family:Arial,sans-serif;font-weight:bold';};ClusterMarker_.prototype.remove=function(){this.div_.parentNode.removeChild(this.div_);};ClusterMarker_.prototype.copy=function(){return new ClusterMarker_(this.latlng_,this.sums_,this.text_,this.styles_,this.padding_);};ClusterMarker_.prototype.redraw=function(force){if(!force){return;}
var pos=this.getPosFromLatLng(this.latlng_);if(this.styleDirty_){this.styleDirty_=false;this.useStyle(this.styles_[this.index_-1]);this.div_.style.cssText=this.createCss(pos);}else{this.div_.style.top=pos.y+"px";this.div_.style.left=pos.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";};ClusterMarker_.prototype.setSums=function(sums){if(sums.index!==this.index_){this.styleDirty_=true;}
this.sums_=sums;this.text_=sums.text+" Tests";this.index_=sums.index;this.div_.innerHTML=sums.text+" Tests";};;var speed='download_speed'
var type='home';var url=false;var range=0.1;var limit=1;var lat_long=false;var old_url=false;var markers=[];var exchange_markers=[]
var u_marker=false;var loaded=false;var user_location=false;var user_latlng=false;var postcode_location=false;var map=false;var localSearch=false;var icon=false;var exchange_icon=false;var marker_cluster=false;var exchange_marker_cluster=false;var user_plotted=false;var existing_markers={};var existing_exchange_markers={};var z_index_count=1;var bubble_marker=false;var old_time=false;var zoomLevel=16;var filters_enabled=true;var exchange_to_click=false;var url_type='home';var url_place=false;var url_speed='download';var initial_hash=window.location.hash;var url_speed_value='0';var url_exchange='all';var url_provider='all';var url_time='3';var url_verified='1';try{user_data=user_data;}catch(e){user_data=false;}
function initMaps(){map=new GMap2(document.getElementById("map_canvas"),{size:new GSize(857,550)});if(user_data.connection_type==2){type='mobile';url_type='mobile';}else{$('#map_location input.hint').val('').attr('title','Street or Postcode').hint();}
localSearch=new GlocalSearch();geocoder=new GClientGeocoder();geocoder.setBaseCountryCode('UK');customise_map(map);icon=new GIcon();icon.image="/_img/broadband/speedtest_new/map_marker.png";icon.iconSize=new GSize(81,88);icon.shadowSize=new GSize(0,0);icon.iconAnchor=new GPoint(45,75);icon.infoWindowAnchor=new GPoint(25,7);exchange_icon=new GIcon();exchange_icon.image="/_img/broadband/speedtest_new/map_marker_exchange.png";exchange_icon.iconSize=new GSize(58,65);exchange_icon.shadowSize=new GSize(0,0);exchange_icon.iconAnchor=new GPoint(26,75);var styles=[[{url:'/_img/broadband/speedtest_new/map_cluster_small.png',height:22,width:70,opt_textColor:'#FFF'},{url:'/_img/broadband/speedtest_new/map_cluster_medium.png',height:22,width:80,opt_textColor:'#FFF'},{url:'/_img/broadband/speedtest_new/map_cluster_large.png',height:22,width:92,opt_textColor:'#FFF'}]];marker_cluster=new MarkerClusterer(map,markers,{gridSize:100,maxZoom:15,styles:styles[0]});if(user_data){if(user_data.postcode.match(/[A-Za-z]{1,2}\d[A-Za-z\d]? ?\d[A-Za-z]{2}/)){get_postcode_location(user_data.postcode,update_users_location);}else{update_users_location();}}
location_check=setInterval("update_map_location()",500);load_filters();update_provider_filter(user_data.connection_type);}
function update_map_location(){if(user_latlng){clearInterval(location_check);map.setCenter(user_latlng,15);}}
function load_map(map,url){if(old_url!=url){$('#map_container #loading_data').remove();$('#map_container').append('<span id="loading_data"><img src="/_img/broadband/speedtest_new/spinner.gif" width="15" height="15" /> Loading data...</span>');$.getJSON(url+'&jsoncallback=?',function(data){$('#map_container #loading_data').remove();plot_maps(map,data);update_filters(data);});}
old_url=url;}
if(window.location.href.indexOf("streetstats")>1){var retest=false;}
function load_standalone_maps(){$('#fancy_overlay').addOverlay();$('#welcome_box').fadeInSlide();initMaps();if(google.loader.ClientLocation)
{url_place=google.loader.ClientLocation.address.city;lat_long=new GLatLng(google.loader.ClientLocation.latitude,google.loader.ClientLocation.longitude);}else{url_place='London';lat_long=new GLatLng('51.5002','-0.1262');}
loaded=true;if(initial_hash){load_map(map,false);get_url();}else{load_map(map,url);map.setCenter(lat_long,6);$('#results_nav li.speedmaps_home a').click();}
if(!$.browser.msie||$.browser.msie&&$.browser.version>6){}
$('#fastest_locations a').click(function(){setTimeout("get_url()",100);});}
$(window).unload(function(){GUnload();});function get_url(){var hash=window.location.hash.replace('#','');var updated_url=hash.split("_");if(hash){updated_url[1]=updated_url[1].replace(/%20/g,' ');url_type=updated_url[0];url_place=updated_url[1];url_speed=updated_url[2];url_speed_value=updated_url[3];url_exchange=updated_url[4];url_provider=updated_url[5];url_time=updated_url[6];url_verified=updated_url[7]
if(url_place=='street or postcode'){url_place='London';}
$('#results_nav li.speedmaps_'+updated_url[0]+' a').click();$('#map_location input:text').val(url_place).addClass('blur').next().click();$('#map_speed input#'+updated_url[2]+'_speeds').click();$('#slider').slider('option','value',url_speed_value);update_slider();setTimeout('update_filter_selects()',500);if(url_verified==1){$('#url_verified').attr('checked','checked');}else{$('#url_verified').removeAttr('checked');}}
return false;}
function update_filter_selects(){$('#url_provider option[value='+url_provider+']').attr('selected','selected');$('#url_time option[value='+url_time+']').attr('selected','selected');update_filter_text();}
function update_url(){update_filter_text();if(window.location.href.indexOf("streetstats")>1){window.location.href=window.location.href.replace(/#.*$/,'')+'#'+url_type+'_'+url_place+'_'+url_speed+'_'+url_speed_value+'_'+url_exchange+'_'+url_provider+'_'+url_time+'_'+url_verified;pageTracker._trackPageview("/speedtest/streetstats/#"+url_type+'_'+url_place+'_'+url_speed+'_'+url_speed_value+'_'+url_exchange+'_'+url_provider+'_'+url_time+'_'+url_verified);}}
function createMarkerClickHandler(marker,speedtest){return function(){if($(marker.div_.lastChild).is('.bubble_info')){return false;}
pixels=map.fromLatLngToContainerPixel(marker.getLatLng());pixels.y=pixels.y-135;lat=map.fromContainerPixelToLatLng(pixels)
map.panTo(lat);$('.temp_hidden').show();$('.bubble_info').remove();$(this.div_).css('z-index',z_index_count+20);if($(this.div_).prev().is('img')){$(this.div_).prev().addClass('temp_hidden').hide();}
if(speedtest.price){if(speedtest.price.indexOf('.')==-1){speedtest.price=speedtest.price+'.00';}}
var html='<a class="close_window" alt="Close" title="Close"></a>';html+='<table cellpadding="0" cellspacing="0" width="281"><thead><tr><th colspan="2">'+STREETSTATS_BUBBLE_HEADER_TEXT+'</th></tr></thead><tbody><th width="40%">Speeds</th><td width="60%">Download: '+Math.round(speedtest.download_speed*10)/10+'Mb <span>Upload: '+Math.round(speedtest.upload_speed*10)/10+'Mb</span></td></tr>';if(speedtest.provider){html+='<tr><th>'+STREETSTATS_BUBBLE_PROVIDER_TEXT+'</th><td>'+speedtest.provider+'</td></tr>';}else{html+='<tr><th>'+STREETSTATS_BUBBLE_PROVIDER_TEXT+'</th><td>Unknown</td></tr>';}
if(speedtest.type==2){var location=speedtest.pc;if(location.length>23){location=location.substring(0,20)+'...';}
html+='<tr><th>'+STREETSTATS_BUBBLE_LOCATION_TEXT+'</th><td>'+location+'</td></tr>';}else{html+='<tr><th>'+STREETSTATS_BUBBLE_POSTCODE_TEXT+'</th><td>'+speedtest.pc+'</td></tr>';}
exchange_to_click=false;jQuery.each(exchange_markers,function(){var exchange_name=this.title_;exchange_name=exchange_name.substring(0,exchange_name.length-19);if(speedtest.exchange==exchange_name){exchange_to_click=this;$('#exchangeLink').live('click',function(){if(zoomLevel>=15){map.setZoom(16)}
$('.bubble_info .close_window').click();GEvent.trigger(exchange_to_click,'click');return false;});}});if(speedtest.exchange.length>18){speedtest.exchange=speedtest.exchange.substring(0,15)+'...';}
html+='<tr><th>'+STREETSTATS_BUBBLE_EXCHANGE_TEXT+'</th><td><a href="#" id="exchangeLink">'+speedtest.exchange+'</a></td></tr><tr><th>'+STREETSTATS_BUBBLE_EXCHANGE_DISTANCE_TEXT+'</th><td>'+speedtest.exchange_distance+' meters away</td></tr>';html+='<tr><th>'+STREETSTATS_BUBBLE_DATE_TEXT+'</th><td>'+speedtest.date+'</td></tr></tbody></table>';if(speedtest.com==1&&speedtest.provider_logo){html+='<span class="price provider_logo">'+$.image({src:speedtest.provider_logo,width:34,height:21,alt:this.provider,mode:$.image.EXPAND})+' '+STREETSTATS_BUBBLE_DEAL_TEXT+''+speedtest.price+'</span>';}else if(speedtest.com==1&&speedtest.provider){html+='<span class="price">'+speedtest.provider+' '+STREETSTATS_BUBBLE_DEAL_TEXT+''+speedtest.price+'</span>';}
if(speedtest.com==1){html+='<a href="/_ajax/speedtest.php?action=products&provider='+speedtest.provider_id+'&menu_id='+menu_id+'" class="provider_table new_button red_big" alt="'+STREETSTATS_BUBBLE_DEAL_BUTTON_TEXT+'" title="'+STREETSTATS_BUBBLE_DEAL_BUTTON_TEXT+'"><span>'+STREETSTATS_BUBBLE_DEAL_BUTTON_TEXT+'</span></a>';}
$('<div class="bubble_info">'+html+'</div>').appendTo(this.div_);$('.provider_table').providerFancybox();++z_index_count;if(bubble_marker.div_){bubble_marker.redraw(true);}
bubble_marker=marker;};}
function createMarkerMouseoverHandler(marker,speedtest){return function(){if($(this.div_).prev().is('img')){var src=$(this.div_).prev().attr('src');$(this.div_).prev().attr('src',src.replace('.png','_hover.png'));}}}
function createMarkerMouseoutHandler(marker,speedtest){return function(){if($(this.div_).prev().is('img')){var src=$(this.div_).prev().attr('src');$(this.div_).prev().attr('src',src.replace('_hover',''));}}}
function createExchangeMarkerClickHandler(marker,exchange){return function(){if($(marker.div_.lastChild).is('.bubble_info')){return false;}
pixels=map.fromLatLngToContainerPixel(marker.getLatLng());pixels.y=pixels.y-135;lat=map.fromContainerPixelToLatLng(pixels)
map.panTo(lat);$('.temp_hidden').show();$('.bubble_info').remove();$(this.div_).css('z-index',z_index_count+20);if($(this.div_).prev().is('img')){$(this.div_).prev().addClass('temp_hidden').hide();}
var html='<a class="close_window" alt="Close" title="Close"></a>';if(exchange.name.length>18){exchange.name=exchange.name.substring(0,15)+'...';}
html+='<table cellpadding="0" cellspacing="0" width="281"><thead><tr><th colspan="2">Exchange Details</th></tr></thead><tbody>';html+='<tr><th width="55%">'+STREETSTATS_EXCHANGE_BUBBLE_NAME_TEXT+'</th><td width="45%">'+exchange.name+'</td></tr>';html+='<tr><th>'+STREETSTATS_EXCHANGE_BUBBLE_POSTCODE_TEXT+'</th><td>'+exchange.pc+'</td></tr>';html+='<tr><th>'+STREETSTATS_EXCHANGE_BUBBLE_TESTS_TEXT+'</th><td>'+exchange.tests+'</td></tr>';html+='<th>'+STREETSTATS_EXCHANGE_BUBBLE_DOWNLOAD_TEXT+'</th><td>'+Math.round(exchange.download*10)/10+'Mb</td></tr>';html+='<tr class="last"><th>'+STREETSTATS_EXCHANGE_BUBBLE_UPLOAD_TEXT+'</th><td>'+Math.round(exchange.upload*10)/10+'Mb</td></tr>';html+='</tbody></table>';$('<div class="bubble_info exchange_bubble">'+html+'</div>').appendTo(this.div_);$('.provider_table').providerFancybox();++z_index_count;if(bubble_marker.div_){bubble_marker.redraw(true);}
bubble_marker=marker;};}
function plot_maps(map,data){var markers=[]
var label_text='';jQuery.each(data.exchange,function(){if(!existing_exchange_markers[this.id]){existing_exchange_markers[this.id]=true;var latlng=new GLatLng(this.latitude,this.longitude);opts={"icon":exchange_icon,"clickable":true,"title":this.name+' Telephone Exchange',"labelOffset":new GSize(0,-68),"labelClass":"exchange"};var exchange_marker=new LabeledMarker(latlng,opts);exchange_markers.push(exchange_marker);map.addOverlay(exchange_marker);var exchange_handler=createExchangeMarkerClickHandler(exchange_marker,this);GEvent.addListener(exchange_marker,"click",exchange_handler);var mouseover_handler=createMarkerMouseoverHandler(exchange_marker,this);GEvent.addListener(exchange_marker,"mouseover",mouseover_handler);var mouseout_handler=createMarkerMouseoutHandler(exchange_marker,this);GEvent.addListener(exchange_marker,"mouseout",mouseout_handler);}});jQuery.each(data.tests,function(){if(!existing_markers[this.id]){existing_markers[this.id]=true;var latlng=new GLatLng(this.latitude,this.longitude);if(!this.provider){label_text='<em class="unknown_provider">?</em>';}else if(!this.provider_logo){label_text='<em class="provider_without_logo">'+this.provider+'</em>';}else{label_text=$.image({src:this.provider_logo,width:50,height:31,alt:this.provider,mode:$.image.EXPAND})}
if(this.download_speed<0.05){var m_download_speed='0.1';}else{var m_download_speed=Math.round(this.download_speed*10)/10;}
if(this.upload_speed<0.05){var m_upload_speed='0.1';}else{var m_upload_speed=Math.round(this.upload_speed*10)/10;}
opts={"icon":icon,"clickable":true,"title":this.provider,"labelText":label_text+'<p class="download_speed">'+m_download_speed+'Mb</p><p class="upload_speed">'+m_upload_speed+'Mb</p><span id="'+this.id+'"></span>',"labelOffset":new GSize(-35,-70)};if(user_data&&user_latlng){if(latlng.distanceFrom(user_latlng)>100){var marker=new LabeledMarker(latlng,opts);markers.push(marker);var handler=createMarkerClickHandler(marker,this);GEvent.addListener(marker,"click",handler);var mouseover_handler=createMarkerMouseoverHandler(marker,this);GEvent.addListener(marker,"mouseover",mouseover_handler);var mouseout_handler=createMarkerMouseoutHandler(marker,this);GEvent.addListener(marker,"mouseout",mouseout_handler);}}else{var marker=new LabeledMarker(latlng,opts);markers.push(marker);var handler=createMarkerClickHandler(marker,this);GEvent.addListener(marker,"click",handler);var mouseover_handler=createMarkerMouseoverHandler(marker,this);GEvent.addListener(marker,"mouseover",mouseover_handler);var mouseout_handler=createMarkerMouseoutHandler(marker,this);GEvent.addListener(marker,"mouseout",mouseout_handler);}}});if(zoomLevel>=15){if(!$('div.exchange .bubble_info')){$('div.exchange').add($('div.exchange').prev()).show();}}else{$('div.exchange').add($('div.exchange').prev()).hide();}
marker_cluster.addMarkers(markers);if(filters_enabled){if(marker_cluster.getClustersInViewport_().length==0){$('.map_tip').fadeIn();$('div#map_canvas').children('div:eq(2)').add('#logocontrol').addClass('offset_map');}else{$('.map_tip').fadeOut();$('div#map_canvas').children('div:eq(2)').add('#logocontrol').removeClass('offset_map');}}}
function update_filters(data){$exchanges=$('#url_exchange');$selected=$('#url_exchange option:selected').val();$exchanges.find('option:not(:first,:selected)').remove();if(data.exchange){jQuery.each(data.exchange,function(){if(this.id!=$selected){if(this.id==url_exchange){selected='selected="selected"';}else{selected=false;}
$exchanges.append($('<option value="'+this.id+'"'+selected+'>'+this.name+'</option>'));}});}}
function update_provider_filter(type){select_box=$('select#url_provider');$(select_box).find('optgroup, option:not(:first)').remove();$.ajax({url:'/_ajax/speedtest.php',data:'action=providers_list&connection_type='+type,dataType:"json",success:function(ajax_response){$.each(ajax_response,function(k,v){$(select_box).append('<optgroup label="'+k+'">');$.each(v,function(kk,vv){$(select_box).append('<option value=\"'+kk+'\" label=\"'+vv+'\">'+vv+'</option>');});$(select_box).append('</optgroup>');});}});}
function addUserMarker(icon,marker_cluster,refresh){var icon=new GIcon();icon.image="/_img/broadband/speedtest_new/map_marker_user.png";icon.iconSize=new GSize(81,88);icon.shadowSize=new GSize(0,0);icon.iconAnchor=new GPoint(45,75);icon.infoWindowAnchor=new GPoint(25,7);u_opts={"icon":icon,"clickable":false,"labelText":'<div class="user_rating"><em class="rating_'+user_data.rating+'"></em><h4>You</h4><p class="download_speed">'+down_speed+'Mb</p><p class="upload_speed">'+up_speed+'Mb</p></div>',"labelOffset":new GSize(-35,-70)};u_marker=new LabeledMarker(user_latlng,u_opts);map.addOverlay(u_marker);return false;}
function getRandomPoint(location_latlng){var bounds=map.getBounds();var southWest=bounds.getSouthWest();var northEast=bounds.getNorthEast();var lngSpan=northEast.lng()-southWest.lng();var latSpan=northEast.lat()-southWest.lat();user_latlng=new GLatLng(southWest.lat()+latSpan*Math.random(),southWest.lng()+lngSpan*Math.random());if(user_latlng.distanceFrom(location_latlng)>1500){getRandomPoint(location_latlng);}}
function showAddressOnMap(response){if(!response||response.Status.code!=200){if(window.location.hash!=initial_hash||window.location.href.indexOf("streetstats")==-1){$('#welcome_box').addClass('error').find('h2').html('<em></em> Error').end().find('p:first').text($('#map_location input:text').val()+" "+STREETSTATS_LOCATION_NOT_FOUND).end().find('p:last').text(SPEEDTEST_MAPS_EXAMPLE).end().fadeInSlide();pageTracker._trackPageview("/speedtest/streetstats/error/location_not_found/"+$('#map_location input:text').val());}}else{if(window.location.hash!=initial_hash||window.location.href.indexOf("streetstats")==-1){$('#welcome_box').fadeOutSlide();}
place=response.Placemark[0];point=new GLatLng(place.Point.coordinates[1],place.Point.coordinates[0]);accuracy=place.AddressDetails.Accuracy;if(accuracy==1){zoomLevel=6;location_name=place.AddressDetails.Country.CountryName;$("div.zoomOut").fadeTo("normal",0.4).css("cursor","default");}else if(accuracy==2){zoomLevel=6;try{location_name=place.AddressDetails.Country.AddressLine[0];}catch(i){location_name=place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName;}}else if(accuracy==3){zoomLevel=10;location_name=place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName;}else if(accuracy==4){zoomLevel=12;try{location_name=place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.LocalityName;}catch(i){try{location_name=place.AddressDetails.Country.SubAdministrativeArea.Locality.LocalityName;}catch(i){try{location_name=place.AddressDetails.Country.AdministrativeArea.Locality.LocalityName;}catch(i){try{location_name=place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.AddressLine[0];}catch(i){location_name=place.AddressDetails.Country.Locality.AddressLine[0];}}}}}else if(accuracy==5){zoomLevel=15;location_name=place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.SubAdministrativeAreaName
$("div.zoomIn").fadeTo("normal",0.4).css("cursor","default");}
if(place.address=='United States'||place.address=='Canada'||place.address=='China'){zoomLevel=4;}else if(place.address=='Russian Federation'){zoomLevel=3;}else if(place.address=='Brazil'||place.address=='Australia'){zoomLevel=5;}
if(type=='home'){zoomLevel=16;}
if(!loaded){broadband_location=$("fieldset#map_location input[type='text']").val();if(broadband_location.length>8){broadband_location=broadband_location.substring(0,5)+'...';}
$('div#broadband_availability h3').text("Broadband for "+broadband_location);Cufon.replace('#broadband_availability h3');loaded=true;}else{map.checkResize();map.setCenter(point,zoomLevel);}}
return false;}
function showPostcodeOnMap(point){var zoomLevel=16;map.checkResize();map.setCenter(point,zoomLevel);if(!loaded){if(user_data){broadband_location=$("fieldset#map_location input[type='text']").val().toUpperCase();$('div#broadband_availability h3').text("Broadband for "+broadband_location);Cufon.replace('#broadband_availability h3');}
loaded=true;}}
$("fieldset#map_location input[type='submit']").click(function(){var address=$("fieldset#map_location input[type='text']").val();if(window.location.href.indexOf("streetstats")>1){url_place=address.toLowerCase();update_url();}
if(address.match(/[A-Za-z]{1,2}\d[A-Za-z\d]? ?\d[A-Za-z]{2}/)){setTimeout(function(){get_postcode_location(address,showPostcodeOnMap);},500);}else{setTimeout(function(){geocoder.getLocations(address,showAddressOnMap);},500);}
return false;});$("fieldset#map_speed input").click(function(){speed=$(this).val();if(window.location.href.indexOf("streetstats")>1){url_speed=speed.replace(/_.*$/,'').toLowerCase();update_url();}
$("div.LabeledMarker_markerLabel p").hide();$("div.LabeledMarker_markerLabel p."+speed).show();});$("p.user_marker a").live("click",function(){var rel=$(this).attr("rel");var visibility=false;if(rel=='remove'){u_marker.hide();$(this).parent().html('You have been removed from the map. <a href="#" rel="add">Undo</a>');visibility='0';}else{u_marker.show();$(this).parent().html('<a href="#" rel="remove">Remove yourself from the map</a>');visibility='1';}
$.ajax({type:"POST",url:"/_ajax/speedtest.php",data:"action=visibility&id="+user_data.test_id+"&value="+visibility,success:function(){},error:function(){}});return false;});$(".speedmap_promo a").click(function(){$("ul#results_nav li.results_streetstats a").click();return false;});$("ul#results_nav li.results_streetstats a").click(function(){if(!loaded){$('.user_rating .download_speed').text(down_speed+'Mb');$('.user_rating .upload_speed').text(up_speed+'Mb');$('input[name=location]').val(user_data.postcode).addClass('blur');$("fieldset#map_location input[type='submit']").click();load_map(map,url);}
setTimeout(function(){map.checkResize();},100);return false;});$("ul.dataType li a").click(function(){if($(this).parent().hasClass('selected')){return false;}
type=$(this).attr("href");type=type.replace('#','');if(!user_data){existing_markers={};marker_cluster.clearMarkers();marker_cluster.resetViewport();url_type=type.toLowerCase();update_url();}
if(type=='mobile'){$('#map_location input.hint').val('Postcode or Location').attr('title','Postcode or Location').removeClass('blur');$('#url_exchange').attr('disabled','disabled');update_provider_filter(2);}else{$('#map_location input.hint').val('Street or Postcode').attr('title','Street or Postcode').removeClass('blur');$('#url_exchange').removeAttr('disabled');update_provider_filter(1);}
$('ul#results_nav li').removeClass('selected');$(this).parent().addClass('selected');url=generate_url();load_map(map,url);return false;});function customise_map(map){G_NORMAL_MAP.getMinimumResolution=function(){return 12};G_NORMAL_MAP.getMaximumResolution=function(){return 16};function PanControl(){}
PanControl.prototype=new GControl();PanControl.prototype.initialize=function(map){var panContainer=document.createElement("div");panContainer.className="panControls";var panLeftDiv=document.createElement("div");panLeftDiv.className="panLeft";panContainer.appendChild(panLeftDiv);GEvent.addDomListener(panLeftDiv,"click",function(){map.panDirection(1,0);});var panRightDiv=document.createElement("div");panRightDiv.className="panRight";panContainer.appendChild(panRightDiv);GEvent.addDomListener(panRightDiv,"click",function(){map.panDirection(-1,0);});var panUpDiv=document.createElement("div");panUpDiv.className="panUp";panContainer.appendChild(panUpDiv);GEvent.addDomListener(panUpDiv,"click",function(){map.panDirection(0,1);});var panDownDiv=document.createElement("div");panDownDiv.className="panDown";panContainer.appendChild(panDownDiv);GEvent.addDomListener(panDownDiv,"click",function(){map.panDirection(0,-1);});map.getContainer().appendChild(panContainer);return panContainer;}
PanControl.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(7,50));}
function ZoomControl(){}
ZoomControl.prototype=new GControl();ZoomControl.prototype.initialize=function(map){var zoomContainer=document.createElement("div");var zoomInDiv=document.createElement("div");zoomInDiv.className="zoomIn";zoomContainer.appendChild(zoomInDiv);GEvent.addDomListener(zoomInDiv,"click",function(){map.zoomIn();});var zoomOutDiv=document.createElement("div");zoomOutDiv.className="zoomOut";zoomContainer.appendChild(zoomOutDiv);GEvent.addDomListener(zoomOutDiv,"click",function(){map.zoomOut();});map.getContainer().appendChild(zoomContainer);return zoomContainer;}
ZoomControl.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(17,110));}
map.enableScrollWheelZoom();map.addControl(new PanControl());map.addControl(new ZoomControl());map.removeMapType(G_HYBRID_MAP);map.removeMapType(G_PHYSICAL_MAP);map.removeMapType(G_SATELLITE_MAP);var icon=new GIcon(G_DEFAULT_ICON);icon.image="/_img/broadband/speedtest_new/map_marker.png";icon.iconSize=new GSize(81,88);icon.shadowSize=new GSize(0,0);icon.iconAnchor=new GPoint(45,75);GEvent.addListener(map,"moveend",function(){new_time=new Date().getTime();time_difference=new_time-old_time;old_time=new_time;if(time_difference>350){lat_long=map.getCenter();zoomLevel=map.getZoom();url=generate_url();load_map(map,url);marker_cluster.resetViewport();}});GEvent.addListener(map,"move",function(){$('.bubble_info').parent().css('z-index',z_index_count+1);});GEvent.addListener(map,"zoomend",function(oldLevel,newLevel){var minResolution=G_NORMAL_MAP.getMinimumResolution();var maxResolution=G_NORMAL_MAP.getMaximumResolution();if(newLevel==16){limit=25;}else if(newLevel==15){limit=50;}else if(newLevel==14){limit=75;}else if(newLevel==13){limit=100;}else if(newLevel==12){limit=125;}
zoomLevel=newLevel;if(newLevel>=15){$('div.exchange').add($('div.exchange').prev()).show();}else{$('div.exchange').add($('div.exchange').prev()).hide();}
if(newLevel==minResolution){$("div.zoomOut").fadeTo("normal",0.4).css("cursor","default");}
if(newLevel>minResolution){$("div.zoomOut").fadeTo("normal",1).css("cursor","pointer");}
if(newLevel==maxResolution){$("div.zoomIn").fadeTo("normal",0.4).css("cursor","default");}
if(newLevel<maxResolution){$("div.zoomIn").fadeTo("normal",1).css("cursor","pointer");}
if(user_latlng){lat_long=new GLatLng(user_latlng.y,user_latlng.x);}
url=generate_url();load_map(map,url);$('.bubble_info').remove();marker_cluster.resetViewport();});if(!$.browser.msie||$.browser.msie&&$.browser.version>6){$('.panControls, .zoomIn, .zoomOut').mouseover(function(){$(this).addClass('hover');}).mouseout(function(){$(this).removeClass('hover');});$('.panControls, .zoomIn, .zoomOut').mousedown(function(){$(this).addClass('focus');}).mouseup(function(){$(this).removeClass('focus');});};}
function get_postcode_location(postcode,callbackFunction){var localSearch=new GlocalSearch();localSearch.setSearchCompleteCallback(null,function(){if(localSearch.results[0]){var resultLat=localSearch.results[0].lat;var resultLng=localSearch.results[0].lng;var point=new GLatLng(resultLat,resultLng);if(user_data){user_data.location_data.long=resultLng;user_data.location_data.lat=resultLat;}
postcode_location=localSearch.results[0];callbackFunction(point);if(window.location.hash!=initial_hash||window.location.href.indexOf("streetstats")==-1){$('#welcome_box').fadeOutSlide();}}else{if(window.location.hash!=initial_hash||window.location.href.indexOf("streetstats")==-1){$('#welcome_box').addClass('error').find('h2').html('<em></em> Error').end().find('p:first').text($('#map_location input:text').val()+" "+STREETSTATS_LOCATION_NOT_FOUND).end().find('p:last').text('Example: London, England').end().fadeInSlide();pageTracker._trackPageview("/speedtest/streetstats/error/postcode_not_found/"+$('#map_location input:text').val());}}});localSearch.execute(postcode+", UK");}
$.fn.hint=function(){return this.each(function(){var t=$(this);if(t.attr('title')){t.focus(function(){if(t.val()==t.attr('title')){t.val('');t.addClass('blur');}})
t.blur(function(){if(t.val()==''){t.val(t.attr('title'));t.removeClass('blur');}})
t.blur();}})}
$('input.hint').hint();function update_users_location(){if(user_data.connection_type==2){location_latlng=new GLatLng(user_data.location_data.lat,user_data.location_data.long);map.setCenter(location_latlng,12);getRandomPoint(location_latlng);}else{user_latlng=new GLatLng(postcode_location.lat,postcode_location.lng);}
$.ajax({type:"POST",url:"/_ajax/speedtest.php",data:"action=update&id="+user_data.test_id+"&lat="+user_latlng.y+"&long="+user_latlng.x,success:function(){},error:function(){}});}
$('#end_of_setup a.start_big_button').click(function(){addUserMarker(icon,marker_cluster,true);user_plotted=true;});$.fn.addOverlay=function(){$(this).append('<div class="loading_overlay"><span class="loading_large"><span class="sifr"><img src="/_img/broadband/speedtest_new/spinner_big.gif" width="32" height="32" /> Loading...</span></span></div>');}
$.fn.providerFancybox=function(){$(this).fancybox({'width':870,'height':580,'callbackOnStart':function(){overlay_height=$('#fancy_overlay').height()+'px';$('#fancy_close').empty().append('Close');$('#fancy_overlay .loading_overlay').css('line-height',overlay_height).show();},'callbackOnShow':function(){Cufon.replace('#fancy_ajax .sifr');$('#fancy_overlay .loading_overlay').hide();$("#fancy_ajax a[href^='/go/']").external({toolbar:1,scrollbars:1,location:1,statusbar:1,menubar:1,resizable:1,width:800,height:600,left:100,top:150});$('#fancy_ajax #products .monthly_cost .conditions').wrap('<div class=\"bubble_wrap\"></div>');var in_progress=false;$('#fancy_ajax #products .monthly_cost .conditions_link').live('mouseover',function(){if(in_progress==false){in_progress=true;$(this).parent().find('.conditions .cost').remove();$(this).parent().find('.conditions').prepend($(this).prev('.cost').clone().append('a month')).fadeIn('fast');}});$('#fancy_ajax #products .monthly_cost .conditions_link').live('mouseout',function(){$(this).parent().find('.conditions').fadeOut('fast',function(){$(this).find('.cost').remove();in_progress=false});});},'callbackOnClose':function(){$('#fancy_ajax').empty();$('#products table').stickyheader();}})};$.fn.fadeInSlide=function(){$(this).animate({opacity:"show",top:'-=40px'},'fast');};$.fn.fadeOutSlide=function(){$(this).animate({top:'+=40px',opacity:"hide"},'fast');}
function load_filters(){var value=0;$('#current_value').text('Any');$('#slider').slider({animate:false,step:2,min:0,orientation:'horizontal',max:20,value:value,start:function(event,ui){slide_int=setInterval(update_slider,10);},slide:function(event,ui){setTimeout(update_slider,10);},stop:function(event,ui){clearInterval(slide_int);update_url();marker_cluster.clearMarkers();existing_markers={}
url_speed_value=$('#slider').slider('option','value');url=generate_url();load_map(map,url);marker_cluster.resetViewport();}});$('.hide_filters').click(function(){$('.filters_on').slideUp('fast',function(){$('.filters_off').css('z-index','1').fadeTo('fast',1);});return false;});$('.show_filters').click(function(){$('.filters_off').css('z-index','-1').fadeTo('fast',0,function(){$('.filters_on').slideDown('fast');});return false;});$('.reset_filters').click(function(){return false;});$('.filters_on select').change(function(){marker_cluster.clearMarkers();existing_markers={}
select_box=$(this).attr('id');if(select_box=='url_exchange'){url_exchange=$(this).val();}else if(select_box=='url_provider'){url_provider=$(this).val();}else if(select_box=='url_time'){url_time=$(this).val();}
update_url();url=generate_url();load_map(map,url);marker_cluster.resetViewport();return false;});$('#url_verified').click(function(){marker_cluster.clearMarkers();existing_markers={}
if($(this).is(':checked')){url_verified=1;}else{url_verified=0;}
update_url();url=generate_url();load_map(map,url);marker_cluster.resetViewport();});}
function update_filter_text(){url_exchange_text=$('#url_exchange option[value='+url_exchange+']').text();if(url_exchange_text!='All Exchanges'){$('.single_exchange').show();if(url_exchange_text.length>12){url_exchange_text=url_exchange_text.substring(0,9)+'...';}}else{$('.single_exchange').hide();}
$('em.exchange').text(url_exchange_text);url_provider_text=$('#url_provider option[value='+url_provider+']').text();if(url_provider_text!='All Providers'){if(url_provider_text.length>12){url_provider_text=url_provider_text.substring(0,9)+'...';}}
$('em.provider').text(url_provider_text);$('em.date_range').text($('#url_time option[value='+url_time+']').text());}
function update_slider(){var value=$('#slider').slider('option','value');url_speed_value=value;if(value==0){$('#current_value, em.speed').text('Any');}else{$('#current_value, em.speed').text(value+'Mb');}}
function generate_url(){generated_url='http://speedtest.top10-broadband.co.uk/_ajax/speedtest.php/?action=map&type='+url_type+'&lat='+lat_long.y+'&long='+lat_long.x+'&range='+range+'&limit='+limit
if(url_speed_value){generated_url+='&speed='+url_speed_value}
if(url_exchange!='all'){generated_url+='&exchange='+url_exchange}
if(url_provider!='all'){generated_url+='&provider='+url_provider}
generated_url+='&time='+url_time+'&verified='+url_verified
return generated_url}
$(document).ready(function(){$('.close_welcome_box').click(function(){$('#welcome_box').fadeOutSlide();});$('.bubble_info .close_window').live('click',function(){if(bubble_marker.div_){bubble_marker.redraw(true);}
image=$(bubble_marker.div_).prev().attr('src').replace('_hover','')
$(bubble_marker.div_).prev().attr('src',image);$('.temp_hidden').show();$(this).parent().remove();});$('a.provider_table').live('click',function(){return false;});$("#map_location input:text").keypress(function(e){if((e.which&&e.which==13)||(e.keyCode&&e.keyCode==13)){$(this).parent().find('input:submit').click();return false;}else{return true;}});});