﻿function gotoUrlDDL(cid) {
    var d = document.getElementById(cid);    
    location.href = d.options[d.selectedIndex].value;
}

function gotoZipLookup(cid,path) {
    var t = document.getElementById(cid);
    var p = path;

    if (isValidZipCode(t.value)) {
        if (p == 0) {
            location.href = "search/coveragearea.aspx?zip=" + t.value;
        }
        else {
            location.href = "../search/coveragearea.aspx?zip=" + t.value;
        }
    }
    else {
        alert("Please enter a valid 5-digit U.S. zip code");
        t.value = "Enter Zip Code";
    }
}

function clearTxtbx(cid) {
    var t = document.getElementById(cid);
    t.value = "";
}

function isValidZipCode(value) {
   var re = /^\d{5}([\-]\d{4})?$/;
   return (re.test(value));
}

function rtnTop() {
    window.scroll(0, 0);
}

function pgBack() {
    history.back(-1);
}

function loadPgQStr(type, cid) {
    if (type == 0) {
        location.href = "?type=p";
    }
    else {
        location.href = "?type=m";
    }
}

function readMore(sectionName) {
    $('#lnk' + sectionName).hide();
    $('#div' + sectionName).show();
}

function changeFormAction(formIndex, action) {
    document.forms[formIndex].action = action
}