//validate and submit the form
function FormSubmit(form) {
	
    //Email
	if (typeof (TravelAgents_Support_Email) == "undefined")
		TravelAgents_Support_Email = "Please enter your E-mail Address."
	if (typeof (TravelAgents_Support_NotVldEmail) == "undefined")
	    TravelAgents_Support_NotVldEmail = "The e-mail you entered is not a valid e-mail address."
	
	if (isEmpty(form.email, "", TravelAgents_Support_Email)) return
	
	if (notEmail(form.email, "", TravelAgents_Support_NotVldEmail)) return

    //Confirm Email

	if (isEmpty(form.cemail, "", TravelAgents_Support_ConfirmEmail)) return
	
	if (notEmail(form.cemail, "", TravelAgents_Support_NotVldEmail)) return

	//Email Match
	if (form.email.value != form.cemail.value) { alert(TravelAgents_Support_EmailMatch); return; }

	//BookingID
	if (form.BookingID.value != '') {
	    if (notNumber(form.BookingID.value)) { alert(TravelAgents_Support_InvalidBooking); return; } 
    }

    //Booking Email Address
	if (form.bemail.value != '') { if (notEmail(form.bemail, "", TravelAgents_Support_NotVldEmail)) return }
    
    //Category
	if (notSelected(form.contactcategory, "", TravelAgents_Support_Category)) 
    {return; } 
    else {
	    form.cat.value = form.contactcategory.options[form.contactcategory.selectedIndex].text;
	}

    //Comments
	if (charCheck(form.comments, langMsg)) return

	if (typeof (TravelAgents_Support_LimitMsg) == "undefined")
		TravelAgents_Support_LimitMsg = "Please limit your message to 3000 characters. You have used " + form.msg.value.length + " characters."

	if (invalLength(form.comments, "", 3000, TravelAgents_Support_LimitMsg)) return

	
	form.SmBtn.disabled = true
	form.submit()
}
