﻿function OpenPopup(hlnk)
{
    window.open(hlnk.href);
    return false;
}

function GoImgClick(sType, img)
{

    var radius = '';
    var radiusElementId = img.getAttribute('radiusElementId');
    if (radiusElementId)
    {
        var oDDL = document.getElementById(radiusElementId);
        if (oDDL) radius = oDDL.value;
    }
    
    var zip = '';
    var zipElementId = img.getAttribute('zipElementId');
    if (zipElementId)
    {
        var oTXT = document.getElementById(zipElementId);
        if (oTXT) zip = oTXT.value;
    }
    else
    {
        zip = img.getAttribute('zip');
    }
    
    Search(sType, zip, radius);
}

function txtZip_OnKeyPress(sType, oEvt, oZ)
{
    if (oEvt && oEvt.keyCode == 13)
    {
        if (oZ && oZ.value.length > 0)
        {
            var zip = oZ.value;
            var radius = '';
            var radiusElementId = oZ.getAttribute('radiusElementId');
            if (radiusElementId)
            {
                var oDDL = document.getElementById(radiusElementId);
                if (oDDL) radius = oDDL.value;
            }
            Search(sType, zip, radius);
        }
        return false;
    }    
    else
        return true;
}

function Search(sType, zip, radius)
{
    if (zip == 'ZIP Code') zip = '';
    var oUrl = document.getElementById("Headerwave1_hid" + sType + "Url");
    var url = oUrl.value + "?zip=" + escape(zip) + "&radius=" + escape(radius);
    window.location.href = url;
}



