﻿// cost calculator for Yamasa courses programmed by N. Docherty
// revised costs and courses 27/6/2011
// revised costs from 01/04/2010.
// version 1.2 separation of aijp and ajsp 02/06/2010
// version 1.1 17/09/2009 please reference if any of the code is copied!
function money() {
    this.weeks;
    this.Cfees;
    this.rent;
    this.Quartweek;
    this.deposit;
    this.Totrent;
    this.Totfuton;
    this.futonCost;
    this.pickup;
    this.oneOff;
    this.callCost;
    this.pvtCost;
    this.tourCost;
    this.jbbpCost;
    this.bunkaCost;
    this.plusTotal;
    this.choose = "0";
}
function ddlID(ID) {
    this.ID = ID;
    this.ddl = getID;
    this.labelText = getID;
    this.ddlText = optionText;
    this.ddlValue = optionValue;
    this.ddlFees = optionFees;
    this.ddlDeposit = optionDeposit;
    this.selectValue = optionSelect;
}
function getID() {
    return document.getElementById(this.ID);
}
function optionText() {
    return this.ddl().options[this.ddl().selectedIndex].text;
}
function optionValue() {
    return this.ddl().options[this.ddl().selectedIndex].value;
}
function optionFees() {
    return this.ddl().options[this.ddl().selectedIndex].fees;
}
function optionDeposit() {
    return this.ddl().options[this.ddl().selectedIndex].deposit;
}
function optionSelect(no) {
    var a = this.ddl();
    for (i = 0; i < a.options.length; i++) {
        if (a.options[i].value == no) {
            a.selectedIndex = i;
            return;
        }
    }
}
//ddl`s ID`s
var course = new ddlID("choice");
var tuition = new ddlID("weeks");
var housing = new ddlID("place");
var housingSub = new ddlID("SubCat");
var futon = new ddlID("futon");
var airport = new ddlID("pickup");
//var optionSelect = new ddlID("optionSelect");
var callHours = new ddlID("callHours");
var pvtHours = new ddlID("pvtHours");
var tour = new ddlID("tour");
var jbbp = new ddlID("jbbp");
var bunka = new ddlID("bunka");
var refreshDaysPer = new ddlID("refreshDaysPer");
var refreshLessonsDay = new ddlID("refreshLessonsDay");
var refreshCall = new ddlID("refreshCall");
var refreshPrivate = new ddlID("refreshPrivate");
var startYear = new ddlID("startYear");
var startMonth = new ddlID("startMonth");
var startDate = new ddlID("startDate");
//label ID`S
var depositB = new ddlID("deposit");
var coursefees = new ddlID("coursefees");
var futonTotal = new ddlID("totalfuton");
var airportTotal = new ddlID("totalairport");
var yachin = new ddlID("yachin");
var finalTotal = new ddlID("total");
var callTotal = new ddlID("callTotal");
var pvtTotal = new ddlID("pvtTotal");
var tourTotal = new ddlID("tourTotal");
var plusTotal = new ddlID("plusTotal");
var jbbpTotal = new ddlID("jbbpTotal");
var bunkaTotal = new ddlID("bunkaTotal");
var tourError = new ddlID("tourError");
var refCallPerH = new ddlID("refreshCallPerH");
var refCallTHours = new ddlID("refreshCallTotalHours");
var refCallTCost = new ddlID("refreshCallTotalCost");
var refPrivPerH = new ddlID("refreshPrivPerH");
var refPrivTHours = new ddlID("refreshPrivTotalHours");
var refPrivTCost = new ddlID("refreshPrivTotalCost");



