$(function(){var businessType=function(name){name=name.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var regexS="[\\?&]"+name+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(window.location.href);if(results==null){return""}else{return results[1]}}("businessType").toLowerCase();if(businessType!==""){businessType=businessType.slice(0,3);var datasource;switch(businessType){case"hot":datasource="hotels";break;case"bed":datasource="hotels";break;case"gue":datasource="hotels";break;case"res":datasource="restaurants";break;case"pub":datasource="pubs";break;case"day":datasource="day_nurseries";break;case"doc":datasource="doctors";break;case"den":datasource="dentists";break;case"hai":datasource="hairdressers";break;case"hea":datasource="gyms";break;case"lei":datasource="gyms";break;case"flo":datasource="florists";break;case"est":datasource="estate_agents";break;case"let":datasource="estate_agents";break}$("li.mm-clients-yell-"+datasource).remove()}MMYell.init();MMYell.LocalInformation.setMapviewer(MMYell.Mapviewer.map);MMYell.UI.setMapviewer(MMYell.Mapviewer.map);map_move=0;map_zoom=0;map_type_changed=0;map_isBE=0;$(window).resize(function(evt){if(MMYell.UI.currentHeight!=document.documentElement.clientHeight){MMYell.UI.windowResize()}MMYell.UI.currentHeight=document.documentElement.clientHeight;return false});MMYell.Mapviewer.map.addEventHandler("endPan",function(){if(arguments[4]!=="zoom"){if(arguments[4]==undefined){map_move=0}else{map_move=1}MMYell.LocalInformation.update()}});MMYell.Mapviewer.map.addEventHandler("changeZoom",function(){setTimeout(function(){map_zoom=1;MMYell.LocalInformation.zoomMap()},100)});MMYell.Mapviewer.map.addEventHandler("click",function(){if(arguments[1].getInfoBoxHTML){MMYell.LocalInformation.markerClick(arguments[1])}});$(".localInformation input").click(function(){var ds=$(this).parents("li").attr("class");if($(this).is(":checked")){MMYell.LocalInformation.addDataSource(ds)}else{MMYell.LocalInformation.removeDataSource(ds)}});$("a.globalZoom").click(function(){MMYell.LocalInformation.zoomToMinimum();return false});$("#leftPanelToggle").click(function(){MMYell.UI.toggleLeftPanel()});$("h3 a").not(".onMap").click(function(){MMYell.UI.toggleDrawer(this);return false});if($("#container").attr("class")==="mpm"){$("#printLink a").click(function(){MMYell.MPM.buildPrintLink()})}else{$("#printLink a").click(function(){MMYell.UI.print();return false})}if($("#container").attr("class")==="mpm"){var inputs=document.getElementsByTagName("input");for(var i=0;i<inputs.length;i++){var iname=inputs[i].getAttribute("name");if(iname=="startPoint"){inputs[i].onclick=function(){MMYell.MPM.unFocus(this)}}}}if($("#container").attr("class")=="mpm"){$("body").addClass("dynamic")}else{$("body").toggleClass("static").addClass("dynamic");$(".static_submit").remove()}$("ul.localInformation li:last-child").css("border-bottom","none");MMYell.UI.windowResize(new MMPoint(0,0));MMYell.LocalInformation.zoomMap()});var MMUtil={hasClass:function(o,css_class){return o.className.match(new RegExp("\\b"+css_class+"\\b"))==css_class}};(function(){window.MM_YELL_DOMAIN="http://www.multimap.com";if(~window.location.href.indexOf("mydev")||~window.location.href.indexOf("yellqa")){window.MM_YELL_DOMAIN=""}})();MMYell={print_url:null,init:function(){this.container=document.getElementById("container");if(this.container.className.match("mpm")){this.page_type="mpm"}else{this.page_type="other"}this.Mapviewer.init();this.Header.init();this.Loader.init();this.UI.init();if(this.page_type!="mpm"){this.LocationSearch.init();this.RouteSearch.init()}else{this.MPM.init()}this.LocalInformation=new YellLocalInformationWidget();window.data_logger=new MMOmniture()},getQueryString:function(){if(this.query_string){return this.query_string}this.query_string={};var qs=location.search.substring(1,location.search.length).replace(/\+/g," ");var pairs=qs.split("&");for(var i=0,j=pairs.length;i<j;++i){var value;var pair=pairs[i].split("=");var name=unescape(pair[0]);if(pair.length==2){value=unescape(pair[1])}else{value=name}this.query_string[name]=value}return this.query_string}};MMYell.UI=(function(){var WIN_WIDTH=757,WIN_HEIGHT=600,RESIZE_DELAY=100,MIN_HEIGHT=691,MIN_WIDTH=1024;var map,leftPanel,drawers,drawerContent,leftPanelToggle,container,maptips,copyright,mapviewer,header,footer,infoBar;var headerHeight,footerHeight,infoBarHeight,containerHeight,mapTipsHeight,directionsButtonHeight,contentHeight,routeSummaryHeight,routeOptionsHeight,rListExtension,leftPanelHeight,drawerHeaderHeight,iframeHeight;var rList,rSummary,rOptions,rList;var mv;return{print_url:null,print_route_info:"",init:function(){container=$("#container");maptips=$("#mapTips");map=$("#map");leftPanel=$("#leftPanel");leftPanelToggle=$("#leftPanelToggle");mapviewer=$("#mapviewer");infoBar=$("#infoBar");header=$("#header");footer=$("#footer");drawers=$("#leftPanel .drawer");drawerContent=$(".drawer .content:not(#rSummary):not(#rList):not(#rOptions)");drawerHeaderHeight=$("#leftPanel h3").height();iframeHeight=($("iframe").size()==1)?$("iframe").outerHeight({margin:true}):0;$("#leftPanel").css("overflow","hidden");rList=$("#rList")},cancelResize:function(){if(typeof this.timeoutID=="number"){window.clearTimeout(this.timeoutID);delete this.timeoutID}},redrawWindow:function(resized_side){delete this.timeoutID;headerHeight=header.outerHeight({margin:true});infoBarHeight=infoBar.outerHeight({margin:true});infoBarHeight-=iframeHeight;footerHeight=footer.outerHeight({margin:true});containerHeight=MultimapViewer.prototype.getBrowserDimensions().height;if(this.lastContainerHeight==containerHeight){return}this.lastContainerHeight=containerHeight;mapTipsHeight=maptips.outerHeight({margin:true});var thingymajig=39;if(containerHeight>MIN_HEIGHT){contentHeight=containerHeight-headerHeight-footerHeight-infoBarHeight-thingymajig}else{contentHeight=MIN_HEIGHT-headerHeight-footerHeight-infoBarHeight-thingymajig}leftPanelHeight=contentHeight-3;leftPanel.get(0).style.height=leftPanelHeight+"px";leftPanelToggle.height(contentHeight-mapTipsHeight);map.height(contentHeight);thingymajig-=3;var mapviewerHeight=(contentHeight-mapTipsHeight-2)<400?400-thingymajig:contentHeight-mapTipsHeight-2;if(!window.XMLHttpRequest&&mapviewerHeight%2!=0){mapviewerHeight-=1}mapviewer.height(mapviewerHeight);this.panelResize();mv.resize(resized_side)},windowResize:function(resized_side){this.cancelResize();var me=this;this.timeoutID=window.setTimeout(function(){me.redrawWindow(resized_side)},RESIZE_DELAY)},panelResize:function(){var maxAllowedHeight=leftPanelHeight-(4*drawerHeaderHeight)-4;var openedDrawerContent=$("#leftPanel .drawer:not([class*=collapsed]) .content");openedDrawerContent.css("height","auto");openedDrawerContent.removeClass("scroll");if($("#leftPanel .drawer:not([class*=collapsed])").attr("id")==="getDirections"&&$("#rSummary").size()>0){rListHeight=$("#rList").outerHeight({margin:true});rSummaryHeight=$("#rSummary").outerHeight({margin:true});if(rSummaryHeight>120){$("#rSummary").height(120);rSummaryHeight=$("#rSummary").outerHeight({margin:true})}rOptionsHeight=$("#rOptions").outerHeight({margin:true});if(rListHeight+rSummaryHeight+rOptionsHeight>maxAllowedHeight){rListHeight=(maxAllowedHeight-rOptionsHeight-rSummaryHeight)+"px";rList.get(0).style.height=rListHeight}}else{var openDrawerContentHeight=$("#leftPanel .drawer:not([class*=collapsed])").outerHeight({margin:true})-drawerHeaderHeight;if(openDrawerContentHeight>maxAllowedHeight){openedDrawerContent.addClass("scroll");openedDrawerContent.get(0).style.height=maxAllowedHeight+"px"}}},setMapviewer:function(mapviewer){mv=mapviewer},openDefaultDrawer:function(){drawers.filter("#localBusinesses").toggleClass("collapsed")},toggleLeftPanel:function(){map.toggleClass("panelVisible").toggleClass("panelHidden");mv.resize(new MMPoint(-1,0))},updatePrintURL:function(names){var qsa="",ids="";var nat_id=MMYell.getQueryString().nat_id||"";var sl=MMYell.getQueryString().sl||"";var curZF=MMYell.Mapviewer.map.getZoomFactor();var pois=MMYell.LocalInformation.selectedDatasources();var me=this;var mapType;if(MMYell.Mapviewer.map.getMapType()==4){mapType="&type=map"}else{if(MMYell.Mapviewer.map.getMapType()==8){mapType="&type=aerial"}}if(MMYell.RouteSearch.result){for(var i=0,j=names.length;i<j;++i){qsa+=encodeURIComponent(names[i].display_name)+":";if(!names[i].is_via){if(names[i].poi_type==0){ids+=names[i].poi_id+","}else{ids+=","}}}qsa=qsa.substr(0,qsa.length-1);ids=ids.substr(0,ids.length-1);var modes=MMYell.RouteSearch.getModeString();this.print_url="print.htm?panel=directions&warnings=true&route="+MMYell.RouteSearch.route.key+"&qsa="+qsa+"&ids="+ids+mapType+"&mode="+modes+this.print_route_info}else{qsa=$("#mapInfo h2").text();var sub_sw=MMYell.Mapviewer.map.getMapPositionAt(new MMPoint(-350,215));var sub_ne=MMYell.Mapviewer.map.getMapPositionAt(new MMPoint(350,-215));var sub_bb=new MMBounds(sub_sw,sub_ne).toAPIQueryString();var marker_pos=MMYell.Mapviewer.marker.getPosition().coords;this.print_url="print.htm?";this.print_url+="panel=location&loc="+marker_pos.lat+":"+marker_pos.lon+":"+curZF+mapType+"&qsa="+qsa+"&marker=true&nat_id="+nat_id+"&sl="+sl+sub_bb}$.each(pois,function(i,n){var name;n.search("poi")!=-1?name=n.replace(/.*\.yell_/,""):name=n.replace(/.*\..*\..*\./,"");me.print_url+="&"+name+"=true"})},print:function(){var posX=(screen.width-WIN_WIDTH)/2;var posY=(screen.height-WIN_HEIGHT)/3;this.updatePrintURL(MMYell.RouteSearch.inputs);var printWindow=window.open(this.print_url,"print","width="+WIN_WIDTH+", height="+WIN_HEIGHT+", screenX="+posX+", screenY="+posY+", resizable=yes, scrollbars=yes")},updateDirectionsButton:function(status){if(status==="show"){$("#bUpdateDir").removeClass("hide")}else{if(status==="hide"){$("#bUpdateDir").addClass("hide")}else{$("#bUpdateDir").toggleClass("hide")}}this.panelResize()},toggleDrawer:function(that){var closingDrawerId=$("#leftPanel .drawer:not([class*=collapsed])").attr("id");var openingDrawer=$(that).parents(".drawer");var openingDrawerId=openingDrawer.attr("id");if(closingDrawerId!==undefined&&openingDrawerId!==closingDrawerId){drawers.addClass("collapsed")}MMYell.LocalInformation.drawerOpened(openingDrawerId,closingDrawerId);openingDrawer.toggleClass("collapsed");if(closingDrawerId===undefined||openingDrawerId!==closingDrawerId){this.panelResize()}}}})();MMYell.Disambiguation=function(results,callback){this.callback=callback;this.results=results};MMYell.Disambiguation.prototype={buildDropDown:function(default_text,mapviewer){var select=document.createElement("select");select.id="MMDisambiguation";var def=document.createElement("option");def.value="default";def.appendChild(document.createTextNode(default_text));select.appendChild(def);var markers=[];for(var count=0;count<this.results.length;count++){var address=this.results[count].address;var option=document.createElement("option");option.value=count;option.appendChild(document.createTextNode(address.display_name));select.appendChild(option)}var me=this;select.onchange=function(){me.callback(me.results[this.options[this.selectedIndex].value]);return false};return select}};MMYell.Mapviewer={init:function(){var container=$("#container").get(0);var map=$("#map").get(0);var node=document.getElementById("mapviewer");this.map=MMFactory.createViewer(node,MM_WORLD_MAP);this.map.setOption("autoswitchapi",false);if(MMYell.page_type!=="mpm"){var pos=new MMLocation();pos.coords=new MMLatLon(node.className.split(",")[0],node.className.split(",")[1]);pos.zoom_factor=node.className.split(",")[2];MMYell.LocationSearch.current_location=pos;this.goToPosition(pos,node.className.split(",")[3])}var overview_widget=new MMOverviewWidget(-4,new MMDimensions(125,125),new MMBox(undefined,0,12,undefined),"yellOverviewWidget");this.map.addWidget(overview_widget);this.map.setAllowedZoomFactors(6);this.map.declutterGroup("POI",{},MM_DECLUTTER_GRID);this.map.addWidget(new MMPanZoomWidget(undefined,"yellPanZoomWidget",true,$(".yellPanZoomWidget").get(0)));this.map.addWidget(new MMMapTypeWidget(undefined,undefined,"yellMapTypeWidget",undefined,$(".yellMapTypeWidget").get(0)));this.map.addWidget(new MMOrientationWidget(null,new MMBox(100,undefined,undefined,84),"yellOrientationWidget"));var map_types=this.map.getAvailableMapTypes();while(map_types.length){if(map_types.shift()==MM_WORLD_BIRDSEYE){$(".yellMapTypeWidget .MM_WORLD_BIRDSEYE").removeClass("MMdisabled");break}}this.bound_limit=new MMBounds(new MMLatLon(49.85999,-10.66912),new MMLatLon(60.898,1.76459));this.checking_bounds=false;var me=this;this.map.addEventHandler("moveMap",function(){me.checkBounds()});this.map.addEventHandler("birdseyeUnavailable",function(type){me.displayBirdseyeWarning(type)});this.map.addEventHandler("birdseyeOrientationUnavailable",function(type){me.displayBirdseyeWarning(type)});this.map.addEventHandler("changeMapType",function(){if(arguments[3]=="256"){map_isBE=arguments[3]}else{map_isBE=arguments[2]}map_type_changed=1});this.map.manageLayout(container);this.map.setOption("mousewheel:wheelup","zoomin");this.map.setOption("mousewheel:wheeldown","zoomout");this.map.setOption("birdseyewarning",false);this.map.setOption("contextmenu",false);this.map.registerEventType("requestStart");this.map.registerEventType("requestEnd");this.map.registerEventType("locationShown");this.map.registerEventType("routeShown");this.map.registerEventType("routeCleared")},displayBirdseyeWarning:function(type){var text="";var pos=new MMBox(100,undefined,undefined,90);if(type=="birdseyeOrientationUnavailable"){pos.left=164;text="No data is currently available for the selected bird's eye orientation."}else{if(type=="birdseyeUnavailable"&&this.map.getZoomFactor()<11){text="You will need to zoom in to see bird's eye imagery."}else{text="Bird's eye view is not available for this location."}}var message=new MMMessageWidget(text,{timeout:10000},pos,"yellBirdseyeWarning");this.map.addWidget(message)},checkBounds:function(){var mapcentre=this.map.getCurrentPosition();var out=false;var sw=this.bound_limit.getSouthWest();var ne=this.bound_limit.getNorthEast();if(mapcentre.lon>ne.lon){out=true;mapcentre.lon=ne.lon}else{if(mapcentre.lon<sw.lon){out=true;mapcentre.lon=sw.lon}}if(mapcentre.lat>ne.lat){out=true;mapcentre.lat=ne.lat}else{if(mapcentre.lat<sw.lat){out=true;mapcentre.lat=sw.lat}}if(out){if(this.checking_bounds){}else{var smoothPan=this.map.getOption("smoothpan");this.map.setOption("smoothpan",false);this.checking_bounds=true;this.map.goToPosition(mapcentre);this.checking_bounds=false;this.map.setOption("smoothpan",smoothPan)}}},goToPosition:function(pos,marker){if(marker=="true"||marker===true){if(this.marker){this.map.removeOverlay(this.marker)}if(!this.icon){this.icon=new MMIcon("/share/yell_poi/img/mapIcon_x.gif");this.icon.iconSize=new MMDimensions(18,22);this.icon.iconAnchor=new MMPoint(9,22)}this.marker=this.map.createMarker(pos.coords,{icon:this.icon,inert:true})}this.map.goToPosition(pos)}};MMYell.LocationInput=function(node){if(arguments.length<1){var node=this.createHTML();this.is_via=true}this.setNode(node);this.is_editable=true};MMYell.LocationInput.prototype={setNode:function(node){this.node=node;this.jnode=$(node);this.qs=this.node.getElementsByTagName("input")[0];this.label=this.jnode.find("label:first");this.label_text=this.label.html();this.messages=this.jnode.children("div:first")},createHTML:function(){var node=MMYell.RouteSearch.via_template.cloneNode(true);node.id="";var input=node.getElementsByTagName("input")[0];input.id="";input.name="";var label=node.getElementsByTagName("label")[0];label.innerHTML="Via:";label.id="";var remove=document.createElement("a");remove.href="#";remove.className="removeVia";var me=this;remove.onclick=function(){me.jnode.remove();MMYell.RouteSearch.removeViaInput(me.getIndex());MMYell.UI.panelResize();return false};remove.appendChild(document.createTextNode("Remove via point"));node.insertBefore(remove,label.parentNode);return node},getMMLocation:function(){if(!this.location||this.qs.value!=this.location.address.qs){var l=new MMLocation(new MMAddress({qs:this.qs.value,country_code:"GB"}));this.location=l;this.carpark=false}return this.location},showDisambiguation:function(dropdown){this.messages.empty();this.messages.append("<label>We have several matches for your location.</label>");this.messages.append(dropdown);if(this.label){this.label.html("Or enter a new location")}else{this.messages.append("<label>Or enter a new location</label>")}},showLocation:function(){this.messages.empty();this.label.html("Find location:")},showError:function(message,supress_label){this.messages.empty();this.messages.append(message);if(!supress_label){this.label.html("Enter a new location")}},showStartEndError:function(){this.messages.empty();this.messages.append("Ensure the highlighted fields contain different locations.");$(this.qs).addClass("warn");if(this.edit){this.edit.click()}},showMissingTextError:function(){this.label.html('Please <strong>enter</strong> a "'+this.label_text+'" </strong>location</strong>');$(this.qs).addClass("warn")},removeMissingTextError:function(){this.label.html(this.label_text);$(this.qs).removeClass("warn")},copy:function(){new_obj={};for(var i in this){new_obj[i]=this[i]}new_obj.node=this.node.cloneNode("true");return new_obj},editable:function(thestatus,address){if(this.is_editable==thestatus){if(address){this.jnode.find(".inputDisplay").html(address)}return false}var me=this;if(thestatus){this.qs.style.display="inline";if(this.is_via){this.jnode.find(".removeVia").show()}}else{var properties={};properties=this.qs.id=="qs_1"?{point:"start",alt:"S"}:{point:"finish",alt:"F"};this.jnode.find(".removeVia").hide();if(this.is_via){$('<span class="stepNo">&nbsp;</span>').insertBefore(this.qs)}var point=$('<span class="inputDisplay">'+address+"</span>").insertBefore(this.qs);var edit=$('<a href="#edit" class="editRoute">Edit</a>').insertAfter(this.qs);this.edit=edit;this.qs.style.display="none";edit.click(function(){me.editable(true);point.remove();edit.remove();delete me.edit;MMYell.UI.updateDirectionsButton("show");var target=$(me.node);var list=$("#rList");var targetOffset=((target.offset().top-list.offset().top)+target.height())-list.height()+20;if(targetOffset>list.height()){list.get(0).scrollTop=targetOffset}return false})}this.is_editable=thestatus},reset:function(){this.messages.empty().removeClass("missingText");this.label.html(this.label_text);this.jnode.find(".routeIcon").remove();this.jnode.find(".inputDisplay").remove();this.jnode.find(".editRoute").remove();$(this.qs).removeClass("warn");this.qs.value=""},getIndex:function(){var thearray=MMYell.RouteSearch.inputs;for(var i=0,j=thearray.length;i<j;++i){if(thearray[i]==this){return i}}}};MMYell.LocationSearch={init:function(){this.form=document.getElementById("MMGeocodeForm");var me=this;this.form.onsubmit=function(){me.submit();return false};var me=this;this.geocoder=new MMGeocoder(function(){me.callback()})},submit:function(){if(!this.input){this.input=new MMYell.LocationInput(this.form.getElementsByTagName("div")[0])}this.showLocation(this.input.getMMLocation())},showLocation:function(location){MMYell.RouteSearch.clear();if(location.coords){this.updateMap(location);MMYell.Mapviewer.map.handleEvent("locationShown",this)}else{this.geocoder.geocode(location.address);MMYell.Mapviewer.map.handleEvent("requestStart",this)}},callback:function(static_q,results,error){if(static_q=="static"){this.geocoder.result_set=results;this.geocoder.error_code=error}MMYell.Mapviewer.map.handleEvent("requestEnd",this);if(this.geocoder.error_code){if($("#findLocation").hasClass("collapsed")){$("#findLocation h3 a").click()}if(this.geocoder.error_code!="MM_GEOCODE_MULTIPLE_MATCHES"){this.showError(this.geocoder.error_code)}else{var me=this;var disambiguation=new MMYell.Disambiguation(this.geocoder.result_set,function(location){me.input.location.coords=location.coords;me.input.location.zoom_factor=location.zoom_factor;me.input.display_name=location.address.display_name});this.input.showDisambiguation(disambiguation.buildDropDown("Select your preferred location",MMYell.Mapviewer.map))}}else{this.updateMap(this.geocoder.result_set[0]);this.input.display_name=this.geocoder.result_set[0].address.display_name;MMYell.Mapviewer.map.handleEvent("locationShown",this)}},updateMap:function(location){MMYell.Mapviewer.goToPosition(location,true);this.input.showLocation();this.location=location;logLocation(location.address)},showError:function(code){var mess;switch(code){case"MM_GEOCODE_NO_MATCHES":mess="We have found no matches for your location.";break;case"MM_GEOCODE_REQUIRED_PARAMETERS_MISSING":mess="There are required parameters missing from the search request you made.";break;default:mess="An unkown error has occured with your search."}this.input.showError(mess)}};MMYell.RouteSearch={init:function(){this.form=document.getElementById("MMRouteForm");var me=this;this.inputs=this.collectInputs();this.via_template=this.inputs[0].node.cloneNode(true);this.add_via=document.getElementById("addVia");document.getElementById("add_via_link").onclick=function(){me.addViaInput();MMYell.UI.updateDirectionsButton("show");var target=$("div#getDirections .MMYellLocationInput:last");var targetOffset=target.offset().top+target.height();$("#rList").get(0).scrollTop=targetOffset;return false};this.form.onsubmit=function(){me.submit();return false};this.via_inputs=0;this.contains_carpark=false;this.reversed_carpark=false;var form=MMYell.getQueryString();if(form.nat_id&&form.companyName&&form.qs){this.markerDisplay={pc:form.storePC};MMYell.RouteSearch.setLocation("to",form.companyName,MMYell.LocationSearch.current_location.coords,false,form.nat_id,true)}},collectInputs:function(){var l=this.form.getElementsByTagName("div");var inputs=[];for(var i=0,j=l.length;i<j;++i){if(MMUtil.hasClass(l[i],"MMYellLocationInput")){inputs.push(new MMYell.LocationInput(l[i]))}}return inputs},submit:function(){var locations=[];for(var i=0,j=this.inputs.length;i<j;++i){locations.push(this.inputs[i].getMMLocation());if(!locations[i].address.qs){this.inputs[i].showMissingTextError();var cancel=true}else{this.inputs[i].removeMissingTextError()}}if(cancel){return false}var mode=this.getModeString();this.requestRoute(locations,mode)},getModeString:function(){var mode=this.form.mode[0].checked?"driving":"walking";if(mode!="walking"){var modes=[];var has_carpark=false;if(this.reversed_carpark){has_carpark=true}for(var i=0,j=this.inputs.length-1;i<j;++i){if(this.inputs[i].carpark&&this.reversed_carpark){has_carpark=false;modes.push("driving")}else{if(this.inputs[i].carpark||has_carpark){modes.push("walking");has_carpark=true}else{modes.push("driving")}}}mode=modes.join(",")}return mode},requestRoute:function(locations,mode){if(!this.route_requester){var me=this;this.route_requester=new MMRouteRequester(function(){me.callback()})}this.route=new MMRoute(locations);this.route.mode=mode;this.route.lang="en_GB";this.route_requester.request(this.route);MMYell.Mapviewer.map.handleEvent("requestStart",this)},callback:function(route){if(route){this.route=route}if(!this.route.mode){this.route.mode="driving"}MMYell.Mapviewer.map.handleEvent("requestEnd",this);for(var i=0,j=this.inputs.length;i<j;++i){this.inputs[i].messages.empty();this.inputs[i].label.html(this.inputs[i].label_text)}if(this.route.error_code){if(this.route.error_code!="MM_ROUTE_GEOCODING_ERRORS"){switch(this.route.error_code){case"MM_ROUTE_ERROR_START_END_POINTS_SAME":this.inputs[0].showStartEndError();this.inputs[this.inputs.length-1].showStartEndError();break;case"MM_ROUTE_ERROR_CONSECUTIVE_POINTS_SAME":for(var i=0,j=this.inputs.length;i<j;++i){if(this.inputs[i+1]&&this.inputs[i].location.address.qs.trim().toUpperCase()==this.inputs[i+1].location.address.qs.trim().toUpperCase()){this.inputs[i].showStartEndError();this.inputs[i+1].showStartEndError()}}break;default:this.inputs[0].showError("An unkown routing error occured",true);break}}else{this.resolveGeocodingErrors(this.route.geocoding_errors)}}else{if(this.route.mode!="walking"){this.requestTraffic()}this.resolveLocations(this.route.stages);MMYell.Mapviewer.map.handleEvent("routeShown",this);if(this.result){this.result.clearMap(MMYell.Mapviewer.map)}this.result=new MMYell.RouteResult(this.route);this.result.showOnMap(MMYell.Mapviewer.map);this.result.buildResults($("#MMRouteForm #rList"));MMYell.UI.updateDirectionsButton("hide")}var display_names=[];for(var i=0,j=this.inputs.length;i<j;++i){display_names[i]=this.inputs[i].display_name}var me=this;MMYell.UI.panelResize();setTimeout(function(){MMYell.UI.panelResize()},10)},resolveLocations:function(stages){for(var i=0,j=stages.length;i<j;++i){this.inputs[i].location.coords=stages[i].start_point;if(stages[i].start_address.display_name){this.inputs[i].display_name=stages[i].start_address.display_name}if(stages.length==i+1){this.inputs[i+1].location.coords=stages[i].end_point;if(stages[i].end_address.display_name){this.inputs[i+1].display_name=stages[i].end_address.display_name}}}},resolveGeocodingErrors:function(geocoding_errors){if(geocoding_errors.length==0){return}var current_error=geocoding_errors.shift();if(current_error.error_code=="MM_GEOCODE_NO_MATCHES"){this.inputs[current_error.input_id-1].showError("We have found no matches for your location.")}else{var me=this;var disambiguation=new MMYell.Disambiguation(current_error.results,function(location){var input=me.inputs[current_error.input_id-1];input.location.coords=location.coords;input.display_name=location.address.display_name});this.inputs[current_error.input_id-1].showDisambiguation(disambiguation.buildDropDown("Select your preferred location",MMYell.Mapviewer.map))}this.resolveGeocodingErrors(geocoding_errors)},addViaInput:function(carpark){if(carpark){this.contains_carpark=true}++this.via_inputs;var input=new MMYell.LocationInput();input.carpark=carpark;this.add_via.parentNode.insertBefore(input.node,this.add_via);input.qs.value="";this.inputs.splice(this.inputs.length-1,0,input);if(this.via_inputs==5){this.add_via.style.display="none";$("div#mapviewer li.infoboxVia").hide()}return false},removeViaInput:function(index){--MMYell.RouteSearch.via_inputs;MMYell.RouteSearch.inputs.splice(index,1);var carparks=false;$.each(MMYell.RouteSearch.inputs,function(i,n){if(n.carpark){carparks=true}});this.contains_carpark=carparks;if(!carparks){this.reversed_carpark=false}if(MMYell.RouteSearch.route){MMYell.RouteSearch.submit()}if(this.via_inputs==4){this.add_via.style.display="block";$("div#mapviewer li.infoboxVia").show()}},reverse:function(){var new_inputs=[];var ii=this.inputs.length-1;for(var i=0,j=Math.floor(this.inputs.length/2);i<j;++i){var spare=this.inputs[ii].location;this.inputs[ii].location=this.inputs[i].location;this.inputs[i].location=spare;spare=this.inputs[ii].display_name;this.inputs[ii].display_name=this.inputs[i].display_name;this.inputs[i].display_name=spare;spare=this.inputs[ii].qs.value;this.inputs[ii].qs.value=this.inputs[i].qs.value;this.inputs[i].qs.value=spare;spare=this.inputs[ii].carpark;this.inputs[ii].carpark=this.inputs[i].carpark;this.inputs[i].carpark=spare;spare=this.inputs[ii].poi_full_id;this.inputs[ii].poi_full_id=this.inputs[i].poi_full_id;this.inputs[i].poi_full_id=spare;spare=this.inputs[ii].poi_id;this.inputs[ii].poi_id=this.inputs[i].poi_id;this.inputs[i].poi_id=spare;spare=this.inputs[ii].poi_type;this.inputs[ii].poi_type=this.inputs[i].poi_type;this.inputs[i].poi_type=spare;--ii}if(this.contains_carpark){this.reversed_carpark=!this.reversed_carpark}this.submit()},setLocation:function(which,display_name,coords,carpark,poi_id,supress_palette_open){if(which=="via"&&poi_id&&this.inputs[this.inputs.length-2].poi_full_id==poi_id){return}if(which!="via"&&MMYell.RouteSearch.route){MMYell.RouteSearch.clear(true)}if($("#getDirections").hasClass("collapsed")&&!supress_palette_open){$("#getDirections h3 a").click()}for(var i=0,j=this.inputs.length;i<j;++i){var old_input=this.inputs[i];if(old_input.location&&old_input.location.coords&&old_input.location.coords.lat==coords.lat&&old_input.location.coords.lon==coords.lon&&old_input.location.address&&old_input.location.address.qs==display_name){if(old_input.is_via){var via_index_to_remove=i;old_input.jnode.remove()}else{old_input.reset()}old_input.poi_full_id=undefined}}if(via_index_to_remove){this.removeViaInput(via_index_to_remove)}var input,other;if(which=="from"){input=this.inputs[0]}else{if(which=="to"){input=this.inputs[this.inputs.length-1]}else{if(which=="via"){this.addViaInput(carpark);input=this.inputs[this.inputs.length-2];input.poi_full_id=poi_id}else{return}}}input.location=new MMLocation(coords);input.location.address=new MMAddress({qs:display_name});input.display_name=display_name;input.display_address=this.markerDisplay.address||null;input.display_town=this.markerDisplay.town||null;input.display_pc=this.markerDisplay.pc||null;input.display_telephone=this.markerDisplay.telephone||null;input.display_fax=this.markerDisplay.fax||null;input.poi_id=this.markerDisplay.id||null;input.poi_type=this.markerDisplay.type||null;input.qs.value=display_name;if(which=="via"){MMYell.UI.updateDirectionsButton("show")}if(document.getElementById("driving").checked==false&&document.getElementById("walking").checked==false){document.getElementById("driving").checked=true}},clear:function(leave_inputs){if(this.result){this.result.clearMap(MMYell.Mapviewer.map);this.result.clearList();this.result=null}$.each(MMYell.RouteSearch.inputs,function(i,n){if(leave_inputs){if(n.edit){n.edit.click()}n.jnode.find(".stepNo").remove()}else{if(i==0||i==MMYell.RouteSearch.inputs.length-1){n.editable(true);n.reset()}else{n.node.parentNode.removeChild(n.node)}}});if(!leave_inputs){this.add_via.style.display="block";this.via_inputs=0;this.contains_carpark=false;this.reversed_carpark=false;$("#infoboxVia").show();this.inputs=this.collectInputs()}this.route=null;MMYell.Mapviewer.map.handleEvent("routeCleared",this)},requestTraffic:function(){var me=this;if(!this.traffic_searcher){this.traffic_searcher=new MMSearchRequester(function(){me.result.insertTraffic(arguments[0])})}var search=new MMSearch();search.route=this.route;search.data_source="mm.clients.traffic_de,mm.clients.yell_poi_speed";search.max_distance=0.07;search.count=100;this.traffic_searcher.search(search)}};MMYell.RouteResult=function(_route){this.route=_route};MMYell.RouteResult.prototype={content1:false,content3:false,showOnMap:function(mapviewer){if(mapviewer.getMapType()==64){mapviewer.setMapType(4)}mapviewer.removeOverlay(MMYell.Mapviewer.marker);this.polyline=this.route.polyLine;var modes=MMYell.RouteSearch.route.mode.split(",");var merged=modes.length!=this.polyline.length;var polyline_i=0;var last_mode;for(var i=0,j=modes.length;i<j;++i){if(merged&&last_mode&&last_mode==modes[i]){continue}var color="#0038ba";var opacity=0.65;var thickness="1.1";if(modes[i]=="walking"){color="#255c00"}this.polyline[polyline_i].reset(null,{opacity:opacity,color:color,thickness:thickness});mapviewer.addOverlay(this.polyline[polyline_i]);++polyline_i;last_mode=modes[i]}var stages=this.route.stages;this.markers=[];var step_number=1;for(var i=0,j=stages.length;i<j;++i){for(var k=0,l=stages[i].steps.length;k<l;++k){var icon=this.getIcon("directions");if(step_number>99){var icon=this.getIcon("directions2")}var marker=mapviewer.createMarker(stages[i].steps[k].start_point,{text:step_number,icon:icon,zIndex:1,inert:true});this.markers.push(marker);++step_number}if(i==0){this.start_marker=mapviewer.createMarker(stages[i].start_point,{icon:this.getIcon("start"),zIndex:5,inert:true})}if(stages.length==i+1){this.end_marker=mapviewer.createMarker(stages[i].end_point,{icon:this.getIcon("finish"),zIndex:5,inert:true});mapviewer.removeOverlay(marker);mapviewer.removeOverlay(this.markers[0])}}var location=mapviewer.getAutoScaleLocation(this.route.bounds);mapviewer.goToPosition(location)},clearMap:function(mapviewer){if(this.markers){$.each(this.markers,function(i,n){mapviewer.removeOverlay(n)})}if(this.polyline){$.each(this.polyline,function(i,n){mapviewer.removeOverlay(n)})}if(this.yell_poi_speed_markers){$.each(this.yell_poi_speed_markers,function(i,n){mapviewer.removeOverlay(n)})}if(this.yell_poi_traffic_markers){$.each(this.yell_poi_traffic_markers,function(i,n){mapviewer.removeOverlay(n)})}mapviewer.removeOverlay(this.start_marker);mapviewer.removeOverlay(this.end_marker)},getIcon:function(name){if(this[name+"icon"]==null){this[name+"icon"]=new MMIcon("/client/yell/img/icons/"+name+".gif");this[name+"icon"].iconSize=(name=="directions2")?new MMDimensions(24,18):new MMDimensions(18,18);this[name+"icon"].iconAnchor=(name=="directions2")?new MMPoint(12,9):new MMPoint(9,9);this[name+"icon"].cssClass=(name=="directions2")?"MMMarker plus":"MMMarker"}return this[name+"icon"]},buildResults:function(container){var result=MMYell.RouteSearch.route;container.parent().addClass("results");var fromContainer=$("#directionsFrom");var cont=MMYell.RouteResult;var addVia=$("#addVia");$.each(result.stages,function(i,n){var inputs=MMYell.RouteSearch.inputs;var name=n.start_address.display_name||inputs[i].display_name||n.start_address.qs;inputs[i].editable(false,name);if(i==result.stages.length-1){name=n.end_address.display_name||inputs[i+1].display_name;inputs[i+1].editable(false,name)}});var rList=$(".routeSteps");if(cont.content1){cont.content1.remove()}if(rList.get(0)){rList.remove()}cont.content1=$('<div class="content" id="rSummary"></div>').prependTo(container.parent());var distance=$('<p id="routeDistance">Distance: '+result.distance.miles+" miles</p>").appendTo(cont.content1);var total_steps=this.getViaPointStep(result.stages.length);cont.content1.append('<p id="routeNoSteps">Steps: '+(total_steps-1)+"</p>");if(MMYell.RouteSearch.route.mode!="walking"){var warnings=$('<p id="routeWarnings"></p>').appendTo(cont.content1);warnings.append('<img src="img/icons/yell_poi_traffic.gif" alt="Traffic" /> ');warnings.append('<span id="warnings">Loading...</span>');var cameras=$('<p id="speedCameras"></p>').appendTo(cont.content1);cameras.append('<img src="img/icons/yell_poi_speed.gif" alt="Traffic" /> ');cameras.append('<span id="cameras">Loading...</span>')}var me=this;var step_number=1;var in_cc_zone=false;$.each(result.stages,function(i,n){var steps=$('<table class="routeSteps" cellspacing="0"></table>').insertAfter($(MMYell.RouteSearch.inputs[i].node));$.each(n.steps,function(k,m){var cc_zone="";if(result.mode.indexOf("driving")>-1){var info=n.steps[k].information;if(info){$.each(info,function(o,p){if(p.london_congestion_charge){cc_zone=" cc_"+p.london_congestion_charge;if(cc_zone!=" cc_"&&!in_cc_zone){var tr=$("<tr></tr>").appendTo(steps);tr.append('<td class="stepNo"><img class="routeIcon" alt="F" src="img/icons/cc_zone.gif"/></td>');tr.append('<td class="cc_description">Entering <a target="_blank" href="http://www.yell.com/yell/congestioncharge.html">congestion charge zone</a></td>');in_cc_zone=true}}})}}if((cc_zone==""||cc_zone==" cc_"||cc_zone==" cc_exiting")&&in_cc_zone){cc_zone=" cc_exiting";var tr=$("<tr></tr>").appendTo(steps);tr.append('<td class="stepNo"><img class="routeIcon" alt="F" src="img/icons/cc_zone_end.gif"/></td>');tr.append('<td class="cc_description">Leaving <a target="_blank" href="http://www.yell.com/yell/congestioncharge.html">congestion charge zone</a></td>');in_cc_zone=false}var tr=$("<tr></tr>").appendTo(steps);if(step_number==1){tr.append('<td class="stepNo"><img class="routeIcon" alt="" src="img/icons/start.gif"/></td>')}else{if(step_number==(total_steps-1)-(MMYell.RouteSearch.inputs.length-2)){tr.append('<td class="stepNo"><img class="routeIcon" alt="" src="img/icons/finish.gif"/></td>')}else{var sclass="";if(step_number>99){sclass=" plus"}tr.append('<td class="stepNo'+sclass+cc_zone+'"><span>'+step_number+"</span></td>")}}if(k==n.steps.length-1){tr.append('<td class="directions">'+m.instruction+"</td>")}else{tr.append('<td class="directions">'+m.instruction+" "+(m.road_name||m.road_number||"")+" "+(m.distance.miles!="0.00"?"and proceed for "+m.distance.miles+" miles.":"")+"</td>")}++step_number})});if(!cont.content3){cont.content3=$('<div class="content" id="rOptions"></div>').appendTo(container.parent());var routeOptions=$('<ul id="routeOptions"></ul>').appendTo(cont.content3);routeOptions.append('<li><img src="img/icons/maps_clear_icon.gif" alt="" /> <a href="#" onclick="MMYell.RouteSearch.clear(); return false;">Clear directions</a></li>');routeOptions.append('<li><img src="img/icons/maps_reverse_icon.gif" alt="" /> <a href="#" onclick="MMYell.RouteSearch.reverse(); return false;">Reverse these directions</a></li>');routeOptions.prepend($('<p id="bUpdateDir" class="raButton"><button type="submit">Update directions</button></p>'))}},getViaPointStep:function(via){var step=0;for(var i=0,j=this.route.stages.length;i<j;++i){step=step+this.route.stages[i].steps.length+1;if(i==via-1){return step}}},clearList:function(){var cont=MMYell.RouteResult;var rList=$("#rList");var rSteps=$(".routeSteps");rList.parent().removeClass("results");rSteps.remove();cont.content1.remove();cont.content1=false;cont.content3.remove();cont.content3=false;MMYell.UI.panelResize()},insertTraffic:function(results){var warnings=$("#warnings");var cameras=$("#cameras");if(results[0].total_record_count>0){var plural=results[0].total_record_count==1?"":"s";var warnings_link=$('<a href="#" id="warnings">'+results[0].total_record_count+" x travel warning"+plural+"</a>");warnings.replaceWith(warnings_link);this.buildTrafficList(results[0],warnings_link,"yell_poi_traffic",["direction_name","text"],true)}else{if(results[0].error){warnings.html("No data available").addClass("nodata")}else{warnings.html("Currently there are no traffic warnings").addClass("nodata")}}if(results[1].total_record_count>0){var plural=results[1].total_record_count==1?"":"s";var cameras_link=$('<a href="#" id="cameras">'+results[1].total_record_count+" x speed camera"+plural+"</a>");cameras.replaceWith(cameras_link);this.buildTrafficList(results[1],cameras_link,"yell_poi_speed","description")}else{$("#speedCameras").remove()}MMYell.UI.panelResize()},buildTrafficList:function(results,link,icon,field_name,list_required){var me=this;var map=MMYell.Mapviewer.map;var list_is_on=this[link+"on"];var update_omniture=true;link.click(function(){var markers;if(!list_is_on){if(list_required){if($(this).siblings("ul").size()==0){var ul=$('<ul id="warningList"></ul>');for(var i=0,j=results.records.length;i<j;++i){ul.append("<li>"+results.records[i].direction_name+". "+results.records[i].text+".</li>")}ul.insertAfter(link).hide()}$(this).siblings("ul").toggle()}if(MMYell.UI.print_route_info==""){MMYell.UI.print_route_info=(icon=="yell_poi_speed")?"&cameras=true":"&warnings=true"}markers=[];data_logger.logDatasource(results.dataSource,update_omniture);for(var i=0,j=results.records.length;i<j;++i){var mid=results.records[i].id||results.records[i].Id;data_logger.logUpdate(results.dataSource,mid,update_omniture);var marker=map.createMarker(results.records[i].point,{icon:me.getIcon(icon),zIndex:7});marker.getInfoBoxHTML=MMYell.LocalInformation.getInfoBoxFunction(results.dataSource,results.records[i]);markers.push(marker)}data_logger.completeUpdate(results.dataSource,update_omniture);update_omniture=false;me[icon+"_markers"]=markers;list_is_on=true}else{MMYell.UI.print_route_info="";markers=me[icon+"_markers"];for(var i=0,j=markers.length;i<j;++i){map.removeOverlay(me[icon+"_markers"][i])}$(this).siblings("ul").toggle();list_is_on=false}MMYell.UI.panelResize();return false})}};function YellLocalInformationWidget(){var MIN_ZOOM_FACTOR=15;var MAX_ZOOM_FACTOR=18;var MAX_ALLOWED_POIS=100;var IMG_DIR=window.MM_YELL_DOMAIN+"/client/yell/img/icons/";var FULLY_ZOOMED_IN=18;var LOCAL_BUSINESS=0;var LOCAL_INFORMATION=1;var TOTAL_DATASOURCES=0;var localBusinessOpen=false;var localInformationOpen=false;var localBusinessHidden=false;var localInformationHidden=false;var dsLookup={};dsLookup["mm.clients.yell.day_nurseries"]={icon:IMG_DIR+"yell_poi_daynursery.png",label:"company_name",type:LOCAL_BUSINESS};dsLookup["mm.clients.yell.dentists"]={icon:IMG_DIR+"yell_poi_dentist.png",label:"company_name",type:LOCAL_BUSINESS};dsLookup["mm.clients.yell.doctors"]={icon:IMG_DIR+"yell_poi_doctors.png",label:"company_name",type:LOCAL_BUSINESS};dsLookup["mm.clients.yell.estate_agents"]={icon:IMG_DIR+"yell_poi_estateagent.png",label:"company_name",type:LOCAL_BUSINESS};dsLookup["mm.clients.yell.florists"]={icon:IMG_DIR+"yell_poi_florist.png",label:"company_name",type:LOCAL_BUSINESS};dsLookup["mm.clients.yell.gyms"]={icon:IMG_DIR+"yell_poi_gyms.png",label:"company_name",type:LOCAL_BUSINESS};dsLookup["mm.clients.yell.hairdressers"]={icon:IMG_DIR+"yell_poi_hairdressers.png",label:"company_name",type:LOCAL_BUSINESS};dsLookup["mm.clients.yell.hotels"]={icon:IMG_DIR+"yell_poi_hotels.png",label:"company_name",type:LOCAL_BUSINESS};dsLookup["mm.clients.yell.pubs"]={icon:IMG_DIR+"yell_poi_pub.png",label:"company_name",type:LOCAL_BUSINESS};dsLookup["mm.clients.yell.restaurants"]={icon:IMG_DIR+"yell_poi_restaurant.png",label:"company_name",type:LOCAL_BUSINESS};dsLookup["mm.clients.yell_poi_car"]={icon:IMG_DIR+"yell_poi_car.png",label:"CarParkName",type:LOCAL_INFORMATION};dsLookup["mm.clients.yell_poi_cash"]={icon:IMG_DIR+"yell_poi_cash.png",label:"Name",type:LOCAL_INFORMATION};dsLookup["mm.clients.yell_poi_wifi"]={icon:IMG_DIR+"yell_poi_wifi.png",label:"site",type:LOCAL_INFORMATION};dsLookup["mm.clients.yell_poi_train"]={icon:IMG_DIR+"yell_poi_train.png",label:"Name",type:LOCAL_INFORMATION};dsLookup["mm.clients.yell_poi_speed"]={icon:IMG_DIR+"yell_poi_speed.png",label:"description",type:LOCAL_INFORMATION};dsLookup["mm.clients.yell_poi_blue"]={icon:IMG_DIR+"yell_poi_blue.png",label:"",type:LOCAL_INFORMATION};dsLookup["mm.clients.yell_poi_bike"]={icon:IMG_DIR+"yell_poi_bike.png",label:"name",type:LOCAL_INFORMATION};dsLookup["mm.clients.yell_poi_toilets"]={icon:IMG_DIR+"yell_poi_toilets.png",label:"name",type:LOCAL_INFORMATION};dsLookup["mm.clients.yell_poi_tube"]={icon:IMG_DIR+"yell_poi_tube.png",label:"stationname",type:LOCAL_INFORMATION};dsLookup["mm.clients.yell_poi_bus"]={icon:IMG_DIR+"yell_poi_bus.png",label:"name",type:LOCAL_INFORMATION};dsLookup["mm.clients.traffic_de"]={icon:IMG_DIR+"yell_poi_traffic.png",label:"name",type:LOCAL_INFORMATION};dsLookup["mm.clients.yell_poi_bikelock"]={icon:IMG_DIR+"yell_poi_bikelock.png",label:"name",type:LOCAL_INFORMATION};dsLookup["mm.clients.yell_poi_taxi"]={icon:IMG_DIR+"yell_poi_taxi.png",label:"name",type:LOCAL_INFORMATION};dsLookup["mm.clients.yell_poi_river"]={icon:IMG_DIR+"yell_poi_river.png",label:"name",type:LOCAL_INFORMATION};var mv;var datasources={};$(".localInformation input").parents("li").each(function(){var dsName=$(this).attr("class").replace(/-/g,".");dsName=jQuery.trim(dsName);datasources[dsName]={name:jQuery.trim(dsName),checked:false,count:0,markers:[]};TOTAL_DATASOURCES++}).end().filter(":checked").parents("li").each(function(){datasources[$(this).attr("class").replace(/-/g,".")].checked=true});function inZoomFactor(){return(mv.getZoomFactor()<MIN_ZOOM_FACTOR)?false:true}function getSelectedDatasources(data){var results=[];var hidden={};hidden[LOCAL_BUSINESS]=localBusinessHidden;hidden[LOCAL_INFORMATION]=localInformationHidden;$.each(datasources,function(i,n){if(!hidden[dsLookup[n.name].type]&&n.checked){results.push(n.name)}});return results}var getInfoBoxFunction=function(){var localBusiness=function(record){logMarkerClick(record);if(record.weblink!=""){var address="<h3><a onclick=\"MMYell_logClick('event2','CN:WL');\" href=\""+record.weblink+'">'+record.company_name+"</a></h3>"}else{var address="<h3>"+record.company_name+"</h3>"}address+="<p>"+record.address_1+", "+record.town+", "+record.pc+"</p>";address+="<p>Tel: <strong>"+record.telephone+"</strong>";address+=record.telephone_2!==""?("&nbsp;&nbsp;Fax: <strong>"+record.telephone_2+"</strong></p>"):"";address+='<ul class="ibOptions">';address+="<li><a onclick=\"MMYell_logClick('event6','SMS');\" href=\"http://www.yell.com/myyell/sendtomobile.do?sendType=mobile&natId="+record.nat_id+'">Send to mobile</a></li>';if(record.weblink!=""){address+="<li><a onclick=\"MMYell_logClick('event2','WL');\" href=\""+record.weblink+'">Website</a></li>'}if(record.email!=""){address+="<li><a onclick=\"MMYell_logClick('event4','EMAIL');\" href=\"http://www.yell.com/mel/mel.do?natId="+record.nat_id+'&sl=false">Email business</a></li>'}address+="<li><a onclick=\"MMYell_logClick('event5','ADDR');\" href=\"http://www.yell.com/myyell/savelisting.do?natId="+record.nat_id+'">Save listing</a></li>';address+="</ul>";var rOptions=getRouteHTML(record.company_name,record);var content=[new MMInfoBoxTab("Address",address+rOptions)];var details="";details+=record.text_1?"<p class='details'>"+record.text_1+"</p>":"";details+=record.text_2?"<p class='details'>"+record.text_2+"</p>":"";details+=record.text_3?"<p class='details'>"+record.text_3+"</p>":"";details+=record.text_4?"<p class='details'>"+record.text_4+"</p>":"";details+=record.text_5?"<p class='details'>"+record.text_5+"</p>":"";details+=record.text_6?"<p class='details'>"+record.text_6+"</p>":"";if(details!=""){details='<h3><a href="javascript:void(0);">'+record.company_name+"</a></h3>"+details;content.push(new MMInfoBoxTab("Details",details+rOptions))}return content};var nurseries=localBusiness;var dentists=localBusiness;var doctors=localBusiness;var estateAgents=localBusiness;var florists=localBusiness;var gyms=localBusiness;var hairdressers=localBusiness;var hotels=localBusiness;var pubs=localBusiness;var restaurants=localBusiness;var localInformation=function(record){var name=record.name||record.Name||record.CarParkName||record.description||record.stationname;var address="<h3>"+name+"</h3>";var rOptions=getRouteHTML(name,record);return[new MMInfoBoxTab("Details",address+rOptions)]};var trafficInformation=function(record){var html="<h3>Live traffic alert</h3>";html+="<p>"+record.direction_name+".</p>";html+="<p>"+record.text+".</p>";var rOptions=getRouteHTML("Live traffic alert",record);return[new MMInfoBoxTab("Details",html+rOptions)]};var wifiInformation=function(record){var address="<h3>"+record.site+"</h3>";address+="<p>"+record.street+record.technology!=""?" "+record.technology+"</p>":"";var rOptions=getRouteHTML(record.site,record);return[new MMInfoBoxTab("Details",address+rOptions)]};var busInformation=function(record){var address="<h3>"+record.name+"</h3>";address+="<p>Routes: "+record.routes+"</p>";var rOptions=getRouteHTML(record.name,record);return[new MMInfoBoxTab("Details",address+rOptions)]};var cars=function(record){var name=record.CarParkName;var address="<h3>"+name+"</h3>";if(record.Cost1H!=="0.00"){var prices="<p>1hr: &pound;"+record.Cost1H;prices+=", 2hr: &pound;"+record.Cost2H+"</p>";prices+="<p>4hr: &pound;"+record.Cost4H;prices+=", 8hr: &pound;"+record.Cost8H+"</p>"}else{var prices="No car park pricing available."}var rOptions=getRouteHTML(name,record,true);return[new MMInfoBoxTab("Details",address+prices+rOptions)]};var blue=function(record){var address="<h3>Blue Badge parking, "+record.parking_space+(record.parking_space==1?" space":" spaces")+"</h3>";var rOptions=getRouteHTML("Blue Badge parking",record,true);return[new MMInfoBoxTab("Details",address+rOptions)]};var bike=function(record){var address="<h3>"+record.name+"</h3>";var rOptions=getRouteHTML(record.name,record,true);return[new MMInfoBoxTab("Details",address+rOptions)]};var tube=function(record){var name=record.name||record.Name||record.CarParkName||record.description||record.stationname;var address="<h3>"+name+"</h3>";var rOptions=getRouteHTML(name,record);var stationHTML="";var lines=[{name:"bakerloo",title:"Bakerloo"},{name:"br",title:"National Rail"},{name:"central",title:"Central"},{name:"circle",title:"Circle"},{name:"east",title:"East London"},{name:"hammersmith",title:"Hammersmith &amp; City"},{name:"jubilee",title:"Jubilee"},{name:"metropolitan",title:"Metropolitan"},{name:"northern",title:"Northern"},{name:"piccadilly",title:"Piccadilly"},{name:"victoria",title:"Victoria"},{name:"waterloo",title:"Waterloo &amp; City"},{name:"district",title:"District"},{name:"dlr",title:"DLR"}];$.each(lines,function(i,n){if(record[n.name]!==""&&record[n.name]!==null){stationHTML+="<div class='tube "+n.name+"'>"+n.title+"</div>"}});return[new MMInfoBoxTab("Details",address+stationHTML+rOptions)]};var cash=localInformation;var wifi=wifiInformation;var train=localInformation;var speed=localInformation;var toilets=localInformation;var bus=busInformation;var traffic=trafficInformation;var bikelock=localInformation;var taxi=localInformation;var river=localInformation;function getRouteHTML(name,record,carpark){if(MMYell.page_type!=="mpm"){MMYell.RouteSearch.markerDisplay={};MMYell.RouteSearch.markerDisplay={address:record.address_1,town:record.town,pc:record.pc,telephone:record.telephone,fax:record.telephone_2,id:record.id,type:dsLookup[record["mm:datasource"]].type}}var poi_id=record["mm:datasource"]+":"+record.id;if(!carpark){carpark=false}var html="";if(MMYell.page_type!="mpm"){name=name.replace(new RegExp("'"),"\\'");html+='<div class="ibRouteOptions"><h4>Get directions</h4>';html+="<ul><li><a href=\"javascript:MMYell.RouteSearch.setLocation('to', '"+name+"', new MMLatLon("+record.point.lat+","+record.point.lon+'));">to here</a></li>';html+="<li><a href=\"javascript:MMYell.RouteSearch.setLocation('from','"+name+"', new MMLatLon("+record.point.lat+","+record.point.lon+'));">from here</a></li>';var via_class="on";if(MMYell.RouteSearch.via_inputs>=5){via_class="off"}html+='<li class="infoboxVia '+via_class+"\"><a href=\"javascript:MMYell.RouteSearch.setLocation('via', '"+name+"', new MMLatLon("+record.point.lat+","+record.point.lon+"), "+carpark.toString()+", '"+poi_id+"' );\">via here</a></li></ul></div>"}return html}return function(datasource,record){record["mm:datasource"]=datasource;switch(datasource){case"mm.clients.yell.day_nurseries":return function(){return nurseries(record)};break;case"mm.clients.yell.dentists":return function(){return dentists(record)};break;case"mm.clients.yell.doctors":return function(){return doctors(record)};break;case"mm.clients.yell.estate_agents":return function(){return estateAgents(record)};break;case"mm.clients.yell.florists":return function(){return florists(record)};break;case"mm.clients.yell.gyms":return function(){return gyms(record)};break;case"mm.clients.yell.hairdressers":return function(){return hairdressers(record)};break;case"mm.clients.yell.hotels":return function(){return hotels(record)};break;case"mm.clients.yell.pubs":return function(){return pubs(record)};break;case"mm.clients.yell.restaurants":return function(){return restaurants(record)};break;case"mm.clients.yell_poi_car":return function(){return cars(record)};break;case"mm.clients.yell_poi_cash":return function(){return cash(record)};break;case"mm.clients.yell_poi_wifi":return function(){return wifi(record)};break;case"mm.clients.yell_poi_train":return function(){return train(record)};break;case"mm.clients.yell_poi_speed":return function(){return speed(record)};break;case"mm.clients.yell_poi_blue":return function(){return blue(record)};break;case"mm.clients.yell_poi_bike":return function(){return bike(record)};break;case"mm.clients.yell_poi_toilets":return function(){return toilets(record)};break;case"mm.clients.yell_poi_tube":return function(){return tube(record)};break;case"mm.clients.yell_poi_bus":return function(){return bus(record)};break;case"mm.clients.traffic_de":return function(){return traffic(record)};break;case"mm.clients.yell_poi_bikelock":return function(){return bikelock(record)};break;case"mm.clients.yell_poi_taxi":return function(){return taxi(record)};break;case"mm.clients.yell_poi_river":return function(){return river(record)};break;default:return null;break}}}();function removeMarkers(name){$.each(datasources[name].markers,function(i,m){mv.removeOverlay(m.marker)});datasources[name].markers=[]}function removeOutOfBoundsMarkers(dsName,mapBounds){var results=[];$.each(datasources[dsName].markers,function(i,m){if(mapBounds.contains(m.point)){results.push(m)}else{mv.removeOverlay(m.marker)}});return results}function markerAlreadyAdded(dsName,id){for(var i=0,j=datasources[dsName].markers.length;i<j;i++){if(datasources[dsName].markers[i].id==id){return true}}return false}var s=new MMSearch();function searchForMarkers(dsQueryString){var ds=[].concat(dsQueryString||getSelectedDatasources());s.data_source="";$.each(ds,function(i,n){s.data_source+=n+","});var mapBounds=mv.getMapBounds();if(s.data_source!==""){var searcher=new MMSearchRequester(function(mb){var mapBounds=mb;return function(results){for(var i=0,j=results.length;i<j;i++){datasources[results[i].dataSource].markers=removeOutOfBoundsMarkers(results[i].dataSource,mapBounds);data_logger.logDatasource(results[i].dataSource);if(results[i].records&&results[i].total_record_count<=MAX_ALLOWED_POIS||mv.getZoomFactor()==FULLY_ZOOMED_IN){var existingMarkers=datasources[results[i].dataSource].markers.length;var markersAdded=0;for(var k=0,l=results[i].records.length;k<l;k++){var mid=results[i].records[k].id||results[i].records[k].Id;data_logger.logUpdate(results[i].dataSource,mid);if(!markerAlreadyAdded(results[i].dataSource,mid)){var record=results[i].records[k];var icon=new MMIcon(dsLookup[results[i].dataSource].icon);icon.iconSize=new MMDimensions(22,22);icon.iconAnchor=new MMPoint(9,9);icon.infoBoxAnchor=new MMPoint(9,9);icon.groupName="POI";var m=new MMMarkerOverlay(record.point,{label:dsLookup[results[i].dataSource].label!==""?record[dsLookup[results[i].dataSource].label]:"Blue Badge Parking",icon:icon});m.getInfoBoxHTML=getInfoBoxFunction(results[i].dataSource,record);mv.addOverlay(m);datasources[results[i].dataSource].markers.push({id:mid,marker:m,point:record.point});if((localInformationHidden&&dsLookup[results[i].dataSource].type==LOCAL_INFORMATION)||(localBusinessHidden&&dsLookup[results[i].dataSource].type==LOCAL_BUSINESS)){m.setVisibility(false)}markersAdded++}}if((map_move==0)&&(map_type_changed==0)&&(map_isBE!==256)){if(map_zoom!==1){data_logger.completeUpdate(results[i].dataSource)}}}else{if(results[i].total_record_count>MAX_ALLOWED_POIS&&mv.getZoomFactor()!=FULLY_ZOOMED_IN){removeMarkers(results[i].dataSource)}}}if(((map_move==1)||(map_zoom==1))&&(map_type_changed!==1)){data_logger.logOmniture()}window.datasources=datasources;map_move=0;map_zoom=0;map_type_changed=0}}(mapBounds));s.format="normal";s.count=MAX_ALLOWED_POIS*10;s.bounding_box=mapBounds;searcher.search(s)}}var countSearch=new MMSearch();var countSearcher=new MMSearchRequester(function(results){if(inZoomFactor()){for(var i=0,j=results.length;i<j;i++){var node=$("li."+results[i].dataSource.replace(/\./g,"-"));node.find("span.count").html("("+(results[i].total_record_count||0)+")").end().find("div.zoomError").remove();if(results[i].total_record_count===0||results[i].total_record_count>MAX_ALLOWED_POIS&&mv.getZoomFactor()!=FULLY_ZOOMED_IN){if(node.parents("#localInfo").get(0)&&results[i].total_record_count===0){node.hide()}else{node.find("input").attr("disabled","disabled").end().find("label").addClass("outOfZoom");if(results[i].total_record_count>MAX_ALLOWED_POIS){node.find("label").append("<div class='zoomError'><span class='zoomErrorHighlight'>Please <a href='javascript:void(0);' class='individualZoom'>zoom in</a></span> to narrow your search</div>")}}}else{node.show().find("input").removeAttr("disabled").end().find("label").removeClass("outOfZoom")}}$("a.individualZoom").click(function(){$(this).parents("div.zoomError").siblings("input").attr("checked",true);datasources[jQuery.trim($(this).parents("li").attr("class").replace(/-/g,"."))].checked=true;mv.setZoomFactor(mv.getZoomFactor()==MAX_ZOOM_FACTOR?MAX_ZOOM_FACTOR:mv.getZoomFactor()+1);return false});searchForMarkers();MMYell.UI.panelResize()}});function searchForCount(){countSearch.data_source="";for(var ds in datasources){ds=jQuery.trim(ds);countSearch.data_source+=ds+","}countSearch.format="compact";countSearch.bounding_box=mv.getMapBounds();countSearcher.search(countSearch)}function datasourcesSelected(sourceType){var found=false;$.each(datasources,function(i,n){if(dsLookup[n.name].type==sourceType&&n.checked===true){found=true}});return found}function toggleMarkers(markerType,state){if(markerType==LOCAL_BUSINESS){localBusinessHidden=!state}else{if(markerType==LOCAL_INFORMATION){localInformationHidden=!state}}$.each(datasources,function(i,datasource){if(dsLookup[datasource.name].type===markerType){$.each(datasource.markers,function(j,m){m.marker.setVisibility(state)})}})}function showHideOnMapToggle(){if(inZoomFactor()){if(MMYell.LocalInformation.localInformationSelected()&&!localInformationOpen){if($("#localInfo h3 a.onMap").size()!==0){$("#localInfo h3 a.onMap").show()}else{$("#localInfo h3").append('<a href="javascript:void(0);" class="onMap">Hide on map</a>').find("a.onMap").click(function(){if(!arguments.callee.showMessage){arguments.callee.showMessage=false}arguments.callee.showMessage=!arguments.callee.showMessage;if(arguments.callee.showMessage===true){toggleMarkers(LOCAL_INFORMATION,false);$(this).text("Show on map")}else{toggleMarkers(LOCAL_INFORMATION,true);$(this).text("Hide on map")}})}}if(MMYell.LocalInformation.localBusinessSelected()&&!localBusinessOpen){if($("#localBusinesses h3 a.onMap").size()!==0){$("#localBusinesses h3 a.onMap").show()}else{$("#localBusinesses h3").append('<a href="javascript:void(0);" class="onMap">Hide on map</a>').find("a.onMap").click(function(){if(!arguments.callee.showMessage){arguments.callee.showMessage=false}arguments.callee.showMessage=!arguments.callee.showMessage;if(arguments.callee.showMessage===true){toggleMarkers(LOCAL_BUSINESS,false);$(this).text("Show on map")}else{toggleMarkers(LOCAL_BUSINESS,true);$(this).text("Hide on map")}})}}if(localInformationOpen){$("#localInfo h3 a.onMap").remove();toggleMarkers(LOCAL_INFORMATION,true)}else{if(localBusinessOpen){$("#localBusinesses h3 a.onMap").remove();toggleMarkers(LOCAL_BUSINESS,true)}}}else{$("a.onMap").hide()}}return{setMapviewer:function(m){mv=m},addDataSource:function(name){name=jQuery.trim(name.replace(/-/g,"."));datasources[name].checked=true;searchForMarkers(name)},removeDataSource:function(name){name=jQuery.trim(name.replace(/-/g,"."));datasources[name].checked=false;removeMarkers(name)},update:function(){if(inZoomFactor()){searchForCount()}else{$.each(getSelectedDatasources(),function(i,n){removeMarkers(n)})}},zoomMap:function(){if(inZoomFactor()){$(".zoomMessage").addClass("off");$(".localInformation li input").removeAttr("disabled").siblings("span.count").removeClass("off");showHideOnMapToggle()}else{$(".zoomMessage").removeClass("off");$(".localInformation li").show().find("input").attr("disabled","disabled").siblings("span.count").addClass("off").end().end().find("label").removeClass("outOfZoom").end().find("div.zoomError").remove();showHideOnMapToggle()}this.update()},zoomToMinimum:function(){mv.zoom(MIN_ZOOM_FACTOR-mv.getZoomFactor())},localInformationSelected:function(){return datasourcesSelected(LOCAL_INFORMATION)},localBusinessSelected:function(){return datasourcesSelected(LOCAL_BUSINESS)},markerClick:function(marker){marker.setInfoBoxContent(marker.getInfoBoxHTML(),{min_width:260,className:"yellInfoBox"});marker.openInfoBox()},drawerOpened:function(openingDrawerId,closingDrawerId){if(closingDrawerId===undefined){if(openingDrawerId=="localInfo"){localInformationOpen=true}else{if(openingDrawerId=="localBusinesses"){localBusinessOpen=true}}}else{if(openingDrawerId===closingDrawerId){if(closingDrawerId=="localInfo"){localInformationOpen=false}else{if(closingDrawerId=="localBusinesses"){localBusinessOpen=false}}}else{if(openingDrawerId=="localInfo"){localInformationOpen=true}else{if(openingDrawerId=="localBusinesses"){localBusinessOpen=true}}if(closingDrawerId=="localInfo"){localInformationOpen=false}else{if(closingDrawerId=="localBusinesses"){localBusinessOpen=false}}}}showHideOnMapToggle()},selectedDatasources:function(){return getSelectedDatasources()},getInfoBoxFunction:function(datasource,record){return getInfoBoxFunction(datasource,record)}}}MMYell.Loader={init:function(){var map=MMYell.Mapviewer.map;var me=this;map.addEventHandler("requestStart",function(){me.show()});map.addEventHandler("requestEnd",function(){me.hide()});var loader=new Image();loader.src="http://www.multimap.com/client/yell/img/loading.gif"},show:function(){if(!this.loader){this.tpos=$("#mapviewer > div:eq(2)");this.loader=$('<div id="loading"><p>loading...</p></div>')}this.loader.appendTo(this.tpos)},hide:function(){this.loader.remove()}};MMYell.MPM={markers:[],tab1_name:"Address",tab2_name:"Details",tab3_name:"Photos",init:function(){document.getElementById("localInfo").className="drawer collapsed";document.getElementById("MMoblique").className="MM_WORLD_BIRDSEYE";has_start=false;if(locations[0].startpoint){has_start=true}this.locations_to_geocode=[];this.locations_to_convert=[];for(var i=0,j=locations.length;i<j;++i){if(locations[i].pc!=""&&locations[i].pc!=undefined){locations[i].has_pc=true;this.locations_to_geocode.push(new MMAddress({postal_code:locations[i].pc,country_code:"GB"}))}else{if(!locations[i].pc&&locations[i].x>0){locations[i].has_xy=true;this.locations_to_convert.push(new MMPoint(locations[i].x,locations[i].y))}else{locations[i].has_nothing=true}}}var me=this;bulk_geocoder=new MMGeocoder(function(results){me.geocodeResultLoaded(results)});bulk_geocoder.geocode(this.locations_to_geocode)},geocodeResultLoaded:function(results){if(this.locations_to_convert.length>0){var converts_required=true}for(var i=0,j=locations.length;i<j;++i){if(locations[i].has_pc){var geocoded_location=results.shift();if(geocoded_location[0]){locations[i].coords=geocoded_location[0].coords;if(!converts_required){this.addLocToMap(locations[i],i)}}}}if(converts_required){var me=this;converter=new MMConverter(function(results){me.convertResultsLoaded(results)});converter.convert(this.locations_to_convert,"gb")}else{MMYell.Mapviewer.map.goToPosition(MMYell.Mapviewer.map.getAutoScaleLocation(this.markers))}},convertResultsLoaded:function(results){for(var i=0,j=locations.length;i<j;++i){if(locations[i].has_xy){var converted_location=results.shift();locations[i].coords=converted_location.coords?converted_location.coords:null}this.addLocToMap(locations[i],i)}MMYell.Mapviewer.map.goToPosition(MMYell.Mapviewer.map.getAutoScaleLocation(this.markers))},addLocToMap:function(loc,num){if(loc.coords){var point=this.createResultMarker(loc,num);this.markers.push(point)}},createResultMarker:function(loc,num){var marker;var start=false;var lat=loc.coords.lat;var lon=loc.coords.lon;var name=loc.name;var street=loc.address;if((loc.info=="bullet"||loc.info=="free")&&loc.details.length>0){var hastabs=true}if((loc.photolnkurl)&&(loc.photolnkurl!="")){var hasphoto=true}if(has_start==true){if(num=="0"){var icon=new MMIcon(window.MM_YELL_DOMAIN+"/share/yell_poi/img/mapIcon_x.gif");icon.iconSize=new MMDimensions(18,22);icon.iconAnchor=new MMPoint(9,22);marker=this.createMarker(new MMLatLon(lat,lon),"","",icon,"","")}else{var icon=new MMIcon(window.MM_YELL_DOMAIN+"/client/yell/img/icons/listing_blank.png");icon.iconSize=new MMDimensions(19,22);icon.iconAnchor=new MMPoint(8,22);if(hastabs&&hasphoto){var tab1_content=buildTabsContent(loc,"1",num);var tab2_content=buildTabsContent(loc,"2",num);var tab3_content=buildTabsContent(loc,"3",num);var boxcontent=[new MMInfoBoxTab(this.tab1_name,tab1_content),new MMInfoBoxTab(this.tab2_name,tab2_content),new MMInfoBoxTab(this.tab3_name,tab3_content),]}else{if(hastabs&&!hasphoto){var tab1_content=buildTabsContent(loc,"1",num);var tab2_content=buildTabsContent(loc,"2",num);var boxcontent=[new MMInfoBoxTab(this.tab1_name,tab1_content),new MMInfoBoxTab(this.tab2_name,tab2_content),]}else{var boxcontent=buildTabsContent(loc,"1",num)}}marker=this.createMarker(new MMLatLon(lat,lon),boxcontent,num,icon,name,"")}}else{num=num+1;var icon=new MMIcon(window.MM_YELL_DOMAIN+"/client/yell/img/icons/listing_blank.png");icon.iconSize=new MMDimensions(28,37);icon.iconAnchor=new MMPoint(14,37);if(hastabs&&hasphoto){var tab1_content=buildTabsContent(loc,"1",num);var tab2_content=buildTabsContent(loc,"2",num);var tab3_content=buildTabsContent(loc,"3",num);var boxcontent=[new MMInfoBoxTab(this.tab1_name,tab1_content),new MMInfoBoxTab(this.tab2_name,tab2_content),new MMInfoBoxTab(this.tab3_name,tab3_content),]}else{if(hastabs&&!hasphoto){var tab1_content=buildTabsContent(loc,"1",num);var tab2_content=buildTabsContent(loc,"2",num);var boxcontent=[new MMInfoBoxTab(this.tab1_name,tab1_content),new MMInfoBoxTab(this.tab2_name,tab2_content),]}else{var boxcontent=buildTabsContent(loc,"1",num)}}marker=this.createMarker(new MMLatLon(lat,lon),boxcontent,num,icon,name,"")}return marker},createMarker:function(location,boxcontent,num,icon,label,classname){var marker=MMYell.Mapviewer.map.createMarker(location,{text:num,label:label,icon:icon});if(num>"0"){marker.setInfoBoxContent(boxcontent,{className:"mpmInfoBox"})}return marker},unFocus:function(o){if(o.firstTime){return}o.firstTime=true;o.value=""}};MMYell.Header={init:function(){var map=MMYell.Mapviewer.map;var me=this;map.addEventHandler("locationShown",function(type,searcher){me.update("Map of "+searcher.input.display_name)});map.addEventHandler("routeShown",function(type,searcher){var title="Route from "+searcher.inputs[0].display_name+" to "+searcher.inputs[searcher.inputs.length-1].display_name;me.update(title)});map.addEventHandler("routeCleared",function(){me.update("Map of United Kingdom")})},update:function(title){if(!this.container){this.container=document.getElementById("mapInfo").getElementsByTagName("h2")[0]}this.container.innerHTML=title}};var MM_OMNITURE_TIMEOUT=0;var MM_ARRAY_MAX_SIZE=500;var MM_OMNITURE_NEW_POI_PERCENT=51;var MM_OMNITURE_TEST="http://www.yellqatest.com/js/omniture-H.2.js";var MM_OMNITURE_LIVE="http://www.yell.com/js/omniture-H.2.js";var MM_TEST_URLS="yellqa yellqa01 yellqa02";var MM_WINDOW_HOST=(function(){try{return window.location.host.match(/[^\.][a-z0-9]+\.multimap\.com/i)[0].split(".")[0]}catch(e){}})();var MM_OMNITURE_FILE=(function(){if(MM_WINDOW_HOST&&(" "+MM_TEST_URLS+" ").indexOf(" "+MM_WINDOW_HOST+" ")>-1){return MM_OMNITURE_TEST}return MM_OMNITURE_LIVE})();function MMOmniture(){this.display_pool={};this.fresh_data={};this.data_strings={};this.request_timeouts={};this.visible_data={}}MMOmniture.prototype.logDatasource=function(data_source,update){if(typeof update!="undefined"&&update==false){return false}this.cancelRequest(data_source);if(!this.display_pool[data_source]){this.display_pool[data_source]=[]}this.data_strings[data_source]=" "+this.display_pool[data_source].join(" ")+" ";this.fresh_data[data_source]=0;this.visible_data[data_source]=0};MMOmniture.prototype.logUpdate=function(data_source,data_id,update){if(typeof update!="undefined"&&update==false){return false}if(!this.dataInArray(this.data_strings[data_source],data_id)){if(this.display_pool[data_source].length>MM_ARRAY_MAX_SIZE){this.display_pool[data_source].shift()}this.display_pool[data_source].push(data_id);this.fresh_data[data_source]++}this.visible_data[data_source]++};MMOmniture.prototype.getDatasourceInfo=function(data_source){var visible=this.visible_data[data_source];var fresh=this.fresh_data[data_source];var percentage_new=parseInt((fresh/visible)*100);if(isNaN(percentage_new)){percentage_new=0}var greater_than=(percentage_new>MM_OMNITURE_NEW_POI_PERCENT?true:false);return{visible:visible||0,fresh:fresh||0,percentage:percentage_new,greater_than:greater_than}};MMOmniture.prototype.completeUpdate=function(data_source,update){if(typeof update!="undefined"&&update==false){return false}this.sendRequest(data_source)};MMOmniture.prototype.cancelRequest=function(data_source){if(this.request_timeouts[data_source]){clearTimeout(this.request_timeouts[data_source])}};MMOmniture.prototype.logOmniture=function(data_source){var me=this;if((data_source=="")||(data_source==undefined)){var sd=MMYell.LocalInformation.selectedDatasources();var ds=new Array();for(var i=0;i<sd.length;i++){var data=me.getDatasourceInfo(sd[i]);if(data.visible>0){ds.push(sd[i].replace(/.*\./g,""))}}if(ds.length<1){return}}else{if(this.activeRequest){setTimeout(function(){me.logOmniture(data_source)},100)}else{this.activeRequest=true;var data=me.getDatasourceInfo(data_source);var ds=data_source.replace(/.*\./g,"")}}s.events="event22:"+Math.floor(Math.random()*100000000000000);s.prop33=ds;if((ds!==undefined)&&(ds!=="")){s.t()}setTimeout(function(){me.activeRequest=false},2000)};MMOmniture.prototype.sendRequest=function(data_source){var me=this;this.request_timeouts[data_source]=setTimeout(function(){me.logOmniture(data_source)},MM_OMNITURE_TIMEOUT)};MMOmniture.prototype.dataInArray=function(data_string,data_id){return data_string.indexOf(" "+data_id+" ")>-1};[(function($){var height=$.fn.height,width=$.fn.width;$.fn.extend({height:function(){if(!this[0]){error()}if(this[0]==window){if($.browser.opera||($.browser.safari&&parseInt($.browser.version)>520)){return self.innerHeight-(($(document).height()>self.innerHeight)?getScrollbarWidth():0)}else{if($.browser.safari){return self.innerHeight}else{return $.boxModel&&document.documentElement.clientHeight||document.body.clientHeight}}}if(this[0]==document){return Math.max(($.boxModel&&document.documentElement.scrollHeight||document.body.scrollHeight),document.body.offsetHeight)}return height.apply(this,arguments)},width:function(){if(!this[0]){error()}if(this[0]==window){if($.browser.opera||($.browser.safari&&parseInt($.browser.version)>520)){return self.innerWidth-(($(document).width()>self.innerWidth)?getScrollbarWidth():0)}else{if($.browser.safari){return self.innerWidth}else{return $.boxModel&&document.documentElement.clientWidth||document.body.clientWidth}}}if(this[0]==document){if($.browser.mozilla){var scrollLeft=self.pageXOffset;self.scrollTo(99999999,self.pageYOffset);var scrollWidth=self.pageXOffset;self.scrollTo(scrollLeft,self.pageYOffset);return document.body.offsetWidth+scrollWidth}else{return Math.max((($.boxModel&&!$.browser.safari)&&document.documentElement.scrollWidth||document.body.scrollWidth),document.body.offsetWidth)}}return width.apply(this,arguments)},innerHeight:function(){if(!this[0]){error()}return this[0]==window||this[0]==document?this.height():this.is(":visible")?this[0].offsetHeight-num(this,"borderTopWidth")-num(this,"borderBottomWidth"):this.height()+num(this,"paddingTop")+num(this,"paddingBottom")},innerWidth:function(){if(!this[0]){error()}return this[0]==window||this[0]==document?this.width():this.is(":visible")?this[0].offsetWidth-num(this,"borderLeftWidth")-num(this,"borderRightWidth"):this.width()+num(this,"paddingLeft")+num(this,"paddingRight")},outerHeight:function(options){if(!this[0]){error()}options=$.extend({margin:false},options||{});return this[0]==window||this[0]==document?this.height():this.is(":visible")?this[0].offsetHeight+(options.margin?(num(this,"marginTop")+num(this,"marginBottom")):0):this.height()+num(this,"borderTopWidth")+num(this,"borderBottomWidth")+num(this,"paddingTop")+num(this,"paddingBottom")+(options.margin?(num(this,"marginTop")+num(this,"marginBottom")):0)},outerWidth:function(options){if(!this[0]){error()}options=$.extend({margin:false},options||{});return this[0]==window||this[0]==document?this.width():this.is(":visible")?this[0].offsetWidth+(options.margin?(num(this,"marginLeft")+num(this,"marginRight")):0):this.width()+num(this,"borderLeftWidth")+num(this,"borderRightWidth")+num(this,"paddingLeft")+num(this,"paddingRight")+(options.margin?(num(this,"marginLeft")+num(this,"marginRight")):0)},scrollLeft:function(val){if(!this[0]){error()}if(val!=undefined){return this.each(function(){if(this==window||this==document){window.scrollTo(val,$(window).scrollTop())}else{this.scrollLeft=val}})}if(this[0]==window||this[0]==document){return self.pageXOffset||$.boxModel&&document.documentElement.scrollLeft||document.body.scrollLeft}return this[0].scrollLeft},scrollTop:function(val){if(!this[0]){error()}if(val!=undefined){return this.each(function(){if(this==window||this==document){window.scrollTo($(window).scrollLeft(),val)}else{this.scrollTop=val}})}if(this[0]==window||this[0]==document){return self.pageYOffset||$.boxModel&&document.documentElement.scrollTop||document.body.scrollTop}return this[0].scrollTop},position:function(returnObject){return this.offset({margin:false,scroll:false,relativeTo:this.offsetParent()},returnObject)},offset:function(options,returnObject){if(!this[0]){error()}var x=0,y=0,sl=0,st=0,elem=this[0],parent=this[0],op,parPos,elemPos=$.css(elem,"position"),mo=$.browser.mozilla,ie=$.browser.msie,oa=$.browser.opera,sf=$.browser.safari,sf3=$.browser.safari&&parseInt($.browser.version)>520,absparent=false,relparent=false,options=$.extend({margin:true,border:false,padding:false,scroll:true,lite:false,relativeTo:document.body},options||{});if(options.lite){return this.offsetLite(options,returnObject)}if(options.relativeTo.jquery){options.relativeTo=options.relativeTo[0]}if(elem.tagName=="BODY"){x=elem.offsetLeft;y=elem.offsetTop;if(mo){x+=num(elem,"marginLeft")+(num(elem,"borderLeftWidth")*2);y+=num(elem,"marginTop")+(num(elem,"borderTopWidth")*2)}else{if(oa){x+=num(elem,"marginLeft");y+=num(elem,"marginTop")}else{if((ie&&jQuery.boxModel)){x+=num(elem,"borderLeftWidth");y+=num(elem,"borderTopWidth")}else{if(sf3){x+=num(elem,"marginLeft")+num(elem,"borderLeftWidth");y+=num(elem,"marginTop")+num(elem,"borderTopWidth")}}}}}else{do{parPos=$.css(parent,"position");x+=parent.offsetLeft;y+=parent.offsetTop;if((mo&&!parent.tagName.match(/^t[d|h]$/i))||ie||sf3){x+=num(parent,"borderLeftWidth");y+=num(parent,"borderTopWidth");if(mo&&parPos=="absolute"){absparent=true}if(ie&&parPos=="relative"){relparent=true}}op=parent.offsetParent||document.body;if(options.scroll||mo){do{if(options.scroll){sl+=parent.scrollLeft;st+=parent.scrollTop}if(oa&&($.css(parent,"display")||"").match(/table-row|inline/)){sl=sl-((parent.scrollLeft==parent.offsetLeft)?parent.scrollLeft:0);st=st-((parent.scrollTop==parent.offsetTop)?parent.scrollTop:0)}if(mo&&parent!=elem&&$.css(parent,"overflow")!="visible"){x+=num(parent,"borderLeftWidth");y+=num(parent,"borderTopWidth")}parent=parent.parentNode}while(parent!=op)}parent=op;if(parent==options.relativeTo&&!(parent.tagName=="BODY"||parent.tagName=="HTML")){if(mo&&parent!=elem&&$.css(parent,"overflow")!="visible"){x+=num(parent,"borderLeftWidth");y+=num(parent,"borderTopWidth")}if(((sf&&!sf3)||oa)&&parPos!="static"){x-=num(op,"borderLeftWidth");y-=num(op,"borderTopWidth")}break}if(parent.tagName=="BODY"||parent.tagName=="HTML"){if(((sf&&!sf3)||(ie&&$.boxModel))&&elemPos!="absolute"&&elemPos!="fixed"){x+=num(parent,"marginLeft");y+=num(parent,"marginTop")}if(sf3||(mo&&!absparent&&elemPos!="fixed")||(ie&&elemPos=="static"&&!relparent)){x+=num(parent,"borderLeftWidth");y+=num(parent,"borderTopWidth")}break}}while(parent)}var returnValue=handleOffsetReturn(elem,options,x,y,sl,st);if(returnObject){$.extend(returnObject,returnValue);return this}else{return returnValue}},offsetLite:function(options,returnObject){if(!this[0]){error()}var x=0,y=0,sl=0,st=0,parent=this[0],offsetParent,options=$.extend({margin:true,border:false,padding:false,scroll:true,relativeTo:document.body},options||{});if(options.relativeTo.jquery){options.relativeTo=options.relativeTo[0]}do{x+=parent.offsetLeft;y+=parent.offsetTop;offsetParent=parent.offsetParent||document.body;if(options.scroll){do{sl+=parent.scrollLeft;st+=parent.scrollTop;parent=parent.parentNode}while(parent!=offsetParent)}parent=offsetParent}while(parent&&parent.tagName!="BODY"&&parent.tagName!="HTML"&&parent!=options.relativeTo);var returnValue=handleOffsetReturn(this[0],options,x,y,sl,st);if(returnObject){$.extend(returnObject,returnValue);return this}else{return returnValue}},offsetParent:function(){if(!this[0]){error()}var offsetParent=this[0].offsetParent;while(offsetParent&&(offsetParent.tagName!="BODY"&&$.css(offsetParent,"position")=="static")){offsetParent=offsetParent.offsetParent}return $(offsetParent)}});var error=function(){throw"Dimensions: jQuery collection is empty"};var num=function(el,prop){return parseInt($.css(el.jquery?el[0]:el,prop))||0};var handleOffsetReturn=function(elem,options,x,y,sl,st){if(!options.margin){x-=num(elem,"marginLeft");y-=num(elem,"marginTop")}if(options.border&&(($.browser.safari&&parseInt($.browser.version)<520)||$.browser.opera)){x+=num(elem,"borderLeftWidth");y+=num(elem,"borderTopWidth")}else{if(!options.border&&!(($.browser.safari&&parseInt($.browser.version)<520)||$.browser.opera)){x-=num(elem,"borderLeftWidth");y-=num(elem,"borderTopWidth")}}if(options.padding){x+=num(elem,"paddingLeft");y+=num(elem,"paddingTop")}if(options.scroll&&(!$.browser.opera||elem.offsetLeft!=elem.scrollLeft&&elem.offsetTop!=elem.scrollLeft)){sl-=elem.scrollLeft;st-=elem.scrollTop}return options.scroll?{top:y-st,left:x-sl,scrollTop:st,scrollLeft:sl}:{top:y,left:x}};var scrollbarWidth=0;var getScrollbarWidth=function(){if(!scrollbarWidth){var testEl=$("<div>").css({width:100,height:100,overflow:"auto",position:"absolute",top:-1000,left:-1000}).appendTo("body");scrollbarWidth=100-testEl.append("<div>").find("div").css({width:"100%",height:200}).width();testEl.remove()}return scrollbarWidth}})(jQuery)];/* Code contained in this file below this point is subject to the following licensing:
 * Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-08-17 13:14:11 -0500 (Fri, 17 Aug 2007) $
 * $Rev: 2759 $
 *
 * Version: 1.1.2
 *
 * Requires: jQuery 1.1.3+
 */
