#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.17379
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Microsoft.Web.Helpers
{
    using System;
    using System.Collections.Generic;
    
    #line 3 "Maps.cshtml"
    using System.Diagnostics;
    
    #line default
    #line hidden
    
    #line 6 "Maps.cshtml"
    using System.Globalization;
    
    #line default
    #line hidden
    using System.IO;
    using System.Linq;
    using System.Net;
    using System.Text;
    using System.Web;
    using System.Web.Helpers;
    using System.Web.Security;
    using System.Web.UI;
    
    #line 5 "Maps.cshtml"
    using System.Web.UI.WebControls;
    
    #line default
    #line hidden
    using System.Web.WebPages;
    using System.Web.WebPages.Html;
    
    #line 4 "Maps.cshtml"
    using System.Web.WebPages.Scope;
    
    #line default
    #line hidden
    
    #line 7 "Maps.cshtml"
    using Microsoft.Internal.Web.Utils;
    
    #line default
    #line hidden
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.3.2.0")]
    public class Maps : System.Web.WebPages.HelperPage
    {
        
        #line 9 "Maps.cshtml"

    private const string DefaultWidth = "300px";
    private const string DefaultHeight = "300px";
    private static readonly object _mapIdKey = new object();
    private static readonly object _mapQuestApiKey = new object();
    private static readonly object _bingApiKey = new object();
    private static readonly object _yahooApiKey = new object();

    public static string MapQuestApiKey {
        get {
            return (string)ScopeStorage.CurrentScope[_mapQuestApiKey];
        }
        set {
            ScopeStorage.CurrentScope[_mapQuestApiKey] = value;
        }
    }

    public static string YahooApiKey {
        get {
            return (string)ScopeStorage.CurrentScope[_yahooApiKey];
        }
        set {
            ScopeStorage.CurrentScope[_yahooApiKey] = value;
        }
    }

    public static string BingApiKey {
        get {
            return (string)ScopeStorage.CurrentScope[_bingApiKey];
        }
        set {
            ScopeStorage.CurrentScope[_bingApiKey] = value;
        }
    }
    
    private static int MapId {
         get {
            var value = (int?)HttpContext.Current.Items[_mapIdKey];
            return value ?? 0;
        }
        set {
            HttpContext.Current.Items[_mapIdKey] = value;
        }
    }
    
    private static string GetMapElementId() {
        return "map_" + MapId;   
    }
    
    private static string TryParseUnit(string value, string defaultValue) {
        if (String.IsNullOrEmpty(value)) {
            return defaultValue;
        }
        try {
            return Unit.Parse(value, CultureInfo.InvariantCulture).ToString(CultureInfo.InvariantCulture);
        } catch (ArgumentException) {
            return defaultValue;    
        }    
    }

    private static IHtmlString RawJS(string text) {
        return Raw(HttpUtility.JavaScriptStringEncode(text));
    }
    
    private static IHtmlString Raw(string text) {
        return new HtmlString(text);    
    }
    
    private static string GetApiKey(string apiKey, object scopeStorageKey) {
        if (apiKey.IsEmpty()) {
            return (string)ScopeStorage.CurrentScope[scopeStorageKey];   
        }
        return apiKey;   
    }

    public class MapLocation {
        private readonly string _latitude;
        private readonly string _longitude;
        public MapLocation(string latitude, string longitude) {
            _latitude = latitude;
            _longitude = longitude;
        }

        public string Latitude {
            get { return _latitude; }
        }

        public string Longitude {
            get { return _longitude; }
        }
    }

    internal static string GetDirectionsQuery(string location, string latitude, string longitude, Func<string, string> encoder = null) {
        encoder = encoder ?? HttpUtility.UrlEncode;
        Debug.Assert(!(location.IsEmpty() && latitude.IsEmpty() && longitude.IsEmpty()));
        if (location.IsEmpty()) {
            return encoder(latitude + "," + longitude);
        }
        return encoder(location);
    }

        #line default
        #line hidden

public static System.Web.WebPages.HelperResult GetMapQuestHtml(string key = null, string location = null, string latitude = null, string longitude = null, string width = "300px", string height = "300px", int zoom = 7, string type = "map",
            bool showDirectionsLink = true, string directionsLinkText = "Get Directions", bool showZoomControl = true, IEnumerable<MapLocation> pushpins = null) {
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {



#line 136 "Maps.cshtml"
                                                                                                                                                                  
    key = GetApiKey(key, _mapQuestApiKey);
    if (key.IsEmpty()) {
        throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "key");  
    }
    
    string mapElement = GetMapElementId();
    string loc = "null"; // We want to print the value 'null' in the client
    if (latitude != null && longitude != null) {
        loc = String.Format(CultureInfo.InvariantCulture, "{{lat: {0}, lng: {1}}}",
            HttpUtility.JavaScriptStringEncode(latitude, addDoubleQuotes: false), HttpUtility.JavaScriptStringEncode(longitude, addDoubleQuotes: false));
    }

    // The MapQuest key listed on their website is Url encoded to begin with. 

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "    <script src=\"http://mapquestapi.com/sdk/js/v6.0.0/mqa.toolkit.js?key=");



#line 150 "Maps.cshtml"
                                          WriteTo(@__razor_helper_writer, key);

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "\" type=\"text/javascript\"></script>\r\n");



WriteLiteralTo(@__razor_helper_writer, "    <script type=\"text/javascript\">\r\n        MQA.EventUtil.observe(window, \'load\'" +
", function() {\r\n            var map = new MQA.TileMap(document.getElementById(\'");



#line 153 "Maps.cshtml"
                                WriteTo(@__razor_helper_writer, mapElement);

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "\'), ");