//button ID
//var addOption = new ddlID("add");
// costing variable names
var costs = new money();
// this fills the droplists on load
// droplist 'place' filled from function call removeall() from droplist choise
// fills droplist 'choice'
function fillplace() {
    //    var ddl = document.getElementById(list.course);
    addrent(course.ddl(), "Acceleration Program", "Acceleration Program");
    addrent(course.ddl(), "AIJP", "AIJP");
    addrent(course.ddl(), "AIJP Plus", "AIJP Plus");
    addrent(course.ddl(), "AJSP", "AJSP");
    addrent(course.ddl(), "AJSP Plus", "AJSP Plus");
    addrent(course.ddl(), "Discovery: 12 private lessons/week + tour", "Discovery: 12 private lessons/week + tour");
    addrent(course.ddl(), "Discovery: 18 private lessons/week + tour", "Discovery: 18 private lessons/week + tour");
    addrent(course.ddl(), "Discovery: group lessons + tour", "Discovery: group lessons + tour");
    addrent(course.ddl(), "Hybrid: Private/CALL", "Hybrid: Private/CALL");
    addrent(course.ddl(), "Internship Program", "Internship Program");
    addrent(course.ddl(), "JBPP Format 1", "JBPP Format 1");
    addrent(course.ddl(), "JBPP Format 2", "JBPP Format 2");
    addrent(course.ddl(), "JBPP Format 3", "JBPP Format 3");
    addrent(course.ddl(), "JBPP Format 4", "JBPP Format 4");
    addrent(course.ddl(), "Japanese Language & Culture Program (off-season)", "Japanese Language & Culture Program (off-season)");
    addrent(course.ddl(), "Japanese Language & Culture Program (peak season)", "Japanese Language & Culture Program (peak season)");
    addrent(course.ddl(), "Mini Course: single (off-season)", "Mini Course: single (off-season)");
    addrent(course.ddl(), "Mini Course: pair (off-season)", "Mini Course: pair (off-season)");
    addrent(course.ddl(), "Mini Course: single (peak season)", "Mini Course: single (peak season)");
    addrent(course.ddl(), "Mini Course: pair (peak season)", "Mini Course: pair (peak season)");
    addrent(course.ddl(), "Refresher", "Refresher");
    addrent(course.ddl(), "SILAC", "SILAC", "1");
    addrent(course.ddl(), "SILAC Plus", "SILAC Plus", "1");
    addrent(course.ddl(), "University Japanese Program", "University Japanese Program");
    housingSub.ddl().style.display = "none";

}
// fills droplist 'weeks'
function selectCourse() {
    var a = course.ddlValue();
    removeAllOptions(tuition.ddl());
    addrent(tuition.ddl(), "0", "Select study period", "0");
    switch (a) {
        case 'AIJP':
            costs.Quartweek = 2;
            addrest(tuition.ddl(), "1", "1 quarter", "290875");
            addrest(tuition.ddl(), "2", "2 quarters", "540750");
            addrest(tuition.ddl(), "3", "3 quarters", "737625");
            addrest(tuition.ddl(), "4", "4 quarters", "934500");
            addrest(tuition.ddl(), "5", "5 quarters", "1141875");
            addrest(tuition.ddl(), "6", "6 quarters", "1349250");
            addrest(tuition.ddl(), "7", "7 quarters", "1556625");
            addrest(tuition.ddl(), "8", "8 quarters", "1764000");
            plusOptions();
            break;
        case 'AIJP Plus':
            costs.Quartweek = 2;
            addrest(tuition.ddl(), "1", "1 quarter", "290875");
            addrest(tuition.ddl(), "2", "2 quarters", "540750");
            addrest(tuition.ddl(), "3", "3 quarters", "737625");
            addrest(tuition.ddl(), "4", "4 quarters", "934500");
            addrest(tuition.ddl(), "5", "5 quarters", "1141875");
            addrest(tuition.ddl(), "6", "6 quarters", "1349250");
            addrest(tuition.ddl(), "7", "7 quarters", "1556625");
            addrest(tuition.ddl(), "8", "8 quarters", "1764000");
            plusOptions();
            break;
        case 'AJSP':
            costs.Quartweek = 2;
            addrest(tuition.ddl(), "1", "1 quarter", "290875");
            addrest(tuition.ddl(), "2", "2 quarters", "540750");
            addrest(tuition.ddl(), "3", "3 quarters", "737625");
            addrest(tuition.ddl(), "4", "4 quarters", "934500");
            plusOptions();
            break;
        case 'AJSP Plus':
            costs.Quartweek = 2;
            addrest(tuition.ddl(), "1", "1 quarter", "290875");
            addrest(tuition.ddl(), "2", "2 quarters", "540750");
            addrest(tuition.ddl(), "3", "3 quarters", "737625");
            addrest(tuition.ddl(), "4", "4 quarters", "934500");
            break;
        case 'SILAC':
            costs.Quartweek = 1;
            addrest(tuition.ddl(), "2", "2 weeks", "92200");
            addrest(tuition.ddl(), "3", "3 weeks", "113900");
            addrest(tuition.ddl(), "4", "4 weeks", "135600");
            addrest(tuition.ddl(), "5", "5 weeks", "159100");
            addrest(tuition.ddl(), "6", "6 weeks", "187100");
            addrest(tuition.ddl(), "7", "7 weeks", "209900");
            addrest(tuition.ddl(), "8", "8 weeks", "232100");
            addrest(tuition.ddl(), "9", "9 weeks", "250900");
            addrest(tuition.ddl(), "10", "10 weeks", "269200");
            addrest(tuition.ddl(), "11", "11 weeks", "284300");
            addrest(tuition.ddl(), "12", "12 weeks", "298900");
            break;
        case 'SILAC Plus':
            costs.Quartweek = 1;
            addrest(tuition.ddl(), "2", "2 weeks", "92200");
            addrest(tuition.ddl(), "3", "3 weeks", "113900");
            addrest(tuition.ddl(), "4", "4 weeks", "135600");
            addrest(tuition.ddl(), "5", "5 weeks", "159100");
            addrest(tuition.ddl(), "6", "6 weeks", "187100");
            addrest(tuition.ddl(), "7", "7 weeks", "209900");
            addrest(tuition.ddl(), "8", "8 weeks", "232100");
            addrest(tuition.ddl(), "9", "9 weeks", "250900");
            addrest(tuition.ddl(), "10", "10 weeks", "269200");
            addrest(tuition.ddl(), "11", "11 weeks", "284300");
            addrest(tuition.ddl(), "12", "12 weeks", "298900");
            plusOptions();
            break;
        case 'University Japanese Program':
            costs.Quartweek = 1;
            addrest(tuition.ddl(), "7", "2011/05/26 to 2011/07/14", "433500");
            addrest(tuition.ddl(), "9", "2011/05/26 to 2011/07/28", "551400");
            addrest(tuition.ddl(), "7", "2011/06/16 to 2011/08/04", "433500");
            addrest(tuition.ddl(), "9", "2011/06/16 to 2011/08/18", "551400");
            addrest(tuition.ddl(), "7", "2011/07/07 to 2011/08/25", "433500");
            addrest(tuition.ddl(), "9", "2011/07/07 to 2011/09/08", "551400");
            addrest(tuition.ddl(), "7", "2011/12/08 to 2012/02/02", "433500");
            addrest(tuition.ddl(), "9", "2011/12/08 to 2012/02/16", "551400");
            break;
        case 'Japanese Language & Culture Program (off-season)':
            costs.Quartweek = 1;
            addrest(tuition.ddl(), "2", "2 weeks", "92200");
            addrest(tuition.ddl(), "3", "3 weeks", "113900");
            addrest(tuition.ddl(), "4", "4 weeks", "135600");
            addrest(tuition.ddl(), "5", "5 weeks", "159100");
            addrest(tuition.ddl(), "6", "6 weeks", "187100");
            addrest(tuition.ddl(), "7", "7 weeks", "209900");
            addrest(tuition.ddl(), "8", "8 weeks", "232100");
            addrest(tuition.ddl(), "9", "9 weeks", "250900");
            addrest(tuition.ddl(), "10", "10 weeks", "269200");
            addrest(tuition.ddl(), "11", "11 weeks", "284300");
            addrest(tuition.ddl(), "12", "12 weeks", "298900");
            break;
        case 'Japanese Language & Culture Program (peak season)':
            costs.Quartweek = 1;
            addrest(tuition.ddl(), "2", "2 weeks", "98300");
            addrest(tuition.ddl(), "3", "3 weeks", "128300");
            addrest(tuition.ddl(), "4", "4 weeks", "165100");
            addrest(tuition.ddl(), "5", "5 weeks", "195500");
            addrest(tuition.ddl(), "6", "6 weeks", "231400");
            addrest(tuition.ddl(), "7", "7 weeks", "261800");
            addrest(tuition.ddl(), "8", "8 weeks", "298700");
            addrest(tuition.ddl(), "9", "9 weeks", "329100");
            addrest(tuition.ddl(), "10", "10 weeks", "365100");
            addrest(tuition.ddl(), "11", "11 weeks", "395900");
            addrest(tuition.ddl(), "12", "12 weeks", "432300");
            break;
        case 'Acceleration Program':
            costs.Quartweek = 1;
            addrest(tuition.ddl(), "6", "6 weeks", "395600");
            addrest(tuition.ddl(), "7", "7 weeks", "451100");
            addrest(tuition.ddl(), "8", "8 weeks", "506400");
            addrest(tuition.ddl(), "9", "9 weeks", "564525");
            addrest(tuition.ddl(), "10", "10 weeks", "620000");
            addrest(tuition.ddl(), "11", "11 weeks", "675400");
            addrest(tuition.ddl(), "12", "12 weeks", "729400");
            break;
        case 'Discovery: 12 private lessons/week + tour':
            costs.Quartweek = 1;
            addrest(tuition.ddl(), "2", "2 weeks", "72000");
            addrest(tuition.ddl(), "3", "3 weeks", "108000");
            addrest(tuition.ddl(), "4", "4 weeks", "144000");
            addrest(tuition.ddl(), "5", "5 weeks", "180000");
            addrest(tuition.ddl(), "6", "6 weeks", "216000");
            addrest(tuition.ddl(), "7", "7 weeks", "252000");
            addrest(tuition.ddl(), "8", "8 weeks", "288000");
            addrest(tuition.ddl(), "9", "9 weeks", "324000");
            addrest(tuition.ddl(), "10", "10 weeks", "360000");
            plusOptions();
            break;
        case 'Discovery: 18 private lessons/week + tour':
            costs.Quartweek = 1;
            addrest(tuition.ddl(), "2", "2 weeks", "108000");
            addrest(tuition.ddl(), "3", "3 weeks", "162000");
            addrest(tuition.ddl(), "4", "4 weeks", "216000");
            addrest(tuition.ddl(), "5", "5 weeks", "270000");
            addrest(tuition.ddl(), "6", "6 weeks", "324000");
            addrest(tuition.ddl(), "7", "7 weeks", "378000");
            addrest(tuition.ddl(), "8", "8 weeks", "432000");
            addrest(tuition.ddl(), "9", "9 weeks", "486000");
            addrest(tuition.ddl(), "10", "10 weeks", "540000");
            plusOptions();
            break;
        case 'Discovery: group lessons + tour':
            costs.Quartweek = 1;
            addrest(tuition.ddl(), "2", "2 weeks", "92200");
            addrest(tuition.ddl(), "3", "3 weeks", "113900");
            addrest(tuition.ddl(), "4", "4 weeks", "135600");
            addrest(tuition.ddl(), "5", "5 weeks", "159100");
            addrest(tuition.ddl(), "6", "6 weeks", "187100");
            addrest(tuition.ddl(), "7", "7 weeks", "209900");
            addrest(tuition.ddl(), "8", "8 weeks", "232100");
            addrest(tuition.ddl(), "9", "9 weeks", "250900");
            addrest(tuition.ddl(), "10", "10 weeks", "269200");
            plusOptions();
            break;
        case 'JBPP Format 1':
            costs.Quartweek = 1;
            addrest(tuition.ddl(), "2", "2 weeks", "126300");
            addrest(tuition.ddl(), "4", "4 weeks", "198700");
            addrest(tuition.ddl(), "6", "6 weeks", "276516");
            addrest(tuition.ddl(), "8", "8 weeks", "352332");
            break;
        case 'JBPP Format 2':
            costs.Quartweek = 1;
            addrest(tuition.ddl(), "10", "10 weeks", "198700");
            break;
        case 'JBPP Format 3':
            costs.Quartweek = 2;
            addrest(tuition.ddl(), "1", "1 quarter", "355825");
            addrest(tuition.ddl(), "2", "2 quarters", "669050");
            addrest(tuition.ddl(), "3", "3 quarters", "926073");
            addrest(tuition.ddl(), "4", "4 quarters", "1183096");
            addrest(tuition.ddl(), "5", "5 quarters", "1450621");
            addrest(tuition.ddl(), "6", "6 quarters", "1718146");
            addrest(tuition.ddl(), "7", "7 quarters", "1985671");
            addrest(tuition.ddl(), "8", "8 quarters", "2253196");
            break;
        case 'JBPP Format 4':
            costs.Quartweek = 1;
            addrest(tuition.ddl(), "2", "2 weeks", "226250");
            addrest(tuition.ddl(), "4", "4 weeks", "431250");
            addrest(tuition.ddl(), "6", "6 weeks", "627500");
            addrest(tuition.ddl(), "8", "8 weeks", "815000");
            break;
        case 'Mini Course: single (off-season)':
            costs.Quartweek = 1;
            addrest(tuition.ddl(), "1", "1 weeks", "69725");
            addrest(tuition.ddl(), "2", "2 weeks", "132456");
            break;
        case 'Mini Course: pair (off-season)':
            addrest(tuition.ddl(), "1", "1 weeks", "61725");
            addrest(tuition.ddl(), "2", "2 weeks", "116450");
            break;
        case 'Mini Course: single (peak season)':
            costs.Quartweek = 1;
            addrest(tuition.ddl(), "1", "1 weeks", "89700");
            addrest(tuition.ddl(), "2", "2 weeks", "166700");
            break;
        case 'Mini Course: pair (peak season)':
            addrest(tuition.ddl(), "1", "1 weeks", "81700");
            addrest(tuition.ddl(), "2", "2 weeks", "150900");
            break;
        case "Internship Program":
            costs.Quartweek = 1;
            addrest(tuition.ddl(), "10", "10 weeks (JBPP 6 weeks + 4 weeks)", "348720");
            addrest(tuition.ddl(), "12", "12 weeks (JBPP 8 weeks + 4 weeks)", "425536");
            break;
        case "Hybrid: Private/CALL": // temp name will change
            costs.Quartweek = 1;
            addrest(tuition.ddl(), "1", "1 week", "");
            addrest(tuition.ddl(), "2", "2 weeks", "");
            addrest(tuition.ddl(), "3", "3 weeks", "");
            addrest(tuition.ddl(), "4", "4 weeks", "");
            addrest(tuition.ddl(), "5", "5 weeks", "");
            addrest(tuition.ddl(), "6", "6 weeks", "");
            addrest(tuition.ddl(), "7", "7 weeks", "");
            addrest(tuition.ddl(), "8", "8 weeks", "");
            addrest(tuition.ddl(), "9", "9 weeks", "");
            addrest(tuition.ddl(), "10", "10 weeks", "");
            addrest(tuition.ddl(), "11", "11 weeks", "");
            addrest(tuition.ddl(), "12", "12 weeks", "");
            break;
        case "Refresher": // temp name will change
            costs.Quartweek = 3;
            addrest(tuition.ddl(), "1", "6 months", "399100");
            addrest(tuition.ddl(), "2", "1 year", "757200");
            addrest(tuition.ddl(), "2", "1 year, with option to extend", "757200");
            break;
        default:
            break;
    }
    SelectSubCat();
}
function plusOptions() {
    var a = course.ddlText();
    switch (a) {
        case 'Select a course':
            PlusOptionC();
        case 'AIJP':
            PlusOptionC();
            break;
        case 'AJSP':
            PlusOptionC();
            break;
        case 'AIJP Plus':
            jbbp.ddl().style.display = "";
            bunka.ddl().style.display = "";
            jbbpTotal.ddl().style.display = "";
            jbbpTotal.labelText().innerHTML = "I'd like to enroll in JBPP (tick box)";
            bunkaTotal.ddl().style.display = "";
            bunkaTotal.labelText().innerHTML = "I'd like to enroll in the Culture Seminar course (tick box)";
            PlusOptionB();
            break;
        case 'AJSP Plus':
            jbbp.ddl().style.display = "";
            bunka.ddl().style.display = "";
            jbbpTotal.ddl().style.display = "";
            jbbpTotal.labelText().innerHTML = "I'd like to enroll in JBPP (tick box)";
            bunkaTotal.ddl().style.display = "";
            bunkaTotal.labelText().innerHTML = "I'd like to enroll in the Culture Seminar course (tick box)";
            PlusOptionB_AJSP();
            break;
        case 'SILAC':
            PlusOptionC();
            break;
        case 'SILAC Plus':
            jbbp.ddl().style.display = "none";
            bunka.ddl().style.display = "";
            jbbpTotal.labelText().innerHTML = "";
            jbbpTotal.ddl().style.display = "none";
            PlusOptionB();
            bunkaCheck();
            break;
        case 'University Japanese Program':
            PlusOptionC();
            break;
        case 'Japanese Language & Culture Program':
            PlusOptionC();
            break;
        case 'Acceleration Program':
            PlusOptionC();
            break;
        case 'Discovery: 12 private lessons/week + tour':
            PlusOptionD();
            break;
        case 'Discovery: 18 private lessons/week + tour':
            PlusOptionD();
            break;
        case 'Discovery: group lessons + tour':
            PlusOptionD();
            break;
        case 'Internship Program':
            PlusOptionC();
            break;
        case 'JBPP Format 1':
            PlusOptionC();
            break;
        case 'JBPP Format 2':
            PlusOptionC();
            break;
        case 'JBPP Format 3':
            PlusOptionC();
            break;
        case 'JBPP Format 4':
            PlusOptionC();
            break;
        case 'Mini Course: (off-season)':
            PlusOptionE();
            break;
        case 'Mini Course: (peak season)':
            PlusOptionE();
            break;
        case 'Hybrid: Private/CALL': //name will change
            RefreshFill();
            dateFill();
            break;
        default:
            break;
    }
}
function PlusOptionB() {
    callHours.ddl().style.display = "";
    pvtHours.ddl().style.display = "";
    tour.ddl().style.display = "";
    removeAllOptions(callHours.ddl());
    addrest(callHours.ddl(), "0", "Select hours of CALL seminars per week", "0");
    addrest(callHours.ddl(), "0", "0 hours/week", "0");
    addrest(callHours.ddl(), "1", "1 hour/week", "1600");
    addrest(callHours.ddl(), "2", "2 hours/week", "3200");
    addrest(callHours.ddl(), "3", "3 hours/week", "4800");
    addrest(callHours.ddl(), "4", "4 hours/week", "6400");
    addrest(callHours.ddl(), "5", "5 hours/week", "8000");
    removeAllOptions(pvtHours.ddl());
    addrest(pvtHours.ddl(), "0", "Select hours of private lessons per week", "0");
    addrest(pvtHours.ddl(), "0", "0 hours/week", "0");
    addrest(pvtHours.ddl(), "1", "1 hour/week", "3300");
    addrest(pvtHours.ddl(), "2", "2 hours/week", "6600");
    addrest(pvtHours.ddl(), "3", "3 hours/week", "9900");
    addrest(pvtHours.ddl(), "4", "4 hours/week", "13200");
    addrest(pvtHours.ddl(), "5", "5 hours/week", "16500");
    removeAllOptions(tour.ddl());
    if ((course.ddlText() == 'AIJP Plus') || (course.ddlText() == 'AJSP Plus')) {
        addrest(tour.ddl(), "0", "Select tour length", "0");
    }
    if (course.ddlText() == 'SILAC Plus') {
        addrest(tour.ddl(), "0", "Select tour length", "0");
    }
    addrest(tour.ddl(), "3", "3 days", "38100");
    addrest(tour.ddl(), "5", "5 days", "68000");
    costs.callCost = 0;
    costs.pvtCost = 0;
    costs.tourCost = 0;
    costs.jbbpCost = 0;
}
function PlusOptionB_AJSP() {
    pvtHours.ddl().style.display = "";
    callHours.ddl().style.display = "none";
    tour.ddl().style.display = "";
    removeAllOptions(pvtHours.ddl());
    addrest(pvtHours.ddl(), "0", "Select hours of private lessons per week", "0");
    addrest(pvtHours.ddl(), "0", "0 hours/week", "0");
    addrest(pvtHours.ddl(), "1", "1 hour/week", "3300");
    addrest(pvtHours.ddl(), "2", "2 hours/week", "6600");
    addrest(pvtHours.ddl(), "3", "3 hours/week", "9900");
    addrest(pvtHours.ddl(), "4", "4 hours/week", "13200");
    addrest(pvtHours.ddl(), "5", "5 hours/week", "16500");
    removeAllOptions(tour.ddl());
    if ((course.ddlText() == 'AIJP Plus') || (course.ddlText() == 'AJSP Plus')) {
        addrest(tour.ddl(), "0", "Select tour length", "0");
    }
    if (course.ddlText() == 'SILAC Plus') {
        addrest(tour.ddl(), "0", "Select tour length", "0");
    }
    addrest(tour.ddl(), "3", "3 days", "38100");
    addrest(tour.ddl(), "5", "5 days", "68000");
    costs.callCost = 0;
    costs.pvtCost = 0;
    costs.tourCost = 0;
    costs.jbbpCost = 0;
}
function PlusOptionC() {
    jbbp.ddl().style.display = "none";
    callHours.ddl().style.display = "none";
    pvtHours.ddl().style.display = "none";
    tour.ddl().style.display = "none";
    jbbpTotal.labelText().innerHTML = "";
    jbbpTotal.ddl().style.display = "none";
    removeAllOptions(callHours.ddl());
    addrest(callHours.ddl(), "0", "Not available for this course", "0");
    removeAllOptions(pvtHours.ddl());
    addrest(pvtHours.ddl(), "0", "Not available for this course", "0");
    removeAllOptions(tour.ddl());
    addrest(tour.ddl(), "0", "Not available for this course", "0");
}
function PlusOptionD() {
    jbbp.ddl().style.display = "none";
    callHours.ddl().style.display = "none";
    pvtHours.ddl().style.display = "none";
    tour.ddl().style.display = "";
    removeAllOptions(tour.ddl());
    addrest(tour.ddl(), "0", "Select tour length", "0");
    addrest(tour.ddl(), "3", "3 days", "57000");
    addrest(tour.ddl(), "5", "5 days", "90000");
    addrest(tour.ddl(), "8", "8 days", "136000");
    addrest(tour.ddl(), "10", "10 days", "160000");
    addrest(tour.ddl(), "12", "12 days", "180000");

}
function PlusOptionE() {
    jbbp.ddl().style.display = "none";
    callHours.ddl().style.display = "none";
    pvtHours.ddl().style.display = "none";
    tour.ddl().style.display = "";
    removeAllOptions(tour.ddl());
    addrest(tour.ddl(), "0", "Select group size", "0");
    addrest(tour.ddl(), "1", "Single", "1");
    addrest(tour.ddl(), "2", "Pair", "2");
}
function RefreshFill() {
    jbbp.ddl().style.display = "none";
    callHours.ddl().style.display = "none";
    pvtHours.ddl().style.display = "none";
    tour.ddl().style.display = "none";
    jbbpTotal.labelText().innerHTML = "";
    jbbpTotal.ddl().style.display = "none";
    refreshDaysPer.ddl().style.display = "";
    refreshLessonsDay.ddl().style.display = "";
    refreshCall.ddl().style.display = "";
    refreshPrivate.ddl().style.display = "";
    startYear.ddl().style.display = "";
    startMonth.ddl().style.display = "";
    startDate.ddl().style.display = "";
    refCallPerH.ddl().style.display = "";
    refCallTHours.ddl().style.display = "";
    refCallTCost.ddl().style.display = "";
    refPrivPerH.ddl().style.display = "";
    refPrivTHours.ddl().style.display = "";
    refPrivTCost.ddl().style.display = "";
    // fill days per week
    addrest(refreshDaysPer.ddl(), "", "How many days a week?", "");
    addrest(refreshDaysPer.ddl(), "4", "4 days a week", "4");
    addrest(refreshDaysPer.ddl(), "5", "5 days a week", "5");
    //fill lessons per day
    addrest(refreshLessonsDay.ddl(), "", "How many lessons a day?", "");
    addrest(refreshLessonsDay.ddl(), "3", "3 lessons a day", "5");
    addrest(refreshLessonsDay.ddl(), "4", "4 lessons a day", "5");
    addrest(refreshLessonsDay.ddl(), "5", "5 lessons a day", "5");
    addrest(refreshLessonsDay.ddl(), "6", "6 lessons a day", "5");
    addrest(refreshCall.ddl(), -1, "How many CALL seminars?", "");
    addrest(refreshPrivate.ddl(), -1, "How many private lessons?", "");
}
//fills droplist 'subcat'
function SelectSubCat() {
    removeAllOptions(housingSub.ddl());
    bedchoice();
    housingSub.ddl().style.display = "none";
    addrent(housingSub.ddl(), "0", "Select a subcategory", "0");
    var a = housing.ddlValue();
    if (costs.Quartweek == "1") {
        switch (a) {
            case 'Not needed':
                housingSub.ddl().style.display = "none";
                depositB.labelText().innerHTML = "";
                yachin.labelText().innerHTML = 0;
                costs.rent = 0;
                costs.deposit = 0;
                costs.Totfuton = 0;
                costs.futonCost = 0;
                nobed();
                break;
            case 'Homestay':
                depositB.labelText().innerHTML = "";
                //            housingSub.ddl().style.display = "";
                //            addrent(housingSub.ddl(), "20000", "Homestay: 20,000 yen/week", "50000");
                break;
            case 'Dormitory-style Accommodations':
                housingSub.ddl().style.display = "";
                // addrent(housingSub.ddl(), "17000", "Yamamoto House (single occupancy): 17,000 yen/week", "50000");
                addrent(housingSub.ddl(), "17000", "Student Village (single occupancy): 17,000 yen/week", "50000");
                addrent(housingSub.ddl(), "9000", "Student Village (two students, arranged by Yamasa): 9,000 yen/week", "50000");
                addrent(housingSub.ddl(), "17000", "Villa 2 (single occupancy): 17,000 yen/week", "50000");
                break;
            case 'Studio Apartments':
                housingSub.ddl().style.display = "";
                addrent(housingSub.ddl(), "21500", "Villa 1 (single occupancy): 21,500 yen/week", "70000");
                addrent(housingSub.ddl(), "10000", "Villa 1 (two students, arranged by Yamasa): 10,000 yen/week", "70000");
                addrent(housingSub.ddl(), "9000", "Villa 1 (two students enter and leave together): 9,000 yen/week", "70000");
                addrent(housingSub.ddl(), "11000", "Villa 1 (one student, one non-student enter and leave together): 11,000 yen/week", "70000");
                addrent(housingSub.ddl(), "18500", "Villa 3 or 4 (single occupancy): 18,500 yen/week", "70000");
                addrent(housingSub.ddl(), "10000", "Villa 3 or 4 (two students, arranged by Yamasa): 10,000 yen/week", "70000");
                addrent(housingSub.ddl(), "9000", "Villa 3 or 4 (two students enter and leave together): 9,000 yen/week", "70000");
                addrent(housingSub.ddl(), "11000", "Villa 3 or 4 (one student, one non-student enter and leave together): 11,000 yen/week", "70000");
                addrent(housingSub.ddl(), "25000", "Villa 5 (single occupancy, type A): 25,000 yen/week", "70000");
                addrent(housingSub.ddl(), "25000", "Villa 5 (single occupancy, type B): 25,000 yen/week", "70000");
                addrent(housingSub.ddl(), "25000", "Hane (type A, no balcony): 25,000 yen/week", "70000");
                addrent(housingSub.ddl(), "25000", "Hane (type A, small balcony): 25,000 yen/week", "70000");
                addrent(housingSub.ddl(), "25000", "Hane (type A, large balcony): 25,000 yen/week", "70000");
                addrent(housingSub.ddl(), "25000", "Hane (type B, no balcony): 25,000 yen/week", "70000");
                addrent(housingSub.ddl(), "25000", "Hane (type B, large balcony): 25,000 yen/week", "70000");
                addrent(housingSub.ddl(), "21500", "Residence K (single occupancy): 21,500 yen/week", "70000");
                addrent(housingSub.ddl(), "10000", "Residence K (two students, arranged by Yamasa): 10,000 yen/week", "70000");
                addrent(housingSub.ddl(), "9000", "Residence K (two students enter and leave together): 9,000 yen/week", "70000");
                addrent(housingSub.ddl(), "11000", "Residence K (one student, one non-student enter and leave together): 11,000 yen/week", "70000");
                addrent(housingSub.ddl(), "21500", "Residence U (single occupancy): 21,500 yen/week", "70000");
                addrent(housingSub.ddl(), "10000", "Residence U (two students, arranged by Yamasa): 10,000 yen/week", "70000");
                addrent(housingSub.ddl(), "9000", "Residence U (two students enter and leave together): 9,000 yen/week", "70000");
                addrent(housingSub.ddl(), "11000", "Residence U (one student, one non-student enter and leave together): 11,000 yen/week", "70000");
                break;
            case 'Larger Apartments & Family Accommodations':
                housingSub.ddl().style.display = "";
                addrent(housingSub.ddl(), "20000", "Residence L, 2DK (single occupancy): 20,000 yen/week", "70000");
                addrent(housingSub.ddl(), "10500", "Residence L, 2DK (two students, arranged by Yamasa): 10,500 yen/week", "70000");
                addrent(housingSub.ddl(), "9500", "Residence L, 2DK (two students enter and leave together): 9,500 yen/week", "70000");
                addrent(housingSub.ddl(), "11500", "Residence L, 2DK (one student, one non-student enter and leave together): 11,500 yen/week", "70000");
                addrent(housingSub.ddl(), "22500", "Residence L, 3DK (single occupancy): 22,500 yen/week", "70000");
                addrent(housingSub.ddl(), "11500", "Residence L, 3DK (two students, arranged by Yamasa): 11,500 yen/week", "70000");
                addrent(housingSub.ddl(), "10500", "Residence L, 3DK (two students enter and leave together): 10,500 yen/week", "70000");
                addrent(housingSub.ddl(), "9000", "Residence L, 3DK (three students enter and leave together): 9,000 yen/week", "70000");
                addrent(housingSub.ddl(), "7000", "Residence L, 3DK (four students enter and leave together): 7,000 yen/week", "70000");
                addrent(housingSub.ddl(), "12500", "Residence L, 3DK (one student, one non-student enter and leave together): 12,500 yen/week", "70000");
                break;
            default:
                costs.rent = 0;
                total();
                break;
        }
    }


    if (costs.Quartweek == "2") {
        switch (a) {
            case 'Not needed':
                housingSub.ddl().style.display = "none";
                depositB.labelText().innerHTML = "";
                yachin.labelText().innerHTML = 0;
                costs.rent = 0;
                costs.deposit = 0;
                costs.Totfuton = 0;
                costs.futonCost = 0;
                nobed();
                break;
            case 'Homestay':
                depositB.labelText().innerHTML = "";
                //            housingSub.ddl().style.display = "";
                //            addrent(housingSub.ddl(), "225000", "Homestay: 225,000 yen/quarter", "50000");
                //            nobed();
                break;
            case 'Dormitory-style Accommodations':
                housingSub.ddl().style.display = "";
                // addrent(housingSub.ddl(), "195000", "Yamamoto House (single occupancy): 195,000 yen/quarter", "50000");
                addrent(housingSub.ddl(), "195000", "Student Village (single occupancy): 195,000 yen/quarter", "50000");
                addrent(housingSub.ddl(), "114000", "Student Village (two students, arranged by Yamasa): 114,000 yen/quarter", "50000");
                addrent(housingSub.ddl(), "195000", "Villa 2 (single occupancy): 195,000 yen/quarter", "50000");
                break;
            case 'Studio Apartments':
                housingSub.ddl().style.display = "";
                addrent(housingSub.ddl(), "147000", "Villa 1 (single occupancy): 147,000 yen/quarter", "70000");
                addrent(housingSub.ddl(), "90000", "Villa 1 (two students, arranged by Yamasa): 90,000 yen/quarter", "70000");
                addrent(housingSub.ddl(), "75000", "Villa 1 (two students enter and leave together): 75,000 yen/quarter", "70000");
                addrent(housingSub.ddl(), "97500", "Villa 1 (one student, one non-student enter and leave together): 97,500 yen/quarter", "70000");
                addrent(housingSub.ddl(), "142500", "Villa 3 or 4 (single occupancy): 142,500 yen/quarter", "70000");
                addrent(housingSub.ddl(), "90000", "Villa 3 or 4 (two students, arranged by Yamasa): 90,000 yen/quarter", "70000");
                addrent(housingSub.ddl(), "75000", "Villa 3 or 4 (two students enter and leave together): 75,000 yen/quarter", "70000");
                addrent(housingSub.ddl(), "97500", "Villa 3 or 4 (one student, one non-student enter and leave together): 97,500 yen/quarter", "70000");
                addrent(housingSub.ddl(), "195000", "Villa 5 (single occupancy, type A): 195,000 yen/quarter", "70000");
                addrent(housingSub.ddl(), "204000", "Villa 5 (single occupancy, type B): 204,000 yen/quarter", "70000");
                addrent(housingSub.ddl(), "159000", "Hane (type A, no balcony): 159,000 yen/quarter", "70000");
                addrent(housingSub.ddl(), "168000", "Hane (type A, small balcony): 168,000 yen/quarter", "70000");
                addrent(housingSub.ddl(), "177000", "Hane (type A, large balcony): 177,000 yen/quarter", "70000");
                addrent(housingSub.ddl(), "177000", "Hane (type B, no balcony): 177,000 yen/quarter", "70000");
                addrent(housingSub.ddl(), "186000", "Hane (type B, large balcony): 186,000 yen/quarter", "70000");
                addrent(housingSub.ddl(), "147000", "Residence K (single occupancy): 147,000 yen/quarter", "70000");
                addrent(housingSub.ddl(), "90000", "Residence K (two students, arranged by Yamasa): 90,000 yen/quarter", "70000");
                addrent(housingSub.ddl(), "75000", "Residence K (two students enter and leave together): 75,000 yen/quarter", "70000");
                addrent(housingSub.ddl(), "97500", "Residence K (one student, one non-student enter and leave together): 97,500 yen/quarter", "70000");
                addrent(housingSub.ddl(), "147000", "Residence U (single occupancy): 147,000 yen/quarter", "70000");
                addrent(housingSub.ddl(), "90000", "Residence U (two students, arranged by Yamasa): 90,000 yen/quarter", "70000");
                addrent(housingSub.ddl(), "75000", "Residence U (two students enter and leave together): 75,000 yen/quarter", "70000");
                addrent(housingSub.ddl(), "97500", "Residence U (one student, one non-student enter and leave together): 97,500 yen/quarter", "70000");
                break;
            case 'Larger Apartments & Family Accommodations':
                housingSub.ddl().style.display = "";
                addrent(housingSub.ddl(), "201000", "Residence L, 2DK (single occupancy): 201,000 yen/quarter", "70000");
                addrent(housingSub.ddl(), "102000", "Residence L, 2DK (two students, arranged by Yamasa): 102,000 yen/quarter", "70000");
                addrent(housingSub.ddl(), "87000", "Residence L, 2DK (two students enter and leave together): 87,000 yen/quarter", "70000");
                addrent(housingSub.ddl(), "109500", "Residence L, 2DK (one student, one non-student enter and leave together): 109,500 yen/quarter", "70000");
                addrent(housingSub.ddl(), "216000", "Residence L, 3DK (single occupancy): 216,000 yen/quarter", "70000");
                addrent(housingSub.ddl(), "109500", "Residence L, 3DK (two students, arranged by Yamasa): 109,500 yen/quarter", "70000");
                addrent(housingSub.ddl(), "94500", "Residence L, 3DK (two students enter and leave together): 94,500 yen/quarter", "70000");
                addrent(housingSub.ddl(), "76500", "Residence L, 3DK (three students enter and leave together): 76,500 yen/quarter", "70000");
                addrent(housingSub.ddl(), "55500", "Residence L, 3DK (four students enter and leave together): 55,500 yen/quarter", "70000");
                addrent(housingSub.ddl(), "117000", "Residence L, 3DK (one student, one non-student enter and leave together): 117,000 yen/quarter", "70000");
                break;
            default:
                costs.rent = 0;
                total();
                break;
        }
    }
    if (costs.Quartweek == "3") {
        switch (a) {
            case 'Not needed':
                housingSub.ddl().style.display = "none";
                depositB.labelText().innerHTML = "";
                yachin.labelText().innerHTML = 0;
                costs.rent = 0;
                costs.deposit = 0;
                costs.Totfuton = 0;
                costs.futonCost = 0;
                nobed();
                break;
            case 'Homestay':
                depositB.labelText().innerHTML = "";
                //            housingSub.ddl().style.display = "";
                //            addrent(housingSub.ddl(), "225000", "Homestay: 225,000 yen/6 months", "50000");
                //            nobed();
                break;
            case 'Dormitory-style Accommodations':
                housingSub.ddl().style.display = "";
                // addrent(housingSub.ddl(), "195000", "Yamamoto House (single occupancy): 195,000 yen/6 months", "50000");
                addrent(housingSub.ddl(), "390000", "Student Village (single occupancy): 390,000 yen/6 months", "50000");
                addrent(housingSub.ddl(), "228000", "Student Village (two students, arranged by Yamasa): 228,000 yen/6 months", "50000");
                addrent(housingSub.ddl(), "390000", "Villa 2 (single occupancy): 390,000 yen/6 months", "50000");
                break;
            case 'Studio Apartments':
                housingSub.ddl().style.display = "";
                addrent(housingSub.ddl(), "294000", "Villa 1 (single occupancy): 294,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "180000", "Villa 1 (two students, arranged by Yamasa): 180,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "150000", "Villa 1 (two students enter and leave together): 150,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "195000", "Villa 1 (one student, one non-student enter and leave together): 195,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "285000", "Villa 3 or 4 (single occupancy): 285,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "180000", "Villa 3 or 4 (two students, arranged by Yamasa): 180,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "150000", "Villa 3 or 4 (two students enter and leave together): 150,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "195000", "Villa 3 or 4 (one student, one non-student enter and leave together): 195,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "390000", "Villa 5 (single occupancy, type A): 390,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "408000", "Villa 5 (single occupancy, type B): 408,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "318000", "Hane (type A, no balcony): 318,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "336000", "Hane (type A, small balcony): 336,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "354000", "Hane (type A, large balcony): 354,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "354000", "Hane (type B, no balcony): 354,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "372000", "Hane (type B, large balcony): 372,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "294000", "Residence K (single occupancy): 294,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "180000", "Residence K (two students, arranged by Yamasa): 180,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "150000", "Residence K (two students enter and leave together): 150,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "195000", "Residence K (one student, one non-student enter and leave together): 195,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "294000", "Residence U (single occupancy): 294,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "180000", "Residence U (two students, arranged by Yamasa): 180,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "150000", "Residence U (two students enter and leave together): 150,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "195000", "Residence U (one student, one non-student enter and leave together): 195,000 yen/6 months", "70000");
                break;
            case 'Larger Apartments & Family Accommodations':
                housingSub.ddl().style.display = "";
                addrent(housingSub.ddl(), "402000", "Residence L, 2DK (single occupancy): 402,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "204000", "Residence L, 2DK (two students, arranged by Yamasa): 204,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "174000", "Residence L, 2DK (two students enter and leave together): 174,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "219000", "Residence L, 2DK (one student, one non-student enter and leave together): 219,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "432000", "Residence L, 3DK (single occupancy): 432,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "219000", "Residence L, 3DK (two students, arranged by Yamasa): 219,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "189000", "Residence L, 3DK (two students enter and leave together): 189,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "153000", "Residence L, 3DK (three students enter and leave together): 153,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "111000", "Residence L, 3DK (four students enter and leave together): 111,000 yen/6 months", "70000");
                addrent(housingSub.ddl(), "234000", "Residence L, 3DK (one student, one non-student enter and leave together): 234,000 yen/6 months", "70000");
                break;
            default:
                costs.rent = 0;
                total();
                break;
        }
    }
    total();
}
// ddl filler and calculation functions
function removeAllOptions(selectbox) {
    var i;
    for (i = selectbox.options.length - 1; i >= 0; i--) {
        // selectbox.options.remove(i);
        selectbox.remove(i);
    }
}
// adds the rent  and  housing categories to the dropdown lists
function addrent(selectbox, value, text, deposit) {
    var optn = document.createElement("OPTION");
    optn.text = text;
    optn.value = value;
    optn.deposit = deposit;
    selectbox.options.add(optn);
}
function addrest(selectbox, value, text, fees) {
    var optn = document.createElement("OPTION");
    optn.text = text;
    optn.value = value;
    optn.fees = fees;
    selectbox.options.add(optn);
}
// selecting values for calculations and text boxes
function selecttuition() {
    costs.Cfees = tuition.ddlFees();
    costs.weeks = tuition.ddlValue();
    var Control = tuition.ddlText();
    if (Control == "Select study period") {
        costs.Cfees = 0;

    }
    else {
        switch (course.ddlText()) {
            case 'SILAC Plus':
                bunkaCheck();
                break;
            case 'Discovery: 12 private lessons/week + tour':
                DiscTour();
                break;
            case 'Discovery: 18 private lessons/week + tour':
                DiscTour();
                break;
            case 'Discovery: group lessons + tour':
                DiscTour();
                break;
            case 'Hybrid: Private/CALL':
                privCallFees();
                break;
            default:

                bunkabox();
                jbbpbox();
                break;
        }

    }
    coursefees.labelText().innerHTML = addCommas(costs.Cfees);
    selecttime();
    callCost();
    pvtCost();
    total();
}
function DiscTour() {
    if (tour.ddlText() != 'Select tour length') {
        costs.Cfees = parseInt(costs.Cfees) + parseInt(costs.tourCost);

        depositB.labelText().innerHTML = "";
        costs.deposit = 0;
    }
    else {
        costs.Cfees = 0;

        depositB.labelText().innerHTML = "";
        //        selecttuition();
    }
}

