// JavaScript Document<!--//////	【著作権表示】//	WDTローンシミュレーターはフリーソフトではありません。//	WDTローンシミュレーターの著作権は(資)ウェブデザインタナカが保有しています。//	Copyright （C） 2001 Web Design TANAKA. All Rights Reserved.//	URL: http://www.bestshop.co.jp///	E-mail: info@bestshop.co.jp//function calc(){    if (!(Acheck() && YMcheck())){    return;    }    var De = document.hensai.Debt.value * 10000;    var Yp = 0    var Rr = document.hensai.Rate.value / 100;    var Rz = document.hensai.Rate.value;    var Yy = document.hensai.YY.selectedIndex;    var Mm = document.hensai.MM.selectedIndex;    var Wtest = document.hensai.Nensyu.value;    var Wa = document.hensai.Nensyu.value / 100;    var Hr = 0    var Nn = Math.floor(Yy * 12 + Mm);	    var Bn = Math.floor(Nn / 6);    var Mk = De - Yp;	    var Pm = Math.floor((Mk * Rr / 12 * Math.pow((1 + Rr /12),Nn))/(Math.pow((1 + Rr / 12),Nn)-1));	    var Pb = Math.floor((Yp * Rr / 2 * Math.pow((1 + Rr /2),Bn))/(Math.pow((1 + Rr / 2),Bn)-1));	    var Py = Pm * 12 + Pb * 2;	    var all = Pm * Nn + Pb * Bn;    var Wb = (Py / Wa);	    if (Yp == 0){var Bnk = 0;}    else {var Bnk = Bn;}    document.hensai.AmountM1.value = Math.floor(De / 10000);    document.hensai.AmountM3.value =(Rz);	    document.hensai.AmountM4.value = Math.floor(Yy);    document.hensai.AmountM5.value = Math.floor(Mm);    document.hensai.AmountM6.value =(Wa * 100);	    document.hensai.AmountM.value = Math.floor(Pm);    document.hensai.AmountY.value = Math.floor(Py / 10000);    if (Wtest > 0){     document.hensai.Nensyuf.value = Math.floor(Wb / 10000)     }    else {     document.hensai.Nensyuf.value = ""     }    ;}function ClearIP(){    document.hensai.Debt.value = "";    document.hensai.Ypay.value = "";    document.hensai.Rate.value = "0.95";    document.hensai.YY.selectedIndex = 0;    document.hensai.MM.selectedIndex = 0;    document.hensai.Debt.focus();}function ClearOP(){    document.hensai.AmountM.value = "";    document.hensai.AmountY.value = "";}function NumCheck(n){    var i = 0;    for (i = 0; i < n.length; i++){        var s = n.substring(i, i + 1);        if (s == "0"  ||  s == "1" ||  s == "2" || s == "3" || s == "4" || s == "5" || s == "6" || s == "7" || s == "8" || s == "9" || s == "."){            continue;        }        else{            return false;        }    }    return true;}function Acheck(){    var gankin = document.hensai.Debt.value;    if (gankin == ""){        alert("借入金額を入力してください");        document.hensai.Debt.focus();        return false;    }    if (!NumCheck(gankin) || gankin < 1 || gankin > 99999){        alert("借入金額には1〜99999までの整数を入力してください");        document.hensai.Debt.focus();        return false;    }    return true;}function Bcheck(){    var bonus = document.hensai.Ypay.value;    var gankin = document.hensai.Debt.value;    var bg = bonus / gankin;    if (bonus == ""){        alert("ボーナス返済元金を入力してください");        document.hensai.Ypay.focus();        return false;    }    if (bg > 1){        alert("ボーナス返済元金は借入れ金額より少なくしてください");        document.hensai.Ypay.focus();        return false;    }    if (!NumCheck(bonus) || bonus < 0 || bonus > 99999){        alert("ボーナス返済元金には0〜99999までの整数を入力してください");        document.hensai.Ypay.focus();        return false;    }    return true;}    function Icheck(){    var Rate = document.hensai.Rate.selectedIndex;    if (Rate == 1.10){        alert("借入利率を入力してください");        document.hensai.Rate.focus();        return false;    }    if (!NumCheck(Rate) || Rate < 0.001 || Rate > 20.000){        alert("借入利率を0.001〜20.000%の範囲で入力してください");        document.hensai.Rate.focus();        return false;    }    return true;}    function YMcheck(){    var year = document.hensai.YY.selectedIndex;    var month = document.hensai.MM.selectedIndex;    if (year == 0){        alert("返済期間は1年0ヶ月〜45年0ヶ月の範囲で入力してください");        document.hensai.YY.focus();        return false;    }    if (year == 45 && month != 0){        alert("返済期間は1年0ヶ月〜45年0ヶ月の範囲で入力してください");        document.hensai.MM.focus();        return false;    }    return true;}//-->
