//Change fee information in this section

function setInStateTuition() {
	tuitionVal =196.00; //IN STATE TUITION FEE PER CREDIT HOUR
	return tuitionVal;
}

function setOutStateTuition() {
	tuitionVal=569.00; //OUT OF STATE TUITION PER CREDIT HOUR
	return tuitionVal;
}

function setFees() {
	compFee =147.00;  //COMPREHENSIVE FEE PER CREDIT HOUR
	activityFee = 6.00; //STUDENT ACTIVITY FEE PER CREDIT HOUR
	regFee = 2.00; //REGISTRATION FEE PER CREDIT HOUR
}

function setCapitalFee() {
	capFee = 22.00; //CAPITAL OUTLAY FEE PER CREDIT HOUR
}

function setResidentRoom() {
	room = 2630.00; //ROOM FEE
}

function setMealA() {
	mealVal = 1427.00; //14 + $250 MEAL PLAN FEE
	return mealVal;
}

function setMealB() {
	mealVal = 1750.00; //Unlimited + $150 MEAL PLAN FEE
	return mealVal;
}

function setMealC() {
	mealVal = 698.00; //Flexible 5 + $150 MEAL PLAN FEE
	return mealVal;
}

//End of fee section

//Do not change anything below.

function calTotal() {
	hourFee = tuition + compFee + activityFee + regFee + capFee;
	roommeal = room + meal;
	if (document.form1.creditlist.value != '')
		hours = document.form1.creditlist.value
	else {
		if (document.form1.creditlist2.value != '')
			hours = document.form1.creditlist2.value
	}
	totaltuition = hourFee * hours;
	total = Math.round((roommeal + totaltuition) * 100) /100;
	return total;
}

function switchList(list, hideList) {
	listShow = document.getElementById(list);
	listHide = document.getElementById(hideList);
	listShow.style.display='block';
 	listHide.style.display='none';
	listHide.value = '';
	}
	
function resetVar() {
	tuition = -1;
	room = -1;
	meal = -1;
	compFee = -1; 
	activityFee = -1; 
	techFee = -1; 
	regFee = -1;
	capFee = -1;
	document.form1.total.value = '';
	document.form1.creditlist.options[0].selected = true;
	document.form1.creditlist2.options[0].selected = true;
	document.form1.creditlist.style.display = 'block';
	document.form1.creditlist2.style.display = 'none';
}

function resetButtons(){
	showButton('inState', 'Up');
	showButton('outState', 'Up');
	showButton('resident', 'Up');
	showButton('commuter', 'Up');
	showButton('ma', 'Up');
	showButton('mb', 'Up');
	showButton('mc', 'Up');
		
	hideButton('inState', 'Down');
	hideButton('outState', 'Down');
	hideButton('resident', 'Down');
	hideButton('commuter', 'Down');
	hideButton('ma', 'Down');
	hideButton('mb', 'Down');
	hideButton('mc', 'Down');
}


function validate() {
	var msg;
	msg = "";
	
	if (typeof tuition == 'undefined') 
		msg = "please select in state or out of state! \n";
	else {
		if (tuition == -1) 
			msg = "please select in state or out of state! \n";
	}
		
	if (typeof room == 'undefined') 
		msg = msg + "please select residential or commuter! \n";
	else {
		if (room == -1) 
			msg = msg + "please select residential or commuter! \n";
	}
				
	if (typeof room != 'undefined') {
		if (room != 0) {
			if (typeof meal == 'undefined') 
				msg = msg + "please select in a meal plan! \n";
			else {
				if (meal == -1 || meal == 0 || meal == setMealC()) { 
					msg = msg + "please select a meal plan! \n";
				}
			}
		}
	}else {
		if (typeof meal == 'undefined' && room != 0) 
			msg = msg + "please select a meal plan! \n";
	}
	
	if ((document.form1.creditlist.value == '' || document.form1.creditlist.value == null) && (document.form1.creditlist2.value == '' || document.form1.creditlist2.value == null))
		msg = msg + "Please select the number of credit hours!\n";
		
	return msg;
}

//switchs the button color, if two buttons in a group, buttonID3 will be ''
function switchButtons(buttonID1,buttonID2, buttonID3){
	hideButton(buttonID1,'Up');
	showButton(buttonID1, 'Down');
	
	if (buttonID2 != '')  {
		showButton(buttonID2, 'Up');
		hideButton(buttonID2, 'Down');
	}
	
	if (buttonID3 != '')  {
		showButton(buttonID3, 'Up');
		hideButton(buttonID3, 'Down');
	}
}

function hideButton(button, pos) {
	buttonpos = button + pos;
	var d=document.getElementById(buttonpos);
	d.style.display="none";
}

function showButton(button, pos) {
	buttonpos = button + pos;
	var d=document.getElementById(buttonpos);
	d.style.display="block";
}

function ifResident() {
	var d=document.getElementById('residentDown');
	if (d.style.display == "block")
		return true;
	else
		return false;
}