function selectrent() {
    if (costs.Quartweek == "2") {
        costs.deposit = housingSub.ddlDeposit();
        depositB.labelText().innerHTML = "(includes a refundable deposit of " + addCommas(costs.deposit) + " yen)";
    }
    if (housing.ddlText() == 'Select a housing category') {
        depositB.labelText().innerHTML = "";
        costs.deposit = 0;

    }
    costs.rent = housingSub.ddlValue();
    total();
}
function selectfuton() {
    costs.futonCost = futon.ddlFees();
    costs.oneOff = futon.ddlValue();
    selecttime();
    if (futon.ddlText() == "Select a futon option") {
        futonTotal.labelText().innerHTML = 0;
        costs.Totfuton = 0;
        costs.futonCost = 0;
        total();
    }
    if (futon.ddlText() == "Not needed") {
        futonTotal.labelText().innerHTML = 0;
        costs.Totfuton = 0;
        costs.futonCost = 0;
        total();
    }
}
function selecttime() {
    var c = 0;
    var d = costs.Quartweek;
    var e = costs.oneOff;
    if (tuition.ddlText() == "Not needed") {
        costs.oneOff = 0;
    }
    switch (e) {
        case "1":
            costs.Totfuton = costs.futonCost;
            c = costs.Totfuton;
            break;
        case "2":
            switch (d) {
                case 1:
                    costs.Totfuton = costs.futonCost * parseInt(costs.weeks) + 2000;
                    c = parseInt(costs.Totfuton);
                    break;
                case 2:
                    costs.Totfuton = 20000;
                    c = 20000;
                    break;
            }
    }
    futonTotal.labelText().innerHTML = addCommas(c);
    total();
}
function bedchoice() {
    removeAllOptions(futon.ddl());
    addrest(futon.ddl(), "", "Select a futon option", "0");
    var norent = tuition.ddlValue();
    if (costs.Quartweek == 2 && norent >= 2) {
        addrest(futon.ddl(), "1", "Not needed", "0");
        addrest(futon.ddl(), "1", "Buy a futon: 25,900 yen", "25900");
    }
    else if (costs.Quartweek == 3) {
        addrest(futon.ddl(), "1", "Not needed", "0");
        addrest(futon.ddl(), "1", "Buy a futon: 25,900 yen", "25900");
    }
    else {
        addrest(futon.ddl(), "1", "Not needed", "0");
        addrest(futon.ddl(), "1", "Buy a futon: 25,900 yen", "25900");
        addrest(futon.ddl(), "2", "Rent a futon: 1,500 yen/week + 2,000-yen handling fee", "1500");
    }
}
function nobed() {
    removeAllOptions(futon.ddl());
    addrest(futon.ddl(), "1", "Not needed", "0");
    futonTotal.labelText().innerHTML = 0;
    costs.Totfuton = 0;
    total();
}
function selectairport() {
    costs.pickup = airport.ddlFees();

    if (airport.ddlText() == "Select an airport pickup option") {
        airportTotal.labelText().innerHTM = 0;
        costs.pickup = 0;
    }
    airportTotal.labelText().innerHTML = addCommas(costs.pickup);
    total();
}
function total() {
    costs.Totrent = (costs.weeks * costs.rent);
    var endtotal = parseInt(costs.Cfees) + parseInt(costs.Totrent) + parseInt(costs.Totfuton) + parseInt(costs.pickup) + parseInt(costs.deposit) + parseInt(costs.plusCost);
    if (costs.Quartweek >= 1) {
        yachin.labelText().innerHTML = addCommas(costs.Totrent);
        finalTotal.labelText().innerHTML = addCommas(endtotal);
    }
    else {
        finalTotal.labelText().innerHTML = addCommas(costs.choose);
    }
}
function SelectAlt() {
    if (housing.ddlValue() == 'Homestay') {
        removeAllOptions(housingSub.ddl());
        if (costs.Quartweek == "1") {
            costs.rent = 20000;
            costs.deposit = 0;
            // no deposit for short term students.
            total();
            nobed();
        }
        else if (costs.Quartweek == "3") {
            costs.rent = 450000;
            costs.deposit = 0;
            // no deposit for short term students.
            total();
            nobed();
        }
        else {
            costs.rent = 225000;

            costs.deposit = 50000;
            depositB.labelText().innerHTML = "(includes a refundable deposit of " + addCommas(costs.deposit) + " yen)";

            total();
            nobed();
        }
        costs.Totfuton = 0;

    }
}
function plusHours() {


    var spareHours = 0;

    var call = callHours.ddlValue();
    var pvt = pvtHours.ddlValue();
    var a = 3300;
    removeAllOptions(pvtHours.ddl());
    pvtTotal.ddl().innerHTML = "";
    pvtTotal.ddl().style.display = "none";
    costs.pvtCost = 0;
    spareHours = 5 - call;
    var b = spareHours;
    totalPlusCosts();
    addrest(pvtHours.ddl(), "0", "Select hours of private lessons per week", "0");
    for (i = 0; i <= b; i++) {
        if (i == 1) {
            addrest(pvtHours.ddl(), i, i + " hour/week", (i * a));
        }
        else {
            addrest(pvtHours.ddl(), i, i + " hours/week", (i * a));
        }

    }


}
function callCost() {
    var a = parseInt(callHours.ddlFees());
    var b = course.ddlText();
    switch (b) {
        case "AIJP Plus":
            if (callHours.ddlText() != "Select hours of CALL seminars per week") {
                if (tuition.ddlText() == "Select study period") {
                    costs.callCost = (a * 10);
                    callTotal.ddl().style.display = "";
                    callTotal.labelText().innerHTML = "<div class=\"plusoptions\">quarterly fee for CALL seminars (10 weeks per quarter): " + addCommas(costs.callCost) + " yen</div>";
                }
                else {
                    costs.callCost = (a * costs.weeks * 10);
                    callTotal.ddl().style.display = "";
                    callTotal.labelText().innerHTML = "<div class=\"plusoptions\">CALL seminars for " + costs.weeks + "-quarter course: " + addCommas(costs.callCost) + " yen</div>";
                }
            }
            else {
                callTotal.labelText().innerHTML = "";
                callTotal.ddl().style.display = "none";
                costs.callCost = 0;
            }
            break;
        //        case "AJSP Plus": 
        //            if (callHours.ddlText() != "Select hours of CALL seminars per week") { 
        //                if (tuition.ddlText() == "Select study period") { 
        //                    costs.callCost = (a * 10); 
        //                    callTotal.ddl().style.display = ""; 
        //                    callTotal.labelText().innerHTML = "<div class=\"plusoptions\">quarterly fee for CALL seminars (10 weeks per quarter): " + addCommas(costs.callCost) + " yen</div>"; 
        //                } 
        //                else { 
        //                    costs.callCost = (a * costs.weeks * 10); 
        //                    callTotal.ddl().style.display = ""; 
        //                    callTotal.labelText().innerHTML = "<div class=\"plusoptions\">CALL seminars for " + costs.weeks + "-quarter course: " + addCommas(costs.callCost) + " yen</div>"; 
        //                } 
        //            } 
        //            else { 
        //                callTotal.labelText().innerHTML = ""; 
        //                callTotal.ddl().style.display = "none"; 
        //                costs.callCost = 0; 
        //            } 
        //            break; 
        case "SILAC Plus":
            if (callHours.ddlText() != "Select hours of CALL seminars per week") {
                if (tuition.ddlText() == "Select study period") {
                    costs.callCost = (a);
                    callTotal.ddl().style.display = "";
                    callTotal.labelText().innerHTML = "<div class=\"plusoptions\">Weekly fee for CALL seminars: " + addCommas(costs.callCost) + " yen</div>";
                }
                else {
                    costs.callCost = (a * costs.weeks);
                    callTotal.ddl().style.display = "";
                    callTotal.labelText().innerHTML = "<div class=\"plusoptions\">CALL seminars for " + costs.weeks + "-week course: " + addCommas(costs.callCost) + " yen</div>";
                }
            }
            else {
                callTotal.labelText().innerHTML = "";
                callTotal.ddl().style.display = "none";
                costs.callCost = 0;
            }
            break;
        default:
            callTotal.labelText().innerHTML = ""
            callTotal.ddl().style.display = "none";
            break;
    }
    totalPlusCosts();

}
function pvtCost() {
    var a = parseInt(pvtHours.ddlFees());
    var b = course.ddlText();
    switch (b) {
        case "AIJP Plus":
            if (pvtHours.ddlText() != "Select hours of private lessons per week") {
                if (tuition.ddlText() == "Select study period") {
                    costs.pvtCost = (a * 10);
                    pvtTotal.ddl().style.display = "";
                    pvtTotal.labelText().innerHTML = "<div class=\"plusoptions\">quarterly fee for private lessons (10 weeks per quarter): " + addCommas(costs.pvtCost) + " yen</div>";
                }
                else {
                    costs.pvtCost = (a * costs.weeks * 10);
                    pvtTotal.ddl().style.display = "";
                    pvtTotal.labelText().innerHTML = "<div class=\"plusoptions\">Private lessons for " + costs.weeks + "-quarter course: " + addCommas(costs.pvtCost) + " yen</div>";
                }
            }
            else {
                pvtTotal.labelText().innerHTML = "";
                pvtTotal.ddl().style.display = "none";
                costs.pvtCost = 0;
            }
            break;
        case "AJSP Plus":
            if (pvtHours.ddlText() != "Select hours of private lessons per week") {
                if (tuition.ddlText() == "Select study period") {
                    costs.pvtCost = (a * 10);
                    pvtTotal.ddl().style.display = "";
                    pvtTotal.labelText().innerHTML = "<div class=\"plusoptions\">quarterly fee for private lessons (10 weeks per quarter): " + addCommas(costs.pvtCost) + " yen</div>";
                }
                else {
                    costs.pvtCost = (a * costs.weeks * 10);
                    pvtTotal.ddl().style.display = "";
                    pvtTotal.labelText().innerHTML = "<div class=\"plusoptions\">Private lessons for " + costs.weeks + "-quarter course: " + addCommas(costs.pvtCost) + " yen</div>";
                }
            }
            else {
                pvtTotal.labelText().innerHTML = "";
                pvtTotal.ddl().style.display = "none";
                costs.pvtCost = 0;
            }
            break;
        case "SILAC Plus":
            if (pvtHours.ddlText() != "Select hours of private lessons per week") {
                if (tuition.ddlText() == "Select study period") {
                    costs.pvtCost = (a);
                    pvtTotal.ddl().style.display = "";
                    pvtTotal.labelText().innerHTML = "<div class=\"plusoptions\">Weekly fee for private lessons: " + addCommas(costs.pvtCost) + " yen</div>";
                }
                else {
                    costs.pvtCost = (a * costs.weeks);
                    pvtTotal.ddl().style.display = "";
                    pvtTotal.labelText().innerHTML = "<div class=\"plusoptions\">Private lessons for " + costs.weeks + "-week course: " + addCommas(costs.pvtCost) + " yen</div>";
                }
            }
            else {
                pvtTotal.labelText().innerHTML = "";
                pvtTotal.ddl().style.display = "none";
                costs.pvtCost = 0;
            }
            break;
        default:
            break;
    }
    totalPlusCosts();
}
function tourcost() {
    if ((tour.ddlText() == "Select tour length") || (tour.ddlText() == "Select tour length")) {
        tourTotal.labelText().innerHTML = "";
        tourTotal.ddl().style.display = "";
        costs.tourCost = 0;
        selecttuition();
    }
    else if ((course.ddlText() == "Discovery pvt12") || (course.ddlText() == "Discovery pvt18") || (course.ddlText() == "Discovery group")) {
        tourTotal.labelText().innerHTML = "";
        tourTotal.ddl().style.display = "";
        costs.tourCost = tour.ddlFees();
        selecttuition();
    }
    else {
        tourTotal.ddl().style.display = "";
        tourTotal.labelText().innerHTML = "<div class=\"plusoptions\">Cost of " + tour.ddlValue() + "-day tour: " + addCommas(tour.ddlFees()) + " yen</div>";
        costs.tourCost = tour.ddlFees();
    }
    totalPlusCosts();
}
function jbbpbox() {
    if (jbbp.ddl().checked == 1) {
        var a = tuition.ddlValue();
        switch (a) {
            case '0':
                jbbpTotal.ddl().style.display = "";
                jbbpTotal.labelText().innerHTML = "JBBP course: 92,100 yen per quarter (3 quarters maximum)";
                costs.jbbpCost = 92100;
                break;
            case '1':
                jbbpTotal.ddl().style.display = "";
                jbbpTotal.labelText().innerHTML = "JBBP course for 1 quarter: 92,100 yen";
                costs.jbbpCost = 92100;
                break;
            case '2':
                jbbpTotal.ddl().style.display = "";
                jbbpTotal.labelText().innerHTML = "JBBP course for 2 quarters: 184,200 yen";
                costs.jbbpCost = 184200;
                break;
            case '3':
            case '4':
            case '5':
            case '6':
            case '7':
            case '8':
                jbbpTotal.ddl().style.display = "";
                jbbpTotal.labelText().innerHTML = "JBBP course for 3 quarters (maximum allowed): 276,300 yen";
                costs.jbbpCost = 276300;
                break;
            default:
                jbbpTotal.ddl().style.display = "";
                jbbpTotal.labelText().innerHTML = "I'd like to enroll in JBPP (tick box)";
                costs.jbbpCost = 92100;
                break;


        }
    }
    else {
        if ((course.ddlText() == 'AIJP Plus') || (course.ddlText() == 'AJSP Plus') || (course.ddlText() == 'SILAC Plus')) {
            jbbpTotal.ddl().style.display = "";
            jbbpTotal.labelText().innerHTML = "I'd like to enroll in JBPP (tick box)";
            costs.jbbpCost = 0;
        }
        else {
            jbbpTotal.labelText().innerHTML = "";
            jbbpTotal.ddl().style.display = "none";
            costs.jbbpCost = 0;
        }
    }
    totalPlusCosts();
}