#line 153 "Maps.cshtml"
                                               WriteTo(@__razor_helper_writer, zoom);

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, ", ");



#line 153 "Maps.cshtml"
                                                      WriteTo(@__razor_helper_writer, Raw(loc));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, ", \'");



#line 153 "Maps.cshtml"
                                                                  WriteTo(@__razor_helper_writer, RawJS(type));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "\'); \r\n");



#line 154 "Maps.cshtml"
             if (showZoomControl) {

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "            ");

WriteLiteralTo(@__razor_helper_writer, "\r\n                MQA.withModule(\'zoomcontrol3\', function() {\r\n\t                m" +
"ap.addControl(new MQA.LargeZoomControl3(), new MQA.MapCornerPlacement(MQA.MapCor" +
"ner.TOP_LEFT));\r\n                });\r\n            ");

WriteLiteralTo(@__razor_helper_writer, "\r\n");



#line 160 "Maps.cshtml"
            }

#line default
#line hidden



#line 161 "Maps.cshtml"
             if (!String.IsNullOrEmpty(location)) {

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "            ");

WriteLiteralTo(@__razor_helper_writer, "\r\n                MQA.withModule(\'geocoder\', function() {\r\n                    ma" +
"p.geocodeAndAddLocations(\'");



#line 164 "Maps.cshtml"
                 WriteTo(@__razor_helper_writer, RawJS(location));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "\');\r\n                });\r\n            ");

WriteLiteralTo(@__razor_helper_writer, "\r\n");



#line 167 "Maps.cshtml"
            }

#line default
#line hidden



#line 168 "Maps.cshtml"
             if (pushpins != null) {
                foreach (var p in pushpins) {

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "                    ");

WriteLiteralTo(@__razor_helper_writer, " map.addShape(new MQA.Poi({lat:");



#line 170 "Maps.cshtml"
                      WriteTo(@__razor_helper_writer, RawJS(p.Latitude));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, ",lng:");



#line 170 "Maps.cshtml"
                                             WriteTo(@__razor_helper_writer, RawJS(p.Longitude));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "}));\r\n");



#line 171 "Maps.cshtml"
	            }
            }

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "        });\r\n    </script>\r\n");



#line 175 "Maps.cshtml"
    

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "    <div id=\"");



#line 176 "Maps.cshtml"
WriteTo(@__razor_helper_writer, mapElement);

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "\" style=\"width:");



#line 176 "Maps.cshtml"
        WriteTo(@__razor_helper_writer, TryParseUnit(width, DefaultWidth));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "; height:");



