function save(){
  var manager = new CookieManager();
  manager.setCookie("repayment_amount", document.frm.amount.value*10000);
  manager.setCookie("repayment_interest", document.frm.interest.value/100);
  manager.setCookie("repayment_count", document.frm.count.value);
}

function open_result(){
  save();
  window.open("result.html","result","width=640 height=550");
}

function select(name)
{
  str = '<select name="'+name+'">';
  for (i = 1; i < 90 ; i++){
    if (i == 30) str += '<option value='+i+' selected="true">'+i+'</option>';
    else str += '<option value='+i+'>'+i+'</option>';
  }
  str += '</select>';
  return str;
}

document.write('<form name="frm" class="calc-input">');
document.write('<div class="calc-header">キャッシング返済計算</div>');
document.write('<dl>');
document.write('<dt>借入額:</dt>');
document.write('<dd><input name="amount" value="100" />万円</dd>');
document.write('<dt>年利:</dt>');
document.write('<dd><input name="interest" value="18" />%</dd>');
document.write('<dt>返済回数:</dt>');
document.write('<dd>'+select('count')+'回</dd>');
document.write('</dl>');
document.write('<div class="calc-button">');
document.write('<input type="button" value="計算" size="12" onclick="open_result();" />');
document.write('</div>');
document.write('</form>');

