// JavaScript Document
function validateForm(){
	CheckFormInput();	
	CheckBgInfo();
	errors += required($("#coursename"));
	errors += required($("#numstudents"));
 	if (isNaN(document.getElementById("numstudents").value)) {
			document.getElementById("numstudents").value= '';
			errors += required($("#numstudents"));
            msg = msg + "Please enter a number only. \n\n";
           
            }
		if( $("input[name='book_required']").length )
		{
		if ( $("#book option:selected").length == 0 )
		{
		$("#book").css("background-color","#E48028");
		$("#book").css("color","#FFFFFF");
		errors = errors + 'Error.';
		}
		else
		{
			if ($('#book').val() != '')
			 {
				$("#book").css("background-color","");
				$("#book").css("color","#000000");
				errors = errors + '';
			}
			else 
				{
				$("#book").css("background-color","#E48028");
				$("#book").css("color","#FFFFFF");
				errors = errors + 'Error.';
				}
		}
		}	
	if ( errors ){
		alert(msg + "Please fill out all the required fields. \n\n The required fields will be highlighted for you.");
		window.location='#top';
		return false;
	}
	else{
		$("#submit_btn").attr("disabled","true")
		return true;
	}
}