#line 176 "Maps.cshtml"
                                                   WriteTo(@__razor_helper_writer, TryParseUnit(height, DefaultHeight));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, ";\">\r\n    </div>\r\n");



#line 178 "Maps.cshtml"
    if (showDirectionsLink) {

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "        <a class=\"map-link\" href=\"http://www.mapquest.com/?q=");



#line 179 "Maps.cshtml"
                              WriteTo(@__razor_helper_writer, GetDirectionsQuery(location, latitude, longitude));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "\">");



#line 179 "Maps.cshtml"
                                                                                  WriteTo(@__razor_helper_writer, directionsLinkText);

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "</a>\r\n");



#line 180 "Maps.cshtml"
    }
    MapId++;

#line default
#line hidden

});

}


public static System.Web.WebPages.HelperResult GetBingHtml(string key = null, string location = null, string latitude = null, string longitude = null, string width = null, string height = null, int zoom = 14, string type = "auto",
            bool useAdaptiveOverlay = true, bool showDirectionsLink = true, string directionsLinkText = "Get Directions", IEnumerable<MapLocation> pushpins = null) {
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {



#line 211 "Maps.cshtml"
                                                                                                                                                                     
    key = GetApiKey(key, _bingApiKey);
    if (key.IsEmpty()) {
        throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "key");
    } 
    string mapElement = GetMapElementId();
    
    type = (type ?? "auto").ToLowerInvariant();


#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "    <script src=\"http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0" +
"\" type=\"text/javascript\"></script>\r\n");



