function FormSubmit(form) {
	//contact details validation
	if (typeof (GroupBooking_GroupBooking_FName) == "undefined")
		GroupBooking_GroupBooking_FName = "Please enter First Name."
		
	if (isEmpty(form.firstname, "", GroupBooking_GroupBooking_FName)) return	
	if (charCheck(form.firstname, langMsg)) return	
	if (typeof (GroupBooking_GroupBooking_LName) == "undefined")
		GroupBooking_GroupBooking_LName = "Please enter Last Name."
		
	if (isEmpty(form.lastname, "", GroupBooking_GroupBooking_LName)) return	
	if (charCheck(form.lastname, langMsg)) return	
	if (typeof (GroupBooking_GroupBooking_Email) == "undefined")
		GroupBooking_GroupBooking_Email = "Please enter your E-mail Address."
		
	if (isEmpty(form.email, "", GroupBooking_GroupBooking_Email)) return	
	if (typeof (GroupBooking_GroupBooking_NotVldEmail) == "undefined")
		GroupBooking_GroupBooking_NotVldEmail = "The e-mail you entered is not a valid e-mail address."
		
	if (notEmail(form.email, "", GroupBooking_GroupBooking_NotVldEmail)) return	
	if (typeof (GroupBooking_GroupBooking_PhoneNum) == "undefined")
		GroupBooking_GroupBooking_PhoneNum = "Please enter Phone Number."
		
	if (isEmpty(form.phone, "", GroupBooking_GroupBooking_PhoneNum)) return	
	if (typeof (GroupBooking_GroupBooking_Country) == "undefined")
		GroupBooking_GroupBooking_Country = "Please select Country."
		
	if (notSelected(form.owncountry, "", GroupBooking_GroupBooking_Country)) return	
	
	var fromDate = new Date(GetSelVal(form.inYear), GetSelVal(form.inMonth) - 1, GetSelVal(form.inDay))
	var toDate = new Date(GetSelVal(form.outYear), GetSelVal(form.outMonth) - 1, GetSelVal(form.outDay))

	//validate date from
	if (!validDate(fromDate, form.inDay)) {
		if (typeof (GroupBooking_GroupBooking_CheckIn) == "undefined")
			GroupBooking_GroupBooking_CheckIn = "Please enter a valid Check In Date."
			
		alert(GroupBooking_GroupBooking_CheckIn)
		form.inDay.focus()
		return
	}

	//validate date to
	if (!validDate(toDate, form.outDay)) {
		if (typeof (GroupBooking_GroupBooking_CheckOut) == "undefined")
			GroupBooking_GroupBooking_CheckOut = "Please enter a valid Check Out Date."
			
		alert(GroupBooking_GroupBooking_CheckOut)
		form.outDay.focus()
		return
	}

	if (toDate - fromDate < 0) {
		if (typeof (GroupBooking_GroupBooking_OutAfterIn) == "undefined")
			GroupBooking_GroupBooking_OutAfterIn = "Please ensure that the Check-out Date is after the Check-in Date."
		
		alert(GroupBooking_GroupBooking_OutAfterIn)
		form.outDay.focus()
		return
	}
	
	if (typeof (GroupBooking_GroupBooking_BookCountry) == "undefined")
		GroupBooking_GroupBooking_BookCountry = "Please select Booking country."
		
	if (notSelected(form.country, "", GroupBooking_GroupBooking_BookCountry)) return	
	if (typeof (GroupBooking_GroupBooking_City) == "undefined")
		GroupBooking_GroupBooking_City = "Please enter City."
		
	if (isEmpty(form.city, "", GroupBooking_GroupBooking_City)) return
		
	if (charCheck(form.city, langMsg)) return

	if (isEmpty(form.hotel, "", "Please enter Hotel Name.")) {
	    form.hotel.focus();
	    return;
	}
	
	if (charCheck(form.hotel, langMsg)) return
	if (charCheck(form.hotel1, langMsg)) return
	if (charCheck(form.hotel2, langMsg)) return
	if (charCheck(form.msg, langMsg)) return

	if ((form.Single.selectedIndex == 0) && (form.Twin.selectedIndex == 0) && (form.Double.selectedIndex == 0) && (form.Triple.selectedIndex == 0)) {
		if (typeof (GroupBooking_GroupBooking_NumOfRooms) == "undefined")
			GroupBooking_GroupBooking_NumOfRooms = "Please enter the number of rooms required."
			
		alert(GroupBooking_GroupBooking_NumOfRooms)
		form.Single.focus()
		return
	}

	if ((form.Single.selectedIndex + form.Twin.selectedIndex + form.Double.selectedIndex + form.Triple.selectedIndex ) < 11 ) { 
		if (typeof (GroupBooking_GroupBooking_TotalRmsAllowed) == "undefined")
			GroupBooking_GroupBooking_TotalRmsAllowed = "The total number of rooms selected is less than 11. This form is for booking requests that are for 11 or more rooms ONLY."
			
		alert(GroupBooking_GroupBooking_TotalRmsAllowed) 
		form.Single.focus()
		return
	}

	if (typeof (GroupBooking_GroupBooking_LimitMsg) == "undefined")
		GroupBooking_GroupBooking_LimitMsg = "Please limit your message to 3000 characters. You have used " + form.msg.value.length + " characters."
		
	if (invalLength(form.msg, "", 3000, GroupBooking_GroupBooking_LimitMsg)) { return
	
	form.msg.focus()
	return
	}

	//credit card details validation
	if (!ccValidate(form)) return
	
	form.SbBtm.disabled = true
	form.submit()
}

function initForm() {
	var frm = document.GroupBook

	//initialise dates
	tDates = new TravDates(frm.inYear, frm.inMonth, frm.inDay, frm.SetInDay, frm.outYear, frm.outMonth, frm.outDay, frm.SetOutDay, "lenStay", false, null)

	//initialise CC
	CCType_Change(frm.ccType)
}


//calendar callback function
function SetCalDate(year, month, day, inOut) {
	tDates.SetDate(year, month, day, inOut)
}


function FillStateDropDown(countryId) {
    if (countryId != "") {
        // Retrieve states/provinces for this country
        if (xmlhttp) {
            document.getElementById('invisibleInput').focus();
            var divStateProvince = document.getElementById('divStateProvince');
            var CCVerStateProvDD = document.getElementById('CCVerStateProvDD');
            var CCVerStateProv = document.getElementById('CCVerStateProv');
            var bStatesRetrieved = false;

            if (CCVerStateProvDD)
                CCVerStateProvDD.options.length = 0;

            // For now only retrieve states for USA (countryId = 5)
            if (countryId == "5")
                AJAXRequest(CurrentDomain + '/common/ajax/ajax.asp?action=getstates&param1=' + countryId + '&param2=' + LanguageCode, 'LoadSelectBox', 'CCVerStateProvDD', '');

            if (CCVerStateProvDD)
                if (CCVerStateProvDD.options.length > 0)
                bStatesRetrieved = true;

            if (bStatesRetrieved) {
                divStateProvince.style.display = "inline";
                CCVerStateProv.style.display = "none";
                CCVerStateProv.value = "";
            }
            else {
                divStateProvince.style.display = "none";
                CCVerStateProv.style.display = "inline";
            }
        }
        else {
            document.getElementById('invisibleInput').focus();
            var myform = document.getElementById('ccForm');
            myform.action = CurrentURL;
            myform.submit();
        }
    }
    return true;
}

function ChangeSelCountry(obj) {
    if ((obj.options[obj.selectedIndex].value.toLowerCase() == '5') || (obj.options[obj.selectedIndex].value.toLowerCase() == '28')) {
        validCountry = true;
        code = obj.options[obj.selectedIndex].value.toLowerCase();
    }
    else {
        validCountry = false;
    }

    if (validCountry == true) {
        document.getElementById("drawstar").style.display = "inline";
    }
    else {
        document.getElementById("drawstar").style.display = "none";
    }
    // Retrieve state/provinces for this country
    //FillStateDropDown(obj.options[obj.selectedIndex].value)

}
