﻿//<![CDATA[
function ChangeCountry()
{
    switch (document.getElementById("countryDropDownList").value)
    {
        case "0":
            document.getElementById("state").innerText = "State";
            document.getElementById("zip").innerText = "ZIP Code";
            document.aspnetForm.units[0].checked = true;
            break;
        case "1":
            document.getElementById("state").innerText = "Province";
            document.getElementById("zip").innerText = "Postal Code";
            document.aspnetForm.units[1].checked = true;
            break;
    }
}

function MapSubmit()
{
    // See the following URL for the article describing how to build URLs that link to MSN Maps & Directions
    // http://www.microsoft.com/mappoint/msnmaps/mws_linking.mspx
    var mapURL;
    mapURL = "http://maps.msn.com/directionsFind.aspx?" + "&";
    mapURL += "strt1=" + document.getElementById("txtStreetAddress").value + "&";
    mapURL += "city1=" + document.getElementById("txtCity").value + "&";
    mapURL += "stnm1=" + document.getElementById("txtState").value + "&";
    mapURL += "zipc1=" + document.getElementById("txtZip").value + "&";
    mapURL += "cnty1=" + document.getElementById("countryDropDownList").value + "&";
    mapURL += "strt2=1305+S+LANDER+ST&city2=SEATTLE&stnm2=WA&zipc2=98144&cnty2=0" + "&";
    for (var i = 0; i < 2; i++)
    {
        if (document.aspnetForm.route[i].checked)
        {
            mapURL += "rtyp=" + document.aspnetForm.route[i].value + "&";
        }
    }
    for (var i = 0; i < 2; i++)
    {
        if (document.aspnetForm.units[i].checked)
        {
            mapURL += "unit=" + document.aspnetForm.units[i].value;
        }
    }
    window.open(mapURL);
}
//]]>
