$(document).ready(function(){function toFixed(value,precision){var power=Math.pow(10,precision||0);return
String(Math.round(value*power)/power)}var i=0;while(i<=$('table tr').length-2){$('#current_min\\['+i+'\\], #current_cost\\['+i+'\\], #sim_required\\['+i+'\\], #cost_per_sim\\['+i+'\\], #total_sim\\['+i+'\\], #service_fee\\['+i+'\\], #total_new\\['+i+'\\], #new_rate\\['+i+'\\], #annual_savings\\['+i+'\\]').val(0).bind('change',function(){var
id=$(this).attr('id');id=id.substr(id.indexOf('[')+1,id.length-2-id.indexOf('['));if($('#current_min\\['+id+'\\]').val()<6000){var
cost_per_sim=0;var service_fee=0;var
error = true; $('#error').show(); $('#allow1').hide(); $('#allow2').hide(); $('#allow3').hide(); $('#allow4').hide(); $('#allow5').hide(); $('#allow1a').hide(); $('#allow2a').hide(); $('#allow3a').hide(); $('#allow4a').hide(); $('#allow5a').hide(); $('#allow6').hide()
} else { $('#error').hide(); $('#allow1').show(); $('#allow2').show(); $('#allow3').show(); $('#allow4').show(); $('#allow5').show(); $('#allow1a').show(); $('#allow2a').show(); $('#allow3a').show(); $('#allow4a').show(); $('#allow5a').show(); $('#allow6').show() } if ($('#current_min\\[' + id + '\\]').val() > 5999 && $('#current_min\\[' + id + '\\]').val() < 14000) {
    var 
cost_per_sim=76.50;var
service_fee=150.00}if($('#current_min\\['+id+'\\]').val()>14000&&$('#current_min\\['+id+'\\]').val()<18001){var
cost_per_sim=45.00;var
service_fee=200.00}if($('#current_min\\['+id+'\\]').val()>18000&&$('#current_min\\['+id+'\\]').val()<24001){var
cost_per_sim=45.00;var
service_fee=300.00}if($('#current_min\\['+id+'\\]').val()>24000&&$('#current_min\\['+id+'\\]').val()<30001){var
cost_per_sim=45.00;var
service_fee=400.00}if($('#current_min\\['+id+'\\]').val()>30000&&$('#current_min\\['+id+'\\]').val()<40001){var
cost_per_sim=45.00;var
service_fee=500.00}if($('#current_min\\['+id+'\\]').val()>40000&&$('#current_min\\['+id+'\\]').val()<50001){var
cost_per_sim=45.00;var
service_fee=600.00}if($('#current_min\\['+id+'\\]').val()>50000&&$('#current_min\\['+id+'\\]').val()<60001){var
cost_per_sim=45.00;var
service_fee=800.00}if($('#current_min\\['+id+'\\]').val()>60000&&$('#current_min\\['+id+'\\]').val()<70001){var
cost_per_sim=45.00;var
service_fee=900.00}if($('#current_min\\['+id+'\\]').val()>70000&&$('#current_min\\['+id+'\\]').val()<95001){var
cost_per_sim=45.00;var
service_fee=1000.00}if($('#current_min\\['+id+'\\]').val()>95000&&$('#current_min\\['+id+'\\]').val()<250001){var
cost_per_sim=45.00;var
service_fee=1250.00}if($('#current_min\\['+id+'\\]').val()>250000&&$('#current_min\\['+id+'\\]').val()<500000){var
cost_per_sim=45.00;var service_fee=1800.00}var current_rate=$('#current_cost\\['+id+'\\]').val()/$('#current_min\\['+id+'\\]').val()*100;var
sim_required=Math.round($('#current_min\\['+id+'\\]').val()/2095);var
total_sim=cost_per_sim*sim_required.toFixed(2);var
total_cost=total_sim+service_fee;var
new_rate=(total_cost/$('#current_min\\['+id+'\\]').val())*100;var
monthly_savings=$('#current_cost\\['+id+'\\]').val()-total_cost;var
annual_savings=monthly_savings*12;var
display_current_rate=current_rate.toFixed(2);var
display_cost_per_sim=cost_per_sim.toFixed(2);var
display_total_sim=total_sim.toFixed(2);var
display_total_cost=total_cost.toFixed(2);var
display_new_rate=new_rate.toFixed(2);var
display_annual_savings=annual_savings.toFixed(2);$('#current_rate\\['+id+'\\]').val(display_current_rate);$('#sim_required\\['+id+'\\]').val(sim_required);$('#cost_per_sim\\['+id+'\\]').val(display_cost_per_sim);$('#total_sim\\['+id+'\\]').val(display_total_sim);$('#total_cost\\['+id+'\\]').val(display_total_cost);$('#new_rate\\['+id+'\\]').val(display_new_rate);$('#annual_savings\\['+id+'\\]').val(display_annual_savings)});i++}}); 

