var baofeiList = new Array;
baofeiList[0] = 0;
baofeiList[1] = 9.9;
baofeiList[2] = 14.7;
baofeiList[3] = 19.7;
baofeiList[4] = 24.7;
baofeiList[5] = 29.7;
baofeiList[6] = 35.3;
baofeiList[7] = 40.2;
baofeiList[8] = 45.5;
baofeiList[9] = 50.4;
baofeiList[10] = 54.9;
baofeiList[11] = 60.2;
baofeiList[12] = 65.4;
baofeiList[13] = 70.7;
baofeiList[14] = 76.0;
baofeiList[15] = 81.2;
baofeiList[16] = 86.0;
baofeiList[17] = 91.2;
baofeiList[18] = 96.0;
baofeiList[19] = 101.3;
baofeiList[20] = 105.3;
baofeiList[21] = 107.9;
baofeiList[22] = 113.0;
baofeiList[23] = 118.1;
baofeiList[24] = 123.2;
baofeiList[25] = 128.3;
baofeiList[26] = 133.5;
baofeiList[27] = 138.7;
baofeiList[28] = 143.9;
baofeiList[29] = 149.2;
baofeiList[30] = 154.3;

function bf_getYears(){
 var val = 0;
 obj = document.getElementById('fk_bf_years');
 if(isNum(obj.value)){
  val = parseInt(obj.value);
 }
 return val;
}

function bf_getBfRate(years){
 var rate = 0;
 if(years > -1 && years< 31){
  rate = baofeiList[years]; 
 }
 return rate;
}

function bf_getBfAmount(){
 var val = 0;
 obj = document.getElementById('aaafangchan_bf_amount');
 if(isNum(obj.value)){
  val = parseInt(obj.value);
 }
 return val;
}

function bf_CalcBaofei(){
 var amount = bf_getBfAmount();
 var years = bf_getYears();
 var rate = bf_getBfRate(years);
 var obj = document.getElementById('aaafangchan_bf_baofeiAmount');
 obj.value = Math.round(amount * rate * 100)/100;
}