	function validateBillingBookingForm()
	{	
			document.getElementById('course_booking_form').submit();
    }
	function validateCustomerBookingForm()
	{	
		var bValid = true;
		var strErrorMsg = "The following fields are required : \n--------------------------------------\n";
		var strTitle = document.getElementById('title').value;
		strTitle = trim(strTitle);
		if(strTitle == null || strTitle.length == 0)
		{
			strErrorMsg = strErrorMsg + "Title\n";
			bValid = false;
		}
		var strFName = document.getElementById('firstname').value;
		strFName = trim(strFName);
		if(strFName == null || strFName.length == 0)
		{
			strErrorMsg = strErrorMsg + "First Name\n";
			bValid = false;
		}
		var strSName = document.getElementById('surname').value;
		strSName = trim(strSName);
		if(strSName == null || strSName.length == 0)
		{
			strErrorMsg = strErrorMsg + "Family Name\n";
			bValid = false;
		}
		var strAdd1 = document.getElementById('add1').value;
		if(strAdd1 == null || strAdd1.length == 0)
		{
			strErrorMsg = strErrorMsg + "Address\n";
			bValid = false;
		}
		/*var strPostCode = document.getElementById('postcode').value;
		if(strPostCode == null || strPostCode.length == 0)
		{
			strErrorMsg = strErrorMsg + "Post/ZIP Code\n";
			bValid = false;
		}*/
		var strTel = document.getElementById('tel').value;
		if(strTel == null || strTel.length == 0)
		{
			strErrorMsg = strErrorMsg + "Telephone\n";
			bValid = false;
		}
		var strEmail = document.getElementById('email').value;
		if(strEmail == null || strEmail.length == 0 || strEmail.indexOf("@") == -1)
		{
			strErrorMsg = strErrorMsg + "Email Address\n";
			bValid = false;
		}
			
		if(bValid)
		{
			document.getElementById('course_booking_form').submit();
		}
		else
		{
			alert(strErrorMsg);
		}
	}
	function trim(strVal)
	{
		var iLength = strVal.length;
		for(var i=0; i<iLength; i++)
		{
			var c = strVal.charAt(0);
				
			if(c == ' ')strVal = strVal.substring(i);
			else return strVal;
		}
		return strVal;
	}
	function validateYear(oText)
	{
		var str = oText.value;
		var strError = "";
		
		if(str.length != 2)strError += "Year must be 2 numbers\n";
		if(!validNumber(str))strError += "Year must be only numbers 0-9";
		
		if(strError != "")
		{
			alert(strError);
			oText.focus();
		}
	}
	function validNumber(str)
    {
        var regex = /\D/g;
        return !regex.test(str);
    }

	function openTermWindow()
	{
		window.open("termsandconditions.jsp", "term", "toolbar=no, directories=no, location=no, status=no, menubar=no, resizable=no, scrollbars=yes, width=500, height=400");
	}