function bunkachange() {

    if (bunka.ddl().checked == 1) {
        if ((course.ddlText() == 'AIJP Plus') || (course.ddlText() == 'AJSP Plus')) {
            costs.bunkaCost = (37800 * tuition.ddlValue());
            if (costs.bunkaCost == 0) {
                bunkaTotal.ddl().style.display = "";
                bunkaTotal.labelText().innerHTML = "Culture Seminar course: 37,800 yen per quarter";
                costs.bunkaCost = 37800
            }
            else {
                bunkaTotal.ddl().style.display = "";
                bunkaTotal.labelText().innerHTML = "Culture Seminar course for " + costs.weeks + " quarters: " + addCommas(costs.bunkaCost) + " yen";
            }
        }
        else {
            costs.bunkaCost = 37800;
            bunkaTotal.ddl().style.display = "";
            bunkaTotal.labelText().innerHTML = "Culture Seminar course: 37,800 yen";
        }
    }
    else {
        bunkaTotal.ddl().style.display = "";
        bunkaTotal.labelText().innerHTML = "I'd like to enroll in the Culture Seminar course (tick box)";
        costs.bunkaCost = 0;
    }

}

function bunkabox() {
    var a = course.ddlText();
    switch (a) {
        case 'SILAC Plus':
            bunkachange();
            break;
        case 'AIJP Plus':
            bunkachange();
            break;
        case 'AJSP Plus':
            bunkachange();
            break;
        default:
            break;
    }
    totalPlusCosts();
}
function bunkaCheck() {
    if (tuition.ddlValue() >= 7) {
        bunka.ddl().style.display = "";
        bunkaTotal.ddl().style.display = "";
        bunkaTotal.ddl().innerHTML = "I'd like to enroll in the Culture Seminar course (tick box)";
        bunkabox();
    }
    else {
        bunka.ddl().style.display = "none";
        bunkaTotal.ddl().style.display = "";
        bunkaTotal.ddl().innerHTML = "<span class=\"bold\">Note:</span> The Culture Seminar course is available only at 7 weeks or more.";
    }
}
function refreshLesson() {
    var total = parseInt(refreshLessonsDay.ddlValue());
    var call = refreshCall.ddl();
    var priv = refreshPrivate.ddl();
    var a = refreshCall.ddl();
    removeAllOptions(call);
    removeAllOptions(priv);
    addrest(call, -1, "How many CALL seminars?");
    addrest(priv, -1, "How many private lessons?");
    refreshCall.selectValue(-1);
    refreshPrivate.selectValue(-1);
    for (j = 0; j < total + 1; j++) {
        var adj = j + 1;
        if ((a.options[adj] === undefined) && (j <= total)) {
            if (j == 1) {
                addrest(call, j, j + " CALL seminar per day", (j));
                addrest(priv, j, j + " private lesson per day", (j));
            }
            else {
                addrest(call, j, j + " CALL seminars per day", (j));
                addrest(priv, j, j + " private lessons per day", (j));
            }

        }
        else if (j > total) {


            refreshCall.ddl().remove((refreshCall.ddl().options.length - 1));
            refreshPrivate.ddl().remove((refreshPrivate.ddl().options.length - 1));
        }
    }
    selecttuition();
}

