﻿// JavaScript Document
function calculate(){
	//document.form1.yourFee.value = "Updating Fee Structure.";
	//get selected index property from the list in the form size
	 ind = document.form1.size.selectedIndex;
	 //get patient name
	 //patientName = document.form1.name.value;
	 //based on the selected index from the form list get the selected value and send it to case structure below
	 householdSize = document.form1.size.options[ind].value;
	 //get checked option
	 monthlyIncome = document.form1.incomeType[0].checked;
	 yearlyIncome = document.form1.incomeType[1].checked;
	 //get the income amount from the form
	 incomeAmount = document.form1.incomeAmount.value;
	 //set fee answers
	 answerL0 = "SSA: $25 Minimum Fee for each medical visit. \n\n$45 Minimum Fee for each dental visit. \n\n$60 for each dental emergency visit. \n\n$200 for prenatal visits only, $450 for delivery only or $650 for prenatal visits and delivery combined.";
	 answerL1 = "SSB: $45 Minimum Fee for each medical visit. \n\n$55 Minimum Fee for each dental visit. \n\n$85 for each dental emergency visit. \n\n$400 for prenatal visits only, $720 for delivery only or $1,120 for prenatal visits and delivery combined.";
	 answerL2 = "SSC: $65 Minimum Fee for each medical visit. \n\n$65 Minimum Fee for each dental visit. \n\n$110 for each dental emergency visit. \n\n$600 for prenatal visits only, $1,000 for delivery only or $1,600 for prenatal visits and delivery combined.";
	 answerL3 = "SSD: Patient is responsible for full charges for all CHC services.";
	 answerL4 = "SSD: Patient is responsible for full charges for all CHC services.";
	 answerL5 = "SSD: Patient is responsible for full charges for all CHC services.";
	 	
	//Update the income guidelines annually after FPL is published in the Federal Register in January
	//last update January 30, 2009
	
	//********************************************************
	//ANNUAL SCHEDULES
	//Annual income for L0 (SSA)
	yearlyL0 = new Array(9);
		yearlyL0[0] = 10830;
		yearlyL0[1] = 14570;
		yearlyL0[2] = 18310;
		yearlyL0[3] = 22050;
		yearlyL0[4] = 25790;
		yearlyL0[5] = 29530;
		yearlyL0[6] = 33270;
		yearlyL0[7] = 37010;
		yearlyL0[8] = 40750;
		yearlyL0[9] = 44490;
	//Annual income for L1 (SSB)
	yearlyL1 = new Array(9);
		yearlyL1[0] = yearlyL0[0]*1.5;
		yearlyL1[1] = yearlyL0[1]*1.5;
		yearlyL1[2] = yearlyL0[2]*1.5;
		yearlyL1[3] = yearlyL0[3]*1.5;
		yearlyL1[4] = yearlyL0[4]*1.5;
		yearlyL1[5] = yearlyL0[5]*1.5;
		yearlyL1[6] = yearlyL0[6]*1.5;
		yearlyL1[7] = yearlyL0[7]*1.5;
		yearlyL1[8] = yearlyL0[8]*1.5;
		yearlyL1[9] = yearlyL0[9]*1.5;
    //Annual income for L2 (SSC)
	yearlyL2 = new Array(9);
		yearlyL2[0] = yearlyL0[0]*2;
		yearlyL2[1] = yearlyL0[1]*2;
		yearlyL2[2] = yearlyL0[2]*2;
		yearlyL2[3] = yearlyL0[3]*2;
		yearlyL2[4] = yearlyL0[4]*2;
		yearlyL2[5] = yearlyL0[5]*2;
		yearlyL2[6] = yearlyL0[6]*2;
		yearlyL2[7] = yearlyL0[7]*2;
		yearlyL2[8] = yearlyL0[8]*2;
		yearlyL2[9] = yearlyL0[9]*2;
	//Annual income for L3 (SSD)
	yearlyL3 = new Array(9);
		yearlyL3[0] = yearlyL0[0]*2+1;
		yearlyL3[1] = yearlyL0[1]*2+1;
		yearlyL3[2] = yearlyL0[2]*2+1;
		yearlyL3[3] = yearlyL0[3]*2+1;
		yearlyL3[4] = yearlyL0[4]*2+1;
		yearlyL3[5] = yearlyL0[5]*2+1;
		yearlyL3[6] = yearlyL0[6]*2+1;
		yearlyL3[7] = yearlyL0[7]*2+1;
		yearlyL3[8] = yearlyL0[8]*2+1;
		yearlyL3[9] = yearlyL0[9]*2+1;
	//Annual income for L4 - DNA
	yearlyL4 = new Array(9);
		yearlyL4[0] = yearlyL0[0]*2+1;
		yearlyL4[1] = yearlyL0[1]*2+1;
		yearlyL4[2] = yearlyL0[2]*2+1;
		yearlyL4[3] = yearlyL0[3]*2+1;
		yearlyL4[4] = yearlyL0[4]*2+1;
		yearlyL4[5] = yearlyL0[5]*2+1;
		yearlyL4[6] = yearlyL0[6]*2+1;
		yearlyL4[7] = yearlyL0[7]*2+1;
		yearlyL4[8] = yearlyL0[8]*2+1;
		yearlyL4[9] = yearlyL0[9]*2+1;
	//Annual income for L5 - DNA
	yearlyL5 = new Array(9);
		yearlyL5[0] = yearlyL0[0]*2+1;
		yearlyL5[1] = yearlyL0[1]*2+1;
		yearlyL5[2] = yearlyL0[2]*2+1;
		yearlyL5[3] = yearlyL0[3]*2+1;
		yearlyL5[4] = yearlyL0[4]*2+1;
		yearlyL5[5] = yearlyL0[5]*2+1;
		yearlyL5[6] = yearlyL0[6]*2+1;
		yearlyL5[7] = yearlyL0[7]*2+1;
		yearlyL5[8] = yearlyL0[8]*2+1;
		yearlyL5[9] = yearlyL0[9]*2+1;
		
	//***********************************************
	//MONTHLY SCHEDULES
	//Monthly income for L0 (SSA)
		monthlyL0 = new Array(9);
		monthlyL0[0] = 903;
		monthlyL0[1] = 1214;
		monthlyL0[2] = 1526;
		monthlyL0[3] = 1838;
		monthlyL0[4] = 2149;
		monthlyL0[5] = 2461;
		monthlyL0[6] = 2773;
		monthlyL0[7] = 3084;
		monthlyL0[8] = 3396;
		monthlyL0[9] = 3708;
	//Monthly income for L1 (SSB)
	monthlyL1 = new Array(9);
		monthlyL1[0] = yearlyL1[0]/12;
		monthlyL1[1] = yearlyL1[1]/12;
		monthlyL1[2] = yearlyL1[2]/12;
		monthlyL1[3] = yearlyL1[3]/12;
		monthlyL1[4] = yearlyL1[4]/12;
		monthlyL1[5] = yearlyL1[5]/12;
		monthlyL1[6] = yearlyL1[6]/12;
		monthlyL1[7] = yearlyL1[7]/12;
		monthlyL1[8] = yearlyL1[8]/12;
		monthlyL1[9] = yearlyL1[9]/12;
	//Monthly income for L2 (SSC)
		monthlyL2 = new Array(9);
		monthlyL2[0] = yearlyL2[0]/12;
		monthlyL2[1] = yearlyL2[1]/12;
		monthlyL2[2] = yearlyL2[2]/12;
		monthlyL2[3] = yearlyL2[3]/12;
		monthlyL2[4] = yearlyL2[4]/12;
		monthlyL2[5] = yearlyL2[5]/12;
		monthlyL2[6] = yearlyL2[6]/12;
		monthlyL2[7] = yearlyL2[7]/12;
		monthlyL2[8] = yearlyL2[8]/12;
		monthlyL2[9] = yearlyL2[9]/12;
	//Monthly income for L3 (SSD)
		monthlyL3 = new Array(9);
		monthlyL3[0] = yearlyL3[0]/12;
		monthlyL3[1] = yearlyL3[1]/12;
		monthlyL3[2] = yearlyL3[3]/12;
		monthlyL3[3] = yearlyL3[3]/12;
		monthlyL3[4] = yearlyL3[4]/12;
		monthlyL3[5] = yearlyL3[5]/12;
		monthlyL3[6] = yearlyL3[6]/12;
		monthlyL3[7] = yearlyL3[7]/12;
		monthlyL3[8] = yearlyL3[8]/12;
		monthlyL3[9] = yearlyL3[9]/12;
	//Monthly income for L4 - DNA
		monthlyL4 = new Array(9);
		monthlyL4[0] = yearlyL4[0]/12;
		monthlyL4[1] = yearlyL4[1]/12;
		monthlyL4[2] = yearlyL4[2]/12;
		monthlyL4[3] = yearlyL4[3]/12;
		monthlyL4[4] = yearlyL4[4]/12;
		monthlyL4[5] = yearlyL4[5]/12;
		monthlyL4[6] = yearlyL4[6]/12;
		monthlyL4[7] = yearlyL4[7]/12;
		monthlyL4[8] = yearlyL4[8]/12;
		monthlyL4[9] = yearlyL4[9]/12;
	//Monthly income for L5 - DNA
		monthlyL5 = new Array(9);
		monthlyL5[0] = monthlyL4[0]
		monthlyL5[1] = monthlyL4[1]
		monthlyL5[2] = monthlyL4[2]
		monthlyL5[3] = monthlyL4[3]
		monthlyL5[4] = monthlyL4[4]
		monthlyL5[5] = monthlyL4[5]
		monthlyL5[6] = monthlyL4[6]
		monthlyL5[7] = monthlyL4[7]
		monthlyL5[8] = monthlyL4[8]
		monthlyL5[9] = monthlyL4[9]

	//chose what to calculate based on index(householdsize)received from the form
	switch(householdSize) {
		case "1":
			//do comparison
			if (monthlyIncome == true){
				//check monthly income
				if(incomeAmount > monthlyL5[0] || incomeAmount <= monthlyL5[0] && incomeAmount > monthlyL4[0]) document.form1.yourFee.value = answerL5;
				if(incomeAmount <= monthlyL5[0] && incomeAmount <= monthlyL4[0] && incomeAmount > monthlyL3[0]) document.form1.yourFee.value = answerL4;
				if(incomeAmount <= monthlyL5[0] && incomeAmount <= monthlyL4[0] && incomeAmount <= monthlyL3[0] && incomeAmount > monthlyL2[0]) document.form1.yourFee.value = answerL3;
				if(incomeAmount <= monthlyL5[0] && incomeAmount <= monthlyL4[0] && incomeAmount <= monthlyL3[0] && incomeAmount <= monthlyL2[0] && incomeAmount > monthlyL1[0]) document.form1.yourFee.value = answerL2;
				if(incomeAmount <= monthlyL5[0] && incomeAmount <= monthlyL4[0] && incomeAmount <= monthlyL3[0] && incomeAmount <= monthlyL2[0] && incomeAmount <= monthlyL1[0] && incomeAmount > monthlyL0[0]) document.form1.yourFee.value = answerL1;
				if(incomeAmount <= monthlyL5[0] && incomeAmount <= monthlyL4[0] && incomeAmount <= monthlyL3[0] && incomeAmount <= monthlyL2[0] && incomeAmount <= monthlyL1[0] && incomeAmount <= monthlyL0[0]) document.form1.yourFee.value = answerL0;
			
			}else{
				//check yearly income
				if(incomeAmount > yearlyL5[0] || incomeAmount <= yearlyL5[0] && incomeAmount > yearlyL4[0]) document.form1.yourFee.value = answerL5;
				if(incomeAmount <= yearlyL5[0] && incomeAmount <= yearlyL4[0] && incomeAmount > yearlyL3[0]) document.form1.yourFee.value = answerL4;
				if(incomeAmount <= yearlyL5[0] && incomeAmount <= yearlyL4[0] && incomeAmount <= yearlyL3[0] && incomeAmount > yearlyL2[0]) document.form1.yourFee.value = answerL3;
				if(incomeAmount <= yearlyL5[0] && incomeAmount <= yearlyL4[0] && incomeAmount <= yearlyL3[0] && incomeAmount <= yearlyL2[0] && incomeAmount > yearlyL1[0]) document.form1.yourFee.value = answerL2;
				if(incomeAmount <= yearlyL5[0] && incomeAmount <= yearlyL4[0] && incomeAmount <= yearlyL3[0] && incomeAmount <= yearlyL2[0] && incomeAmount <= yearlyL1[0] && incomeAmount > yearlyL0[0]) document.form1.yourFee.value = answerL1;
				if(incomeAmount <= yearlyL5[0] && incomeAmount <= yearlyL4[0] && incomeAmount <= yearlyL3[0] && incomeAmount <= yearlyL2[0] && incomeAmount <= yearlyL1[0] && incomeAmount <= yearlyL0[0]) document.form1.yourFee.value = answerL0;
			
				}
			break;
		case "2":
			//do comparison
			if (monthlyIncome == true){
				if(incomeAmount > monthlyL5[1] || incomeAmount <= monthlyL5[1] && incomeAmount > monthlyL4[1]) document.form1.yourFee.value = answerL5;
				if(incomeAmount <= monthlyL5[1] && incomeAmount <= monthlyL4[1] && incomeAmount > monthlyL3[1]) document.form1.yourFee.value = answerL4;
				if(incomeAmount <= monthlyL5[1] && incomeAmount <= monthlyL4[1] && incomeAmount <= monthlyL3[1] && incomeAmount > monthlyL2[1]) document.form1.yourFee.value = answerL3;
				if(incomeAmount <= monthlyL5[1] && incomeAmount <= monthlyL4[1] && incomeAmount <= monthlyL3[1] && incomeAmount <= monthlyL2[1] && incomeAmount > monthlyL1[1])  document.form1.yourFee.value = answerL2;
				if(incomeAmount <= monthlyL5[1] && incomeAmount <= monthlyL4[1] && incomeAmount <= monthlyL3[1] && incomeAmount <= monthlyL2[1] && incomeAmount <= monthlyL1[1] && incomeAmount > monthlyL0[1]) document.form1.yourFee.value = answerL1;
				if(incomeAmount <= monthlyL5[1] && incomeAmount <= monthlyL4[1] && incomeAmount <= monthlyL3[1] && incomeAmount <= monthlyL2[1] && incomeAmount <= monthlyL1[1] && incomeAmount <= monthlyL0[1]) document.form1.yourFee.value = answerL0;
			}else{
				if(incomeAmount > yearlyL5[1] || incomeAmount <= yearlyL5[1] && incomeAmount > yearlyL4[1]) document.form1.yourFee.value = answerL5;
				if(incomeAmount <= yearlyL5[1] && incomeAmount <= yearlyL4[1] && incomeAmount > yearlyL3[1]) document.form1.yourFee.value = answerL4;
				if(incomeAmount <= yearlyL5[1] && incomeAmount <= yearlyL4[1] && incomeAmount <= yearlyL3[1] && incomeAmount > yearlyL2[1]) document.form1.yourFee.value = answerL3;
				if(incomeAmount <= yearlyL5[1] && incomeAmount <= yearlyL4[1] && incomeAmount <= yearlyL3[1] && incomeAmount <= yearlyL2[1] && incomeAmount > yearlyL1[1]) document.form1.yourFee.value = answerL2;
				if(incomeAmount <= yearlyL5[1] && incomeAmount <= yearlyL4[1] && incomeAmount <= yearlyL3[1] && incomeAmount <= yearlyL2[1] && incomeAmount <= yearlyL1[1] && incomeAmount > yearlyL0[1]) document.form1.yourFee.value = answerL1;
				if(incomeAmount <= yearlyL5[1] && incomeAmount <= yearlyL4[1] && incomeAmount <= yearlyL3[1] && incomeAmount <= yearlyL2[1] && incomeAmount <= yearlyL1[1] && incomeAmount <= yearlyL0[1]) document.form1.yourFee.value = answerL0;

			}
			break;
		case "3":
			//do comparison
			if (monthlyIncome == true){
				if(incomeAmount > monthlyL5[2] || incomeAmount <= monthlyL5[2] && incomeAmount > monthlyL4[2]) document.form1.yourFee.value = answerL5;
				if(incomeAmount <= monthlyL5[2] && incomeAmount <= monthlyL4[2] && incomeAmount > monthlyL3[2]) document.form1.yourFee.value = answerL4;
				if(incomeAmount <= monthlyL5[2] && incomeAmount <= monthlyL4[2] && incomeAmount <= monthlyL3[2] && incomeAmount > monthlyL2[2]) document.form1.yourFee.value = answerL3;
				if(incomeAmount <= monthlyL5[2] && incomeAmount <= monthlyL4[2] && incomeAmount <= monthlyL3[2] && incomeAmount <= monthlyL2[2] && incomeAmount > monthlyL1[2]) document.form1.yourFee.value = answerL2;
				if(incomeAmount <= monthlyL5[2] && incomeAmount <= monthlyL4[2] && incomeAmount <= monthlyL3[2] && incomeAmount <= monthlyL2[2] && incomeAmount <= monthlyL1[2] && incomeAmount > monthlyL0[2]) document.form1.yourFee.value = answerL1;
				if(incomeAmount <= monthlyL5[2] && incomeAmount <= monthlyL4[2] && incomeAmount <= monthlyL3[2] && incomeAmount <= monthlyL2[2] && incomeAmount <= monthlyL1[2] && incomeAmount <= monthlyL0[2]) document.form1.yourFee.value = answerL0;
			}else{
				if(incomeAmount > yearlyL5[2] || incomeAmount <= yearlyL5[2] && incomeAmount > yearlyL4[2]) document.form1.yourFee.value = answerL5;
				if(incomeAmount <= yearlyL5[2] && incomeAmount <= yearlyL4[2] && incomeAmount > yearlyL3[2]) document.form1.yourFee.value = answerL4;
				if(incomeAmount <= yearlyL5[2] && incomeAmount <= yearlyL4[2] && incomeAmount <= yearlyL3[2] && incomeAmount > yearlyL2[2]) document.form1.yourFee.value = answerL3;
				if(incomeAmount <= yearlyL5[2] && incomeAmount <= yearlyL4[2] && incomeAmount <= yearlyL3[2] && incomeAmount <= yearlyL2[2] && incomeAmount > yearlyL1[2]) document.form1.yourFee.value = answerL2;
				if(incomeAmount <= yearlyL5[2] && incomeAmount <= yearlyL4[2] && incomeAmount <= yearlyL3[2] && incomeAmount <= yearlyL2[2] && incomeAmount <= yearlyL1[2] && incomeAmount > yearlyL0[2]) document.form1.yourFee.value = answerL1;
				if(incomeAmount <= yearlyL5[2] && incomeAmount <= yearlyL4[2] && incomeAmount <= yearlyL3[2] && incomeAmount <= yearlyL2[2] && incomeAmount <= yearlyL1[2] && incomeAmount <= yearlyL0[2]) document.form1.yourFee.value = answerL0;

			}
			break;
		case "4":
			//do comparison
			if (monthlyIncome == true){
				if(incomeAmount > monthlyL5[3] || incomeAmount <= monthlyL5[3] && incomeAmount > monthlyL4[3]) document.form1.yourFee.value = answerL5;
				if(incomeAmount <= monthlyL5[3] && incomeAmount <= monthlyL4[3] && incomeAmount > monthlyL3[3]) document.form1.yourFee.value = answerL4;
				if(incomeAmount <= monthlyL5[3] && incomeAmount <= monthlyL4[3] && incomeAmount <= monthlyL3[3] && incomeAmount > monthlyL2[3]) document.form1.yourFee.value = answerL3;
				if(incomeAmount <= monthlyL5[3] && incomeAmount <= monthlyL4[3] && incomeAmount <= monthlyL3[3] && incomeAmount <= monthlyL2[3] && incomeAmount > monthlyL1[3]) document.form1.yourFee.value = answerL2;
				if(incomeAmount <= monthlyL5[3] && incomeAmount <= monthlyL4[3] && incomeAmount <= monthlyL3[3] && incomeAmount <= monthlyL2[3] && incomeAmount <= monthlyL1[3] && incomeAmount > monthlyL0[3]) document.form1.yourFee.value = answerL1;
				if(incomeAmount <= monthlyL5[3] && incomeAmount <= monthlyL4[3] && incomeAmount <= monthlyL3[3] && incomeAmount <= monthlyL2[3] && incomeAmount <= monthlyL1[3] && incomeAmount <= monthlyL0[3]) document.form1.yourFee.value = answerL0;
			}else{
				if(incomeAmount > yearlyL5[3] || incomeAmount <= yearlyL5[3] && incomeAmount > yearlyL4[3]) document.form1.yourFee.value = answerL5;
				if(incomeAmount <= yearlyL5[3] && incomeAmount <= yearlyL4[3] && incomeAmount > yearlyL3[3]) document.form1.yourFee.value = answerL4;
				if(incomeAmount <= yearlyL5[3] && incomeAmount <= yearlyL4[3] && incomeAmount <= yearlyL3[3] && incomeAmount > yearlyL2[3]) document.form1.yourFee.value = answerL3;
				if(incomeAmount <= yearlyL5[3] && incomeAmount <= yearlyL4[3] && incomeAmount <= yearlyL3[3] && incomeAmount <= yearlyL2[3] && incomeAmount > yearlyL1[3]) document.form1.yourFee.value = answerL2;
				if(incomeAmount <= yearlyL5[3] && incomeAmount <= yearlyL4[3] && incomeAmount <= yearlyL3[3] && incomeAmount <= yearlyL2[3] && incomeAmount <= yearlyL1[3] && incomeAmount > yearlyL0[3]) document.form1.yourFee.value = answerL1;
				if(incomeAmount <= yearlyL5[3] && incomeAmount <= yearlyL4[3] && incomeAmount <= yearlyL3[3] && incomeAmount <= yearlyL2[3] && incomeAmount <= yearlyL1[3] && incomeAmount <= yearlyL0[3]) document.form1.yourFee.value = answerL0;
			}
			break;
		case "5":
			//do comparison
			if (monthlyIncome == true){
				if(incomeAmount > monthlyL5[4] || incomeAmount <= monthlyL5[4] && incomeAmount > monthlyL4[4]) document.form1.yourFee.value = answerL5;
				if(incomeAmount <= monthlyL5[4] && incomeAmount <= monthlyL4[4] && incomeAmount > monthlyL3[4]) document.form1.yourFee.value = answerL4;
				if(incomeAmount <= monthlyL5[4] && incomeAmount <= monthlyL4[4] && incomeAmount <= monthlyL3[4] && incomeAmount > monthlyL2[4]) document.form1.yourFee.value = answerL3;
				if(incomeAmount <= monthlyL5[4] && incomeAmount <= monthlyL4[4] && incomeAmount <= monthlyL3[4] && incomeAmount <= monthlyL2[4] && incomeAmount > monthlyL1[4]) document.form1.yourFee.value = answerL2;
				if(incomeAmount <= monthlyL5[4] && incomeAmount <= monthlyL4[4] && incomeAmount <= monthlyL3[4] && incomeAmount <= monthlyL2[4] && incomeAmount <= monthlyL1[4] && incomeAmount > monthlyL0[4]) document.form1.yourFee.value = answerL1;
				if(incomeAmount <= monthlyL5[4] && incomeAmount <= monthlyL4[4] && incomeAmount <= monthlyL3[4] && incomeAmount <= monthlyL2[4] && incomeAmount <= monthlyL1[4] && incomeAmount <= monthlyL0[4]) document.form1.yourFee.value = answerL0;
			}else{
				if(incomeAmount > yearlyL5[4] || incomeAmount <= yearlyL5[4] && incomeAmount > yearlyL4[4]) document.form1.yourFee.value = answerL5;
				if(incomeAmount <= yearlyL5[4] && incomeAmount <= yearlyL4[4] && incomeAmount > yearlyL3[4]) document.form1.yourFee.value = answerL4;
				if(incomeAmount <= yearlyL5[4] && incomeAmount <= yearlyL4[4] && incomeAmount <= yearlyL3[4] && incomeAmount > yearlyL2[4]) document.form1.yourFee.value = answerL3;
				if(incomeAmount <= yearlyL5[4] && incomeAmount <= yearlyL4[4] && incomeAmount <= yearlyL3[4] && incomeAmount <= yearlyL2[4] && incomeAmount > yearlyL1[4]) document.form1.yourFee.value = answerL2;
				if(incomeAmount <= yearlyL5[4] && incomeAmount <= yearlyL4[4] && incomeAmount <= yearlyL3[4] && incomeAmount <= yearlyL2[4] && incomeAmount <= yearlyL1[4] && incomeAmount > yearlyL0[4]) document.form1.yourFee.value = answerL1;
				if(incomeAmount <= yearlyL5[4] && incomeAmount <= yearlyL4[4] && incomeAmount <= yearlyL3[4] && incomeAmount <= yearlyL2[4] && incomeAmount <= yearlyL1[4] && incomeAmount <= yearlyL0[4]) document.form1.yourFee.value = answerL0;

			}
			break;
		case "6":
			//do comparison
			if (monthlyIncome == true){
				if(incomeAmount > monthlyL5[5] || incomeAmount <= monthlyL5[5] && incomeAmount > monthlyL4[5]) document.form1.yourFee.value = answerL5;
				if(incomeAmount <= monthlyL5[5] && incomeAmount <= monthlyL4[5] && incomeAmount > monthlyL3[5]) document.form1.yourFee.value = answerL4;
				if(incomeAmount <= monthlyL5[5] && incomeAmount <= monthlyL4[5] && incomeAmount <= monthlyL3[5] && incomeAmount > monthlyL2[5]) document.form1.yourFee.value = answerL3;
				if(incomeAmount <= monthlyL5[5] && incomeAmount <= monthlyL4[5] && incomeAmount <= monthlyL3[5] && incomeAmount <= monthlyL2[5] && incomeAmount > monthlyL1[5]) document.form1.yourFee.value = answerL2;
				if(incomeAmount <= monthlyL5[5] && incomeAmount <= monthlyL4[5] && incomeAmount <= monthlyL3[5] && incomeAmount <= monthlyL2[5] && incomeAmount <= monthlyL1[5] && incomeAmount > monthlyL0[5]) document.form1.yourFee.value = answerL1;
				if(incomeAmount <= monthlyL5[5] && incomeAmount <= monthlyL4[5] && incomeAmount <= monthlyL3[5] && incomeAmount <= monthlyL2[5] && incomeAmount <= monthlyL1[5] && incomeAmount <= monthlyL0[5]) document.form1.yourFee.value = answerL0;
			}else{
				if(incomeAmount > yearlyL5[5] || incomeAmount <= yearlyL5[5] && incomeAmount > yearlyL4[5]) document.form1.yourFee.value = answerL5;
				if(incomeAmount <= yearlyL5[5] && incomeAmount <= yearlyL4[5] && incomeAmount > yearlyL3[5]) document.form1.yourFee.value = answerL4;
				if(incomeAmount <= yearlyL5[5] && incomeAmount <= yearlyL4[5] && incomeAmount <= yearlyL3[5] && incomeAmount > yearlyL2[5]) document.form1.yourFee.value = answerL3;
				if(incomeAmount <= yearlyL5[5] && incomeAmount <= yearlyL4[5] && incomeAmount <= yearlyL3[5] && incomeAmount <= yearlyL2[5] && incomeAmount > yearlyL1[5]) document.form1.yourFee.value = answerL2;
				if(incomeAmount <= yearlyL5[5] && incomeAmount <= yearlyL4[5] && incomeAmount <= yearlyL3[5] && incomeAmount <= yearlyL2[5] && incomeAmount <= yearlyL1[5] && incomeAmount > yearlyL0[5]) document.form1.yourFee.value = answerL1;
				if(incomeAmount <= yearlyL5[5] && incomeAmount <= yearlyL4[5] && incomeAmount <= yearlyL3[5] && incomeAmount <= yearlyL2[5] && incomeAmount <= yearlyL1[5] && incomeAmount <= yearlyL0[5]) document.form1.yourFee.value = answerL0;

			}
			break;
		case "7":
			//do comparison
			if (monthlyIncome == true){
				if(incomeAmount > monthlyL5[6] || incomeAmount <= monthlyL5[6] && incomeAmount > monthlyL4[6]) document.form1.yourFee.value = answerL5;
				if(incomeAmount <= monthlyL5[6] && incomeAmount <= monthlyL4[6] && incomeAmount > monthlyL3[6]) document.form1.yourFee.value = answerL4;
				if(incomeAmount <= monthlyL5[6] && incomeAmount <= monthlyL4[6] && incomeAmount <= monthlyL3[6] && incomeAmount > monthlyL2[6]) document.form1.yourFee.value = answerL3;
				if(incomeAmount <= monthlyL5[6] && incomeAmount <= monthlyL4[6] && incomeAmount <= monthlyL3[6] && incomeAmount <= monthlyL2[6] && incomeAmount > monthlyL1[6]) document.form1.yourFee.value = answerL2;
				if(incomeAmount <= monthlyL5[6] && incomeAmount <= monthlyL4[6] && incomeAmount <= monthlyL3[6] && incomeAmount <= monthlyL2[6] && incomeAmount <= monthlyL1[6] && incomeAmount > monthlyL0[6]) document.form1.yourFee.value = answerL1;
				if(incomeAmount <= monthlyL5[6] && incomeAmount <= monthlyL4[6] && incomeAmount <= monthlyL3[6] && incomeAmount <= monthlyL2[6] && incomeAmount <= monthlyL1[6] && incomeAmount <= monthlyL0[6]) document.form1.yourFee.value = answerL0;		
			}else{
				if(incomeAmount > yearlyL5[6] || incomeAmount <= yearlyL5[6] && incomeAmount > yearlyL4[6]) document.form1.yourFee.value = answerL5;
				if(incomeAmount <= yearlyL5[6] && incomeAmount <= yearlyL4[6] && incomeAmount > yearlyL3[6]) document.form1.yourFee.value = answerL4;
				if(incomeAmount <= yearlyL5[6] && incomeAmount <= yearlyL4[6] && incomeAmount <= yearlyL3[6] && incomeAmount > yearlyL2[6]) document.form1.yourFee.value = answerL3;
				if(incomeAmount <= yearlyL5[6] && incomeAmount <= yearlyL4[6] && incomeAmount <= yearlyL3[6] && incomeAmount <= yearlyL2[6] && incomeAmount > yearlyL1[6]) document.form1.yourFee.value = answerL2;
				if(incomeAmount <= yearlyL5[6] && incomeAmount <= yearlyL4[6] && incomeAmount <= yearlyL3[6] && incomeAmount <= yearlyL2[6] && incomeAmount <= yearlyL1[6] && incomeAmount > yearlyL0[6]) document.form1.yourFee.value = answerL1;
				if(incomeAmount <= yearlyL5[6] && incomeAmount <= yearlyL4[6] && incomeAmount <= yearlyL3[6] && incomeAmount <= yearlyL2[6] && incomeAmount <= yearlyL1[6] && incomeAmount <= yearlyL0[6]) document.form1.yourFee.value = answerL0;

			}
			break;
		case "8":
			//do comparison
			if (monthlyIncome == true){
				if(incomeAmount > monthlyL5[7] || incomeAmount <= monthlyL5[7] && incomeAmount > monthlyL4[7]) document.form1.yourFee.value = answerL5;
				if(incomeAmount <= monthlyL5[7] && incomeAmount <= monthlyL4[7] && incomeAmount > monthlyL3[7]) document.form1.yourFee.value = answerL4;
				if(incomeAmount <= monthlyL5[7] && incomeAmount <= monthlyL4[7] && incomeAmount <= monthlyL3[7] && incomeAmount > monthlyL2[7]) document.form1.yourFee.value = answerL3;
				if(incomeAmount <= monthlyL5[7] && incomeAmount <= monthlyL4[7] && incomeAmount <= monthlyL3[7] && incomeAmount <= monthlyL2[7] && incomeAmount > monthlyL1[7]) document.form1.yourFee.value = answerL2;
				if(incomeAmount <= monthlyL5[7] && incomeAmount <= monthlyL4[7] && incomeAmount <= monthlyL3[7] && incomeAmount <= monthlyL2[7] && incomeAmount <= monthlyL1[7] && incomeAmount > monthlyL0[7]) document.form1.yourFee.value = answerL1;
				if(incomeAmount <= monthlyL5[7] && incomeAmount <= monthlyL4[7] && incomeAmount <= monthlyL3[7] && incomeAmount <= monthlyL2[7] && incomeAmount <= monthlyL1[7] && incomeAmount <= monthlyL0[7]) document.form1.yourFee.value = answerL0;		
			}else{
				if(incomeAmount > yearlyL5[7] || incomeAmount <= yearlyL5[7] && incomeAmount > yearlyL4[7]) document.form1.yourFee.value = answerL5;
				if(incomeAmount <= yearlyL5[7] && incomeAmount <= yearlyL4[7] && incomeAmount > yearlyL3[7]) document.form1.yourFee.value = answerL4;
				if(incomeAmount <= yearlyL5[7] && incomeAmount <= yearlyL4[7] && incomeAmount <= yearlyL3[7] && incomeAmount > yearlyL2[7]) document.form1.yourFee.value = answerL3;
				if(incomeAmount <= yearlyL5[7] && incomeAmount <= yearlyL4[7] && incomeAmount <= yearlyL3[7] && incomeAmount <= yearlyL2[7] && incomeAmount > yearlyL1[7]) document.form1.yourFee.value = answerL2;
				if(incomeAmount <= yearlyL5[7] && incomeAmount <= yearlyL4[7] && incomeAmount <= yearlyL3[7] && incomeAmount <= yearlyL2[7] && incomeAmount <= yearlyL1[7] && incomeAmount > yearlyL0[7]) document.form1.yourFee.value = answerL1;
				if(incomeAmount <= yearlyL5[7] && incomeAmount <= yearlyL4[7] && incomeAmount <= yearlyL3[7] && incomeAmount <= yearlyL2[7] && incomeAmount <= yearlyL1[7] && incomeAmount <= yearlyL0[7]) document.form1.yourFee.value = answerL0;			
			}
			break;
		case "9":
			//do comparison
			if (monthlyIncome == true){
				if(incomeAmount > monthlyL5[8] || incomeAmount <= monthlyL5[8] && incomeAmount > monthlyL4[8]) document.form1.yourFee.value = answerL5;
				if(incomeAmount <= monthlyL5[8] && incomeAmount <= monthlyL4[8] && incomeAmount > monthlyL3[8]) document.form1.yourFee.value = answerL4;
				if(incomeAmount <= monthlyL5[8] && incomeAmount <= monthlyL4[8] && incomeAmount <= monthlyL3[8] && incomeAmount > monthlyL2[8]) document.form1.yourFee.value = answerL3;
				if(incomeAmount <= monthlyL5[8] && incomeAmount <= monthlyL4[8] && incomeAmount <= monthlyL3[8] && incomeAmount <= monthlyL2[8] && incomeAmount > monthlyL1[8]) document.form1.yourFee.value = answerL2;
				if(incomeAmount <= monthlyL5[8] && incomeAmount <= monthlyL4[8] && incomeAmount <= monthlyL3[8] && incomeAmount <= monthlyL2[8] && incomeAmount <= monthlyL1[8] && incomeAmount > monthlyL0[8]) document.form1.yourFee.value = answerL1;
				if(incomeAmount <= monthlyL5[8] && incomeAmount <= monthlyL4[8] && incomeAmount <= monthlyL3[8] && incomeAmount <= monthlyL2[8] && incomeAmount <= monthlyL1[8] && incomeAmount <= monthlyL0[8]) document.form1.yourFee.value = answerL0;		
			}else{
				if(incomeAmount > yearlyL5[8] || incomeAmount <= yearlyL5[8] && incomeAmount > yearlyL4[8]) document.form1.yourFee.value = answerL5;
				if(incomeAmount <= yearlyL5[8] && incomeAmount <= yearlyL4[8] && incomeAmount > yearlyL3[8]) document.form1.yourFee.value = answerL4;
				if(incomeAmount <= yearlyL5[8] && incomeAmount <= yearlyL4[8] && incomeAmount <= yearlyL3[8] && incomeAmount > yearlyL2[8]) document.form1.yourFee.value = answerL3;
				if(incomeAmount <= yearlyL5[8] && incomeAmount <= yearlyL4[8] && incomeAmount <= yearlyL3[8] && incomeAmount <= yearlyL2[8] && incomeAmount > yearlyL1[8]) document.form1.yourFee.value = answerL2;
				if(incomeAmount <= yearlyL5[8] && incomeAmount <= yearlyL4[8] && incomeAmount <= yearlyL3[8] && incomeAmount <= yearlyL2[8] && incomeAmount <= yearlyL1[8] && incomeAmount > yearlyL0[8]) document.form1.yourFee.value = answerL1;
				if(incomeAmount <= yearlyL5[8] && incomeAmount <= yearlyL4[8] && incomeAmount <= yearlyL3[8] && incomeAmount <= yearlyL2[8] && incomeAmount <= yearlyL1[8] && incomeAmount <= yearlyL0[8]) document.form1.yourFee.value = answerL0;
			}
			break;
		case "10":
			//do comparison
			if (monthlyIncome == true){
				if(incomeAmount > monthlyL5[9] || incomeAmount <= monthlyL5[9] && incomeAmount > monthlyL4[9]) document.form1.yourFee.value = answerL5;
				if(incomeAmount <= monthlyL5[9] && incomeAmount <= monthlyL4[9] && incomeAmount > monthlyL3[9]) document.form1.yourFee.value = answerL4;
				if(incomeAmount <= monthlyL5[9] && incomeAmount <= monthlyL4[9] && incomeAmount <= monthlyL3[9] && incomeAmount > monthlyL2[9]) document.form1.yourFee.value = answerL3;
				if(incomeAmount <= monthlyL5[9] && incomeAmount <= monthlyL4[9] && incomeAmount <= monthlyL3[9] && incomeAmount <= monthlyL2[9] && incomeAmount > monthlyL1[9]) document.form1.yourFee.value = answerL2;
				if(incomeAmount <= monthlyL5[9] && incomeAmount <= monthlyL4[9] && incomeAmount <= monthlyL3[9] && incomeAmount <= monthlyL2[9] && incomeAmount <= monthlyL1[9] && incomeAmount > monthlyL0[9]) document.form1.yourFee.value = answerL1;
				if(incomeAmount <= monthlyL5[9] && incomeAmount <= monthlyL4[9] && incomeAmount <= monthlyL3[9] && incomeAmount <= monthlyL2[9] && incomeAmount <= monthlyL1[9] && incomeAmount <= monthlyL0[9]) document.form1.yourFee.value = answerL0;		
			}else{
				if(incomeAmount > yearlyL5[9] || incomeAmount <= yearlyL5[9] && incomeAmount > yearlyL4[9]) document.form1.yourFee.value = answerL5;
				if(incomeAmount <= yearlyL5[9] && incomeAmount <= yearlyL4[9] && incomeAmount > yearlyL3[9]) document.form1.yourFee.value = answerL4;
				if(incomeAmount <= yearlyL5[9] && incomeAmount <= yearlyL4[9] && incomeAmount <= yearlyL3[9] && incomeAmount > yearlyL2[9]) document.form1.yourFee.value = answerL3;
				if(incomeAmount <= yearlyL5[9] && incomeAmount <= yearlyL4[9] && incomeAmount <= yearlyL3[9] && incomeAmount <= yearlyL2[9] && incomeAmount > yearlyL1[9]) document.form1.yourFee.value = answerL2;
				if(incomeAmount <= yearlyL5[9] && incomeAmount <= yearlyL4[9] && incomeAmount <= yearlyL3[9] && incomeAmount <= yearlyL2[9] && incomeAmount <= yearlyL1[9] && incomeAmount > yearlyL0[9]) document.form1.yourFee.value = answerL1;
				if(incomeAmount <= yearlyL5[9] && incomeAmount <= yearlyL4[9] && incomeAmount <= yearlyL3[9] && incomeAmount <= yearlyL2[9] && incomeAmount <= yearlyL1[9] && incomeAmount <= yearlyL0[9]) document.form1.yourFee.value = answerL0;
			}
			break;
		default:
			window.alert("Error occured. Please Try Again");
		}
	
}
 function checkValues(){
	if (chkNumeric(document.form1.incomeAmount.value) == false) 
      {
      alert("You entered: " + document.form1.incomeAmount.value + ". Only numbers and a period '.' allowed. \n \t\t Please try again.");
      }
 }
 
 function chkNumeric(sText){
   
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }

var arImages=new Array();
function Preload() {
 var temp = Preload.arguments; 
 for(x=0; x < temp.length; x++) {
  arImages[x]=new Image();
  arImages[x].src=Preload.arguments[x];
 }
}

