	var TotalAmount
	var TotalHours
	
	function CourseSelected(elem, price, hours){
		TotalAmount = parseFloat(document.Courses.total.value);
		TotalHours = parseFloat(document.Courses.totalHours.value);
		//Check to see if they added or removed a course
		if (elem.checked == false){			
			TotalHours -= hours
			TotalAmount -= parseFloat(price);			
			//RemoveCourse(elem.name, courseName);
			}
		else{
			TotalHours += hours;
			TotalAmount += parseFloat(price);	
			//if(iType == 1) iNumOnlineCourses++
			//AddCourse(elem.name, price, courseName);
			}
		//Show the current amount. 
		CalcTotal();
		document.Courses.total.value = TotalAmount;
		document.Courses.totalHours.value = TotalHours;
		return true;
	}
	
	function CalcTotal(){
		//Check to see what the new total is.
		sTotalAmount = new String(TotalAmount);		
		if (sTotalAmount.indexOf(".") == -1){					
			sTotalAmount += ".00";
			TotalAmount = sTotalAmount;		
		}
		else{
			//keeps it rounded to the nearest cent
			TotalAmount += .001;

			//We need to parse the string to get the Dollar 
			//and Cent amounts. This will allow us to remove
			//the extra 0's from the Floats presicion to the
			//2 digit cent value.
			sDollar = parseInt(TotalAmount);		
			sTotalAmount = new String(TotalAmount);

            period = sTotalAmount.indexOf(".");
            period += 1;
            sCent = sTotalAmount.substring(period, period + 2);
            sTotalAmount = sDollar + "." + sCent;
            TotalAmount = parseFloat(sTotalAmount);
 		}
	}
	
	function ContinueToNext(){
		TotalAmount = document.Courses.total.value;
		TotalHours = document.Courses.totalHours.value;
		if (TotalAmount == "0.00"){
			alert("No courses selected. You must have at least one course selected in order to continue.");
		}
		else{
			document.Courses.total.value = TotalAmount;
			document.Courses.totalHours.value = TotalHours;
			if(document.Courses.type.value=="one"){
				document.Courses.submit();
			}else{
				if((document.Courses.vType[0].checked==true)||(document.Courses.vType[1].checked==true)){
					document.Courses.submit();
				}else{
					alert("No courses format was selected. You must select a course format in order to continue.");
				}
			}
			//document.Courses.submit();
		}
	}	