function adjustPrivCall(e) {
    var test = e.target ? e.target : e.srcElement;
    var total = refreshLessonsDay.ddlValue() - test.value;
    if (test.id == "refreshCall") {
        if (refreshPrivate.ddlValue() !== total) {
            refreshPrivate.selectValue(total);
        }
    }
    else if (test.id == "refreshPrivate") {
        if (refreshCall.ddlValue() !== total) {
            refreshCall.selectValue(total);
        }
    }
    selecttuition();
}

function privCallFees() {
    //set up the calc
    var callHrs = refreshCall.ddlValue(),
    privHrs = refreshPrivate.ddlValue(),
    dayPer = refreshDaysPer.ddlValue(),
    weeks = tuition.ddlValue(),
    tCallHrs = (callHrs * dayPer * weeks) > 0 ? (callHrs * dayPer * weeks) : 0,
    tPrivHrs = (privHrs * dayPer * weeks) > 0 ? (privHrs * dayPer * weeks) : 0,
    callPerH = tCallHrs > 0 ? callHourFee(tCallHrs) : 0,
    privPerH = tPrivHrs > 0 ? privateHourFee(tPrivHrs) : 0,
    tCallFee = tCallHrs > 0 ? tCallHrs * callPerH : 0,
    tPrivFee = tPrivHrs > 0 ? tPrivHrs * privPerH : 0;

    refCallPerH.ddl().innerHTML = "<div class=\"plusoptions\">Hourly fee for CALL seminars: " + addCommas(callPerH) + " yen</div>";
    refCallTHours.ddl().innerHTML = "<div class=\"plusoptions\">Total CALL seminars: " + tCallHrs + " hours</div>";
    refCallTCost.ddl().innerHTML = "<div class=\"plusoptions\">Total fees for CALL seminars: " + addCommas(tCallFee) + " yen</div>";
    refPrivPerH.ddl().innerHTML = "<div class=\"plusoptions\">Hourly fee for private lessons: " + addCommas(privPerH) + " yen</div>";
    refPrivTHours.ddl().innerHTML = "<div class=\"plusoptions\">Total private lessons: " + tPrivHrs + " hours</div>";
    refPrivTCost.ddl().innerHTML = "<div class=\"plusoptions\">Total fees for private lessons: " + addCommas(tPrivFee) + " yen</div>";

    costs.Cfees = tPrivFee + tCallFee;

}

function callHourFee(tHours) {
    var scale = peekTest(),
    fee = 0;
    if (scale !== "NaN") {
        if (tHours < 15) {
            fee = scale == "Peak" ? 1700 : 1400;
        }
        else if (tHours < 85) {
            fee = scale == "Peak" ? 1600 : 1300;
        }
        else if (tHours > 84) {
            fee = scale == "Peak" ? 1500 : 1200;
        }
    }
    return fee;
}
function privateHourFee(tHours) {
    var scale = peekTest(),
    fee = 0;
    if (scale !== "NaN") {
        if (tHours < 6) {
            fee = scale == "Peak" ? 5000 : 4700;
        }
        else if (tHours < 16) {
            fee = scale == "Peak" ? 4500 : 4200;
        }
        else if (tHours < 26) {
            fee = scale == "Peak" ? 3950 : 3700;
        }
        else if (tHours < 51) {
            fee = scale == "Peak" ? 3700 : 3500;
        }
        else if (tHours < 100) {
            fee = scale == "Peak" ? 3650 : 3400;
        }
        else if (tHours > 99) {
            fee = scale == "Peak" ? 3500 : 3200;
        }
    }
    return fee;

}
function peekTest() {
    var wMonth = !parseInt(startMonth.ddlValue()) ? "NaN" : parseInt(startMonth.ddlValue());
    var ret = wMonth !== "NaN" ? wMonth !== 6 && 7 && 12 && 1 ? "off" : "Peak" : wMonth;

    return ret;
}
function dateFill() {
    var cDate = new Date(),
    year = cDate.getFullYear(),
    month = cDate.getMonth(),
    day = cDate.getDay(),
    dayDate = cDate.getDate(),
    // adjust the number of days ahead for the calendar here and in monthFill()
    rollingDate = rollingDateLine(547);
    yearFill(year, rollingDate.getFullYear());
}
function rollingDateLine(plusDays) {
    var cDate = new Date();
    var cYear = cDate.getFullYear();
    cDate.setDate(cDate.getDate() + plusDays);
    return cDate;
}
function yearFill(cYear, wYear) {
    removeAllOptions(startYear.ddl())
    addrest(startYear.ddl(), "", "Select year", "");
    for (i = cYear; i < wYear + 1; i++) {
        addrest(startYear.ddl(), i, i, i);
    }
}
function monthFill() {
    // adjust the number of days ahead for the calendar here and in dateFill()
    var cDate = new Date(),
    rollingDate = rollingDateLine(547),
    wYear = parseInt(startYear.ddlValue()),
    startM = cDate.getFullYear() === wYear ? cDate.getMonth() + 1 : 1,
    finM = 12;
    removeAllOptions(startMonth.ddl());
    addrest(startMonth.ddl(), 2011, "Select month", "");
    for (i = startM; i <= finM; i++) {
        var MM = i < 10 ? "0" + i : i;
        addrest(startMonth.ddl(), i, MM, i);
    }
}
function dayDateFill() {
    var cDate = new Date,
    rollingDate = rollingDateLine(547),
    month = parseInt(startMonth.ddlValue()),
    mCheck = [1, 3, 5, 7, 8, 10, 12],
    mLength = 30,
     convrt = {
         day: function (day) {
             var days = [],
                cDays;
             days[1] = "Monday";
             days[2] = "Tuesday";
             days[3] = "Wednesday";
             days[4] = "Thursday";
             days[5] = "Friday";
             cDays = days[day];
             return cDays;
         },
         week: function (week) {
             var weeks = [],
                cWeek;
             weeks[1] = "st";
             weeks[2] = "nd";
             weeks[3] = "rd";
             weeks[21] = "st";
             weeks[22] = "nd";
             weeks[23] = "rd";
             weeks[31] = "st";
             cWeek = weeks[week] != null ? weeks[week] : "th";
             return cWeek
         }
     };
    if (month != 2) {
        for (i = 0; i < mCheck.length; i++) {
            if (month == mCheck[i]) { mLength = 31; break; }
        }
    }
    else {
        var yCheck = parseInt(startYear.ddlValue()) / 4,
        a = yCheck - yCheck.toFixed();
        mLength = a != 0 ? 28 : 29;
    }
    if ((parseInt(startYear.ddlValue()) === rollingDate.getFullYear()) && ((parseInt(startMonth.ddlValue()) - 1) === rollingDate.getMonth())) {
        mLength = rollingDate.getDate();
    }
    removeAllOptions(startDate.ddl());
    addrest(startDate.ddl(), 2011, "Select day", "");
    cDate.setFullYear(parseInt(startYear.ddlValue()), parseInt(startMonth.ddlValue() - 1), 1);
    var dayNo = cDate.getDay();
    for (i = 1; i <= mLength; i++) {
        if ((dayNo !== 6 && dayNo !== 0)) {
            var noEnd = convrt.week(i);
            var MM = i + noEnd + " (" + convrt.day(dayNo) + ")";
            addrest(startDate.ddl(), i, MM, i);
        }
        dayNo = dayNo < 6 ? dayNo + 1 : 0;
    }
    selecttuition();
}
function totalPlusCosts() {
    if ((course.ddlText() == 'AIJP Plus') || (course.ddlText() == 'AJSP Plus') || (course.ddlText() == 'SILAC Plus')) {
        var a = parseInt(costs.callCost) + parseInt(costs.pvtCost) + parseInt(costs.tourCost) + parseInt(costs.jbbpCost) + parseInt(costs.bunkaCost);
        costs.plusCost = a;
        a = addCommas(a);
        plusTotal.ddl().style.display = "";
        plusTotal.labelText().innerHTML = "<div class=\"plussubtotal\">Subtotal for Plus options: " + a + " yen</div>";

    }
    else {
        costs.plusCost = 0;
        plusTotal.labelText().innerHTML = "";
        plusTotal.ddl().style.display = "none";
    }
    total();
}
function removeall() {
    housingSub.ddl().style.display = "none";
    bedchoice();
    removeAllOptions(housing.ddl());
    addrent(housing.ddl(), "", "Select a housing category");
    addrent(housing.ddl(), "Not needed", "Not needed");
    addrent(housing.ddl(), "Homestay", "Homestay");
    addrent(housing.ddl(), "Dormitory-style Accommodations", "Dormitory-style Accommodations");
    addrent(housing.ddl(), "Studio Apartments", "Studio Apartments");
    addrent(housing.ddl(), "Larger Apartments & Family Accommodations", "Larger Apartments & Family Accommodations");
    removeAllOptions(housingSub.ddl());
    addrent(housingSub.ddl(), "", "Select a subcategory", "0");
    removeAllOptions(airport.ddl());
    addrent(airport.ddl(), "", "Select an airport pickup option", "0");
    addrest(airport.ddl(), "1", "Not needed", "0");
    addrest(airport.ddl(), "2", "1-2 days before program start date: 6,300 yen", "6300");
    addrest(airport.ddl(), "2", "3 days before program start date: 8,300 yen", "8300");
    removeAllOptions(refreshDaysPer.ddl());
    removeAllOptions(refreshLessonsDay.ddl());
    removeAllOptions(refreshCall.ddl());
    removeAllOptions(refreshPrivate.ddl());
    removeAllOptions(startYear.ddl());
    removeAllOptions(startMonth.ddl());
    addrent(startMonth.ddl(), "", "Select month");
    removeAllOptions(startDate.ddl());
    addrent(startDate.ddl(), "", "Select day");
    refreshDaysPer.ddl().style.display = "none";
    refreshLessonsDay.ddl().style.display = "none";
    refreshCall.ddl().style.display = "none";
    refreshPrivate.ddl().style.display = "none";
    startYear.ddl().style.display = "none";
    startMonth.ddl().style.display = "none";
    startDate.ddl().style.display = "none";
    refCallPerH.ddl().innerHTML = "<div class=\"plusoptions\">Hourly fee for CALL seminars: " + 0 + " yen</div>";
    refCallTHours.ddl().innerHTML = "<div class=\"plusoptions\">Total CALL seminars: " + 0 + " hours</div>";
    refCallTCost.ddl().innerHTML = "<div class=\"plusoptions\">Total fees for CALL seminars: " + 0 + " yen</div>";
    refPrivPerH.ddl().innerHTML = "<div class=\"plusoptions\">Hourly fee for private lessons: " + 0 + " yen</div>";
    refPrivTHours.ddl().innerHTML = "<div class=\"plusoptions\">Total private lessons: " + 0 + " hours</div>";
    refPrivTCost.ddl().innerHTML = "<div class=\"plusoptions\">Total fees for private lessons: " + 0 + " yen</div>";
    coursefees.labelText().innerHTML = 0;
    yachin.labelText().innerHTML = 0;
    futonTotal.labelText().innerHTML = 0;
    airportTotal.labelText().innerHTML = 0;
    finalTotal.labelText().innerHTML = 0;
    depositB.labelText().innerHTML = "";
    callTotal.ddl().innerHTML = "";
    pvtTotal.ddl().innerHTML = "";
    tourTotal.ddl().innerHTML = "";
    plusTotal.ddl().innerHTML = "";
    jbbpTotal.ddl().innerHTML = "";
    bunkaTotal.ddl().innerHTML = "";
    jbbp.ddl().style.display = "none";
    bunka.ddl().style.display = "none";
    callTotal.ddl().style.display = "none";
    pvtTotal.ddl().style.display = "none";
    tourTotal.ddl().style.display = "none";
    plusTotal.ddl().style.display = "none";
    jbbpTotal.ddl().style.display = "none";
    bunkaTotal.ddl().style.display = "none";
    refCallPerH.ddl().style.display = "none";
    refCallTHours.ddl().style.display = "none";
    refCallTCost.ddl().style.display = "none";
    refPrivPerH.ddl().style.display = "none";
    refPrivTHours.ddl().style.display = "none";
    refPrivTCost.ddl().style.display = "none";
    costs.weeks = 0;
    costs.Cfees = 0;
    costs.rent = 0;
    costs.Quartweek = 0;
    costs.deposit = 0
    costs.Totrent = 0;
    costs.Totfuton = 0;
    costs.futonCost = 0;
    costs.pickup = 0;
    costs.oneOff = 0;
    costs.callCost = 0;
    costs.pvtCost = 0;
    costs.tour = 0;
    costs.jbbpCost = 0;
    costs.plusCost = 0;
    costs.bunkaCost = 0;
    jbbp.ddl().checked = 0;
    bunka.ddl().checked = 0;
    plusOptions();
}
function addCommas(nStr) {
    nStr += '';
    x = nStr.split('.');
    x1 = x[0];
    x2 = x.length > 1 ? '.' + x[1] : '';
    var rgx = /(\d+)(\d{3})/;
    while (rgx.test(x1)) {
        x1 = x1.replace(rgx, '$1' + ',' + '$2');
    }
    return x1 + x2;
}
//function addCommas(nStr) {
//    nStr += '';
//    x = nStr.split('.');
//    x1 = x[0];
//    x2 = x.length > 1 ? '.' + x[1] : '';
//    var rgx = /(\d+)(\d{3})/;
//    while (rgx.test(x1)) {
//        x1 = x1.replace(rgx, '$1' + ',' + '$2');
//    }
//    return x1 + x2;
//}

