
tuitionrate = 140;
doubleroomrate = 825;
singleroomrate = 1100;
supersingleroomrate = 1375;
dormdeposit = 150;
dormkeydeposit = 5;
mailboxkeydeposit = 5;
newstudentorientationfee = 50;
newathleticfee = 120;
returningathleticfee = 80;
newstudentorientation = 50;
application = 35;
key = 10;
function calculate(){

	//set all items to default, and get all the values from the form

	var total = 0.0;
	var dormfee = 0.0;
	var athleticsfee = 0.0;
	var orientationfee = 0.0;
	var applicationfee = 0.0;
	var keyfee = 0.0;
	var dormdepositfee = 0.0;
	var dormkeydepositfee = 0.0;
	var housing = $("input[name=housing]:checked").val();
	var dormtype = $("#dormtype").val();
	var program = $("input[name=program]:checked").val();	
	var hours = $('#numberofhours').val();
	var returning = $("input[name=returning]:checked").val();
	
	
	//check for online and completion students, and override housing to offcampus
	if(program == "completion" || program == "online"){
		housing = "offcampus";
		$("#housing").hide();
		}else{
		$("#housing").show();
		}
		
	
	
	//add items that are only for new students
	if(returning == "no"){
		applicationfee = application;
	}
	
	//New Student dorm fees
	if(returning == "no" && housing == "oncampus"){
		dormdepositfee = dormdeposit;
		dormkeydepositfee = dormkeydeposit;
		}
	
	//housing settings
	if(housing == "oncampus"){
		switch(dormtype){	
			case "double":	
				dormfee = doubleroomrate;
				break;
			case "single":
				dormfee = singleroomrate;
				break;
			case "super":
				dormfee = supersingleroomrate;
				break;
			default:
				dormfee = doubleroomrate;
			}
		}else{
		dormfee = 0;
		}
	
	
	//add items that are traditional program only fees, such as athletics fee
	if(program == "traditional"){
	
		//athletics fee is different based on new or returning, and orientation fee is only charged to new students
		if(returning == "yes"){
			athleticsfee = returningathleticfee;
		}else{
			athleticsfee = newathleticfee;
			orientationfee = newstudentorientation;
			}
	}
	
	
	nopayplantotal = athleticsfee + orientationfee + applicationfee + dormdepositfee + keyfee + dormkeydepositfee;
	payplantotal = (hours * tuitionrate) + dormfee;
	total = nopayplantotal + payplantotal;
	
	
	if(housing == "oncampus"){
		$('#dormtypediv').show();
	}else{
		$('#dormtypediv').hide();		
		}
	
	
	$('#totalsdiv').text("Semester Total: $" +total);



}