WriteLiteralTo(@__razor_helper_writer, @"    <script type=""text/javascript"">
        jQuery(window).load(function() { 
            var map = null;
            if (useAdaptiveOverlay) {
                <text>
                Microsoft.Maps.loadModule('Microsoft.Maps.Overlays.Style', {
                    callback: function () {
                        map = new Microsoft.Maps.Map(document.getElementById(""");



#line 228 "Maps.cshtml"
                                               WriteTo(@__razor_helper_writer, mapElement);

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "\"), { credentials: \'");



#line 228 "Maps.cshtml"
                                                                              WriteTo(@__razor_helper_writer, RawJS(key));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "\', mapTypeId: Microsoft.Maps.MapTypeId[\'");



#line 228 "Maps.cshtml"
                                                                                                                                 WriteTo(@__razor_helper_writer, RawJS(type));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "\'], customizeOverlays: true });\r\n\r\n                </text>\r\n            } else {\r" +
"\n                map = new Microsoft.Maps.Map(document.getElementById(\"");



#line 232 "Maps.cshtml"
                                       WriteTo(@__razor_helper_writer, mapElement);

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "\"), { credentials: \'");



#line 232 "Maps.cshtml"
                                                                      WriteTo(@__razor_helper_writer, RawJS(key));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "\', mapTypeId: Microsoft.Maps.MapTypeId[\'");



#line 232 "Maps.cshtml"
                                                                                                                         WriteTo(@__razor_helper_writer, RawJS(type));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "\'] });\r\n            }\r\n");



#line 234 "Maps.cshtml"
             if (latitude != null && longitude != null) {

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "                ");

WriteLiteralTo(@__razor_helper_writer, " map.setView({zoom: ");



#line 235 "Maps.cshtml"
       WriteTo(@__razor_helper_writer, zoom);

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, ", center: new Microsoft.Maps.Location(");



#line 235 "Maps.cshtml"
                                                  WriteTo(@__razor_helper_writer, RawJS(latitude));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, ", ");



#line 235 "Maps.cshtml"
                                                                    WriteTo(@__razor_helper_writer, RawJS(longitude));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, ")});\r\n");



#line 236 "Maps.cshtml"
            }
            else if (location != null) {

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "                ");

WriteLiteralTo(@__razor_helper_writer, "\r\n                map.getCredentials(function(credentials) {\r\n                   " +
" $.ajax({\r\n                        url: \'http://dev.virtualearth.net/REST/v1/Loc" +
"ations/\' + encodeURI(\'");



#line 241 "Maps.cshtml"
                                                            WriteTo(@__razor_helper_writer, RawJS(location));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, @"'),
                        type: 'GET',
                        crossDomain: true,
                        data: { output: 'json', key: credentials }, dataType: 'jsonp', jsonp: 'jsonp',
                        success: function(data) {
                            if (data && data.resourceSets && data.resourceSets.length > 0 && data.resourceSets[0].resources && data.resourceSets[0].resources.length > 0) {
                                var r = data.resourceSets[0].resources[0].point.coordinates;
                                var loc = new Microsoft.Maps.Location(r[0], r[1]);
                                map.setView({zoom: ");



#line 249 "Maps.cshtml"
                    WriteTo(@__razor_helper_writer, zoom);

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, ", center: loc});              \r\n                                map.entities.push" +
"(new Microsoft.Maps.Pushpin(loc, null));\r\n                            }\r\n       " +
"                 }\r\n                    });\r\n                });\r\n              " +
"  ");

WriteLiteralTo(@__razor_helper_writer, "\r\n");



#line 256 "Maps.cshtml"
            }

#line default
#line hidden



#line 257 "Maps.cshtml"
             if (pushpins != null) {
                foreach(var loc in pushpins) {

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "                    ");

WriteLiteralTo(@__razor_helper_writer, " map.entities.push(new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(");



#line 259 "Maps.cshtml"
                                                                 WriteTo(@__razor_helper_writer, RawJS(loc.Latitude));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, ", ");



#line 259 "Maps.cshtml"
                                                                                       WriteTo(@__razor_helper_writer, RawJS(loc.Longitude));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "), null));\r\n");



#line 260 "Maps.cshtml"
                }
            }

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "            if (useAdaptiveOverlay) {\r\n                <text>\r\n                  " +
"  }\r\n                });\r\n                </text>\r\n            }\r\n        });\r\n " +
"   </script>\r\n");



#line 270 "Maps.cshtml"
    

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "    <div class=\"map\" id=\"");



#line 271 "Maps.cshtml"
WriteTo(@__razor_helper_writer, mapElement);

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "\" style=\"position:relative; width:");



#line 271 "Maps.cshtml"
                                       WriteTo(@__razor_helper_writer, TryParseUnit(width, DefaultWidth));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "; height:");



#line 271 "Maps.cshtml"
                                                                                  WriteTo(@__razor_helper_writer, TryParseUnit(height, DefaultHeight));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, ";\">\r\n    </div>\r\n");



#line 273 "Maps.cshtml"
    if (showDirectionsLink) {
        // Review: Need to figure out if the link needs to be localized. 

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "        <a class=\"map-link\" href=\"http://www.bing.com/maps/?v=2&where1=");



#line 275 "Maps.cshtml"
                                        WriteTo(@__razor_helper_writer, GetDirectionsQuery(location, latitude, longitude));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "\">");



#line 275 "Maps.cshtml"
                                                                                            WriteTo(@__razor_helper_writer, directionsLinkText);

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "</a>\r\n");



#line 276 "Maps.cshtml"
    }
    MapId++;

#line default
#line hidden

});

}


public static System.Web.WebPages.HelperResult GetGoogleHtml(string location = null, string latitude = null, string longitude = null, string width = null, string height = null, int zoom = 14, string type = "ROADMAP",
                bool showDirectionsLink = true, string directionsLinkText = "Get Directions", IEnumerable<MapLocation> pushpins = null) {
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {



#line 303 "Maps.cshtml"
                                                                                                                                         
    string mapElement = GetMapElementId();
    type = (type ?? "ROADMAP").ToUpperInvariant(); // Map types are in upper case

    // Google maps does not support null centers. We'll set it to arbitrary values if they are null and only the location is provided.
    // These locations are somewhere around Microsoft's Redmond Campus.
    latitude = latitude ?? "47.652437";
    longitude = longitude ?? "-122.132424";


#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "    <script src=\"http://maps.google.com/maps/api/js?sensor=false\" type=\"text/java" +
"script\"></script>\r\n");



WriteLiteralTo(@__razor_helper_writer, "    <script type=\"text/javascript\">\r\n        $(function() {\r\n            var map " +
"= new google.maps.Map(document.getElementById(\"");



#line 315 "Maps.cshtml"
                                    WriteTo(@__razor_helper_writer, mapElement);

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "\"), { zoom: ");



#line 315 "Maps.cshtml"
                                                           WriteTo(@__razor_helper_writer, zoom);

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, ", center: new google.maps.LatLng(");



#line 315 "Maps.cshtml"
                                                                                                 WriteTo(@__razor_helper_writer, RawJS(latitude));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, ", ");



#line 315 "Maps.cshtml"
                                                                                                                   WriteTo(@__razor_helper_writer, RawJS(longitude));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "), mapTypeId: google.maps.MapTypeId[\'");



#line 315 "Maps.cshtml"
                                                                                                                                                                         WriteTo(@__razor_helper_writer, RawJS(type));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "\'] });\r\n");



#line 316 "Maps.cshtml"
             if (!String.IsNullOrEmpty(location)) {

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "                ");

WriteLiteralTo(@__razor_helper_writer, "\r\n                new google.maps.Geocoder().geocode({address: \'");



#line 318 "Maps.cshtml"
                               WriteTo(@__razor_helper_writer, RawJS(location));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, @"'}, function(response, status) {
                    if (status === google.maps.GeocoderStatus.OK) {
                        var best = response[0].geometry.location;
                        map.panTo(best);
                        new google.maps.Marker({map : map, position: best });
                    }
                });
                ");

WriteLiteralTo(@__razor_helper_writer, "\r\n");



#line 326 "Maps.cshtml"
            }

#line default
#line hidden



#line 327 "Maps.cshtml"
             if (pushpins != null) {
                foreach(var loc in pushpins) {

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "                    ");

WriteLiteralTo(@__razor_helper_writer, " new google.maps.Marker({map : map, position: new google.maps.LatLng(");



#line 329 "Maps.cshtml"
                                                            WriteTo(@__razor_helper_writer, RawJS(loc.Latitude));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, ", ");



#line 329 "Maps.cshtml"
                                                                                  WriteTo(@__razor_helper_writer, RawJS(loc.Longitude));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, ")});\r\n");



#line 330 "Maps.cshtml"
                }
            }

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "        });\r\n    </script>\r\n");



#line 334 "Maps.cshtml"
    

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "    <div class=\"map\" id=\"");



#line 335 "Maps.cshtml"
WriteTo(@__razor_helper_writer, mapElement);

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "\" style=\"width:");



#line 335 "Maps.cshtml"
                    WriteTo(@__razor_helper_writer, TryParseUnit(width, DefaultWidth));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "; height:");



#line 335 "Maps.cshtml"
                                                               WriteTo(@__razor_helper_writer, TryParseUnit(height, DefaultHeight));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, ";\">\r\n    </div>\r\n");



#line 337 "Maps.cshtml"
    if (showDirectionsLink) {

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "        <a class=\"map-link\" href=\"http://maps.google.com/maps?q=");



#line 338 "Maps.cshtml"
                                 WriteTo(@__razor_helper_writer, GetDirectionsQuery(location, latitude, longitude));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "\">");



#line 338 "Maps.cshtml"
                                                                                     WriteTo(@__razor_helper_writer, directionsLinkText);

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "</a>\r\n");



#line 339 "Maps.cshtml"
    }
    MapId++;

#line default
#line hidden

});

}


public static System.Web.WebPages.HelperResult GetYahooHtml(string key = null, string location = null, string latitude = null, string longitude = null, string width = null, string height = null, int zoom = 4, string type = "YAHOO_MAP_REG",
                bool showDirectionsLink = true, string directionsLinkText = "Get Directions", IEnumerable<MapLocation> pushpins = null) {
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {



#line 368 "Maps.cshtml"
                                                                                                                                         
    key = GetApiKey(key, _yahooApiKey);
    if (key.IsEmpty()) {
        throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "key");
    }                     
    string mapElement = GetMapElementId();


#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "    <script src=\"http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=");



#line 375 "Maps.cshtml"
                                 WriteTo(@__razor_helper_writer, HttpUtility.UrlEncode(key));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "\" type=\"text/javascript\"></script>\r\n");



WriteLiteralTo(@__razor_helper_writer, "    <script type=\"text/javascript\">\r\n        $(function() {\r\n            var map " +
"= new YMap(document.getElementById(\'");



#line 378 "Maps.cshtml"
                         WriteTo(@__razor_helper_writer, RawJS(mapElement));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "\'));  \r\n            map.addTypeControl();  \r\n            map.setMapType(");



#line 380 "Maps.cshtml"
WriteTo(@__razor_helper_writer, RawJS(type));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, ");  \r\n");



#line 381 "Maps.cshtml"
             if (latitude != null && longitude != null) {

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "                ");

WriteLiteralTo(@__razor_helper_writer, " map.drawZoomAndCenter(new YGeoPoint(");



#line 382 "Maps.cshtml"
                        WriteTo(@__razor_helper_writer, RawJS(latitude));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, ", ");



#line 382 "Maps.cshtml"
                                          WriteTo(@__razor_helper_writer, RawJS(longitude));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "), ");



#line 382 "Maps.cshtml"
                                                              WriteTo(@__razor_helper_writer, zoom);

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, ");\r\n");



#line 383 "Maps.cshtml"
            }
            else if (!String.IsNullOrEmpty(location)) {

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "                ");

WriteLiteralTo(@__razor_helper_writer, " map.drawZoomAndCenter(\'");



#line 385 "Maps.cshtml"
           WriteTo(@__razor_helper_writer, RawJS(location));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "\', ");



#line 385 "Maps.cshtml"
                              WriteTo(@__razor_helper_writer, zoom);

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, ");\r\n");



#line 386 "Maps.cshtml"
            }
            else {

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "                ");

WriteLiteralTo(@__razor_helper_writer, " map.setZoomLevel(");



#line 388 "Maps.cshtml"
     WriteTo(@__razor_helper_writer, zoom);

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, ");\r\n");



#line 389 "Maps.cshtml"
            }

#line default
#line hidden



#line 390 "Maps.cshtml"
             if(pushpins != null) {
                foreach (var loc in pushpins) {

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "                     ");

WriteLiteralTo(@__razor_helper_writer, " map.addMarker(new YGeoPoint(");



#line 392 "Maps.cshtml"
                     WriteTo(@__razor_helper_writer, RawJS(loc.Latitude));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, ", ");



#line 392 "Maps.cshtml"
                                           WriteTo(@__razor_helper_writer, RawJS(loc.Longitude));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "));\r\n");



#line 393 "Maps.cshtml"
                 }
            }

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "\r\n        });\r\n    </script>\r\n");



#line 398 "Maps.cshtml"
    

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "    <div id=\"");



#line 399 "Maps.cshtml"
WriteTo(@__razor_helper_writer, mapElement);

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "\" style=\"width:");



#line 399 "Maps.cshtml"
        WriteTo(@__razor_helper_writer, TryParseUnit(width, DefaultWidth));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "; height:");



#line 399 "Maps.cshtml"
                                                   WriteTo(@__razor_helper_writer, TryParseUnit(height, DefaultHeight));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, ";\">\r\n    </div>\r\n");



#line 401 "Maps.cshtml"
    if (showDirectionsLink) {

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "        <a class=\"map-link\" href=\"http://maps.yahoo.com/#q1=");



#line 402 "Maps.cshtml"
                             WriteTo(@__razor_helper_writer, GetDirectionsQuery(location, latitude, longitude, HttpUtility.UrlPathEncode));

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "\">");



#line 402 "Maps.cshtml"
                                                                                                            WriteTo(@__razor_helper_writer, directionsLinkText);

#line default
#line hidden

WriteLiteralTo(@__razor_helper_writer, "</a>\r\n");



#line 403 "Maps.cshtml"
    }
    MapId++;

#line default
#line hidden

});

}


        public Maps()
        {
        }
    }
}
#pragma warning restore 1591
