jQuery(document).ready(function($){
    $('#type').change(function (){
        var dpAmt=$("#amount");
        var dpTerm=$("#firststep-term");
        var dpAmtArrayVal=[];
        var dpAmArrayText=[];
        var options='';

        //init options
        if($(this).val()=='cd'){
            dpTerm.show();
            dpAmtArrayVal=["","9999","39999","99999","100001"];
            dpAmArrayText=["-Select Deposit Amount-","< $10,000","$10,000 to $39,999","$40,000 to $99,999","$100,000+ (Jumbo)"]


        }else{
            dpTerm.hide();
            dpAmtArrayVal=["","9999","24999","49999","99999","100001"];
            dpAmArrayText=["-Select Deposit Amount-","< $10,000","$10,000 to $24,999","$25,000 to $49,999","$50,000 to $99,999","$100,000+ (Jumbo)"]
        }

        //update options amount
        if (dpAmtArrayVal.lenght != dpAmArrayText.lenght) alert('Text and Value of Amount not match');
        for(var i in dpAmtArrayVal) {
            options += '<option value="'+dpAmtArrayVal[i]+'">'+dpAmArrayText[i]+'</option>';
        }
        dpAmt.html(options);
    }).change();

    $('#see_rates').click(function(){
        if ($('#type').val()==''){
             alert('Select Account Type!');
             return false;
        }
        $('#deposit-rate').submit();
    });
});