﻿function ChangeState()
{
    var select = document.getElementById("stateList");
    if (select.options[select.selectedIndex].value != "XX")
    {
        self.location.href = "state_continuation_" + select.options[select.selectedIndex].value + ".htm";
    }
}

function ValidateRateSpan()
{
    if (document.getElementById("whatYouPay").value == "")
    {
        document.getElementById("rateSpan").style.display = "none";
        document.getElementById("currentRate").innerHTML = "";
    }
    else if (document.getElementById("currentRate").innerHTML != "")
    {

        document.getElementById("rateSpan").style.display = "block";
    }
}



function GetH1Quote(ctrl)
{
    
    var rate = document.getElementById("ctl00_headercontent_CompareAndCalculate_currentRateSpan").innerHTML;

    if (isNaN(rate))
    {
        window.open("https://www.humana-one.com/secured/individual-health-insurance-quotes.aspx?kc=1005012069&cm_mmc_o=2B_yz*1bELl*2BF5zyw+qzfw*qbTtf+WzM");
                     
    }
    else
    {
        window.open("https://www.humana-one.com/secured/individual-health-insurance-quotes.aspx?currentRate=" + rate + "&kc=1005012069&cm_mmc_o=2B_yz*1bELl*2BF5zyw+qzfw*qbTtf+WzM")
    }
}

function ApplySubsidyFactor()
{
    var whatYouPay = document.getElementById("whatYouPay").value;


    if (whatYouPay.match("[a-zA-Z]+") || whatYouPay > 9999 || whatYouPay == "")
    {
        alert("Please enter a valid rate.");
    }
    else
    {
        var newRate = Math.round(whatYouPay * .35 * 100) / 100;
        var decimalIndex = newRate.toString().indexOf(".");

        if (!isNaN(decimalIndex) && newRate.toString().length - decimalIndex <= 2)
        {
            newRate = newRate.toString() + "0";
        }

        document.getElementById("currentRate").innerHTML = newRate;
    }

    ValidateRateSpan();
}

function ViewH1StateInfo()
{
    var select = document.getElementById("stateList");
    var stateName = select.options[select.selectedIndex].text;
    switch (stateName)
    {
        //States we offer coverage in        
        case "Alabama":
        case "Arizona":
        case "Arkansas":
        case "Colorado":
        case "Florida":
        case "Georgia":
        case "Illinois":
        case "Idiana":
        case "Iowa":
        case "Kansas":
        case "Kentucky":
        case "Louisiana":
        case "Michigan":
        case "Mississippi":
        case "Missouri":
        case "Nebraska":
        case "Nevada":
        case "North Carolina":
        case "Ohio":
        case "Oklahoma":
        case "South Carolina":
        case "Tennessee":
        case "Texas":
        case "Utah":
        case "Virginia":
        case "Wisconsin":
            window.location = "http://www.humana-one.com/" + stateName.replace(" ", "-") + "-health-insurance/plans-available.asp?kc=1005012069&cm_mmc_o=2B_yzCjC1bELlCjCZv%20R5fbBElCjCmfzfw%20KyB5pBcE";
            break;

        //GHIC States        
        case "Pennsylvania":
            window.location = "http://www.humana-one.com/secured/getFreeGHICQuotes.asp?state=" + stateName + "&kc=1005012069&cm_mmc_o=2B_yzCjC1bELlCjCZv%20R5fbBElCjCmfzfw%20KyB5pBcE";
            break;

        //Contact Us States        
        case "Maine":
        case "Massachusetts":
        case "North Dakota":
        case "Rhode Island":
        case "Vermont":
            window.location = "http://www.humana-one.com/secured/contactusforotherstates.asp?state=" + stateName.replace(" ", "-") + "&kc=1005012069&cm_mmc_o=2B_yzCjC1bELlCjCZv%20R5fbBElCjCmfzfw%20KyB5pBcE";
            break;

        //Ehealth Partner States        
        case "Alaska":
        case "California":
        case "Conneticut":
        case "Deleware":
        case "Hawaii":
        case "Idaho":
        case "Maryland":
        case "Minnesota":
        case "Montana":
        case "New Hampshire":
        case "New Jersey":
        case "New Mexico":
        case "New York":
        case "Oregon":
        case "South Dakota":
        case "Washington":
        case "West Virginia":
        case "Wyoming":
            window.location = "http://www.humana-one.com/secured/getFreeEHealthInsuranceQuotes.asp?state=" + stateName.replace(" ", "-") + "&kc=1005012069&cm_mmc_o=2B_yzCjC1bELlCjCZv%20R5fbBElCjCmfzfw%20KyB5pBcE";
            break;

        //because for some reason hyphenating D.C is cool....        
        case "D.C.":
            window.location = "http://www.humana-one.com/secured/getFreeEHealthInsuranceQuotes.asp?state=D.-C.&kc=1005012069&cm_mmc_o=2B_yzCjC1bELlCjCZv%20R5fbBElCjCmfzfw%20KyB5pBcE"
            break;
    }
}
function MM_goToURL()
{ //v3.0
    var i, args = MM_goToURL.arguments; document.MM_returnValue = false;
    for (i = 0; i < (args.length - 1); i += 2) eval(args[i] + ".location='" + args[i + 1] + "'");
}

function MM_preloadImages()
{ //v3.0
    var d = document; if (d.images)
    {
        if (!d.MM_p) d.MM_p = new Array();
        var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)
            if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; } 
    }
}

function MM_swapImgRestore()
{ //v3.0
    var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
}

function MM_findObj(n, d)
{ //v4.01
    var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length)
    {
        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
    }
    if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
    if (!x && d.getElementById) x = d.getElementById(n); return x;
}

function MM_swapImage()
{ //v3.0
    var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3)
        if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }
}