

function form_application_initial(frm) {

	bestcontact = new Array();
	bestcontact[1] = "phone";
	bestcontact[2] = "mobile";
	
	if (frm.contactbest[0].checked) contactbestval = 1;
	if (frm.contactbest[1].checked) contactbestval = 2;
	
	if (frm.nextofkincontactbest[0].checked) nextofkincontactbestval = 1;
	if (frm.nextofkincontactbest[1].checked) nextofkincontactbestval = 2;
	

	if (!Validate_text(frm.firstname, "Please enter your First Name."))
		return false;
	if (!Validate_text(frm.lastname, "Please enter your Last Name."))
		return false;
	if (!Validate_date(frm, 'dob', "Please enter your Date of Birth."))
		return false;
	if (!Validate_text(frm.street, "Please enter your Street."))
		return false;
	if (!Validate_text(frm.suburb, "Please enter your Suburb."))
		return false;
	if (!Validate_text(frm.state, "Please enter your State."))
		return false;
	if (!Validate_text(frm.postcode, "Please enter your Postcode."))
		return false;
	if (!Validate_text(frm.country, "Please enter your Country."))
		return false;
		
	bestcontactfld = eval('frm.' + bestcontact[contactbestval]);
	if (!Validate_text(bestcontactfld, "Please enter your best contact Phone #."))
		return false;
	if (!Validate_email(frm.email, "Please enter your current Email Address."))
		return false;
	if (!Validate_username(frm.username, "Please enter your Username."))
		return false;
	if (!Validate_password(frm.password, "Please enter your Password."))
		return false;
	if (frm.password.value != frm.passwordconfirm.value) {
		frm.passwordconfirm.focus();
		frm.passwordconfirm.value = "";
		alert("The Password Confirm field must match the Password you entered,\nplease retry...");
		return false;
	}
	if(frm.schoolcollege.options[frm.schoolcollege.selectedIndex].text=='Other' || frm.schoolcollege.options[frm.schoolcollege.selectedIndex].text=='Choose') {
		if (!Validate_text(frm.schoolcollege_other, "Please choose a school name or enter the school name if you have selected Other."))
			return false;;	
	}
	if (!Validate_text(frm.coursename, "Please enter the name of your Uni Course."))
		return false;
	if (!Validate_text(frm.nextofkinfirstname, "Please enter your Next Of Kin's First Name."))
		return false;
	if (!Validate_text(frm.nextofkinlastname, "Please enter your Next Of Kin's Last Name."))
		return false;
	if (!Validate_text(frm.nextofkinstreet, "Please enter your Next Of Kin's Street."))
		return false;
	if (!Validate_text(frm.nextofkinsuburb, "Please enter your Next Of Kin's Suburb."))
		return false;
	if (!Validate_text(frm.nextofkinstate, "Please enter your Next Of Kin's State."))
		return false;
	if (!Validate_text(frm.nextofkinpostcode, "Please enter your Next Of Kin's Postcode."))
		return false;
	if (!Validate_text(frm.nextofkincountry, "Please enter your Next Of Kin's Country."))
		return false;
		
	nextofkinbestcontactfld = eval('frm.nextofkin' + bestcontact[nextofkincontactbestval]);
	if (!Validate_text(nextofkinbestcontactfld, "Please enter your Next Of Kin's best contact Phone #."))
		return false;
		
	roomtypepreferenceselected = false;
	for (var i=0 ; i < frm.roomtypepreference.length ; i++) {
		if (frm.roomtypepreference[i].checked) roomtypepreferenceselected = true;
	}
	
	if (!roomtypepreferenceselected) {
		frm.roomtypepreference[0].focus();
		alert("Please select your room type preference\n- by clicking the radio button next to the type you prefer.");
		return false;
	}
	
	if (!Validate_date(frm, 'entrydate', "Please enter your intended Entry Date."))
		return false;

	return true;
}

function form_application_initial2(frm) {

	bestcontact = new Array();
	bestcontact[1] = "phone";
	bestcontact[2] = "mobile";
	
	if (frm.contactbest[0].checked) contactbestval = 1;
	if (frm.contactbest[1].checked) contactbestval = 2;
	
	if (frm.nextofkincontactbest[0].checked) nextofkincontactbestval = 1;
	if (frm.nextofkincontactbest[1].checked) nextofkincontactbestval = 2;
	

	if (!Validate_text(frm.firstname, "Please enter your First Name."))
		return false;
	if (!Validate_text(frm.lastname, "Please enter your Last Name."))
		return false;
	if (!Validate_date(frm, 'dob', "Please enter your Date of Birth."))
		return false;
	if (!Validate_text(frm.street, "Please enter your Street."))
		return false;
	if (!Validate_text(frm.suburb, "Please enter your Suburb."))
		return false;
	if (!Validate_text(frm.state, "Please enter your State."))
		return false;
	if (!Validate_text(frm.postcode, "Please enter your Postcode."))
		return false;
	if (!Validate_text(frm.country, "Please enter your Country."))
		return false;
		
	bestcontactfld = eval('frm.' + bestcontact[contactbestval]);
	if (!Validate_text(bestcontactfld, "Please enter your best contact Phone #."))
		return false;
	if (!Validate_email(frm.email, "Please enter your current Email Address."))
		return false;
	if (!Validate_username(frm.username, "Please enter your Username."))
		return false;
	if (!Validate_password(frm.password, "Please enter your Password."))
		return false;
	if (frm.password.value != frm.passwordconfirm.value) {
		frm.passwordconfirm.focus();
		frm.passwordconfirm.value = "";
		alert("The Password Confirm field must match the Password you entered,\nplease retry...");
		return false;
	}
	//if(frm.schoolcollege.options[frm.schoolcollege.selectedIndex].text=='Other' || frm.schoolcollege.options[frm.schoolcollege.selectedIndex].text=='Choose') {
		//if (!Validate_text(frm.schoolcollege_other, "Please choose a school name or enter the school name if you have selected Other."))
			//return false;;	
	//}
	if (!Validate_text(frm.coursename, "Please enter the name of your Uni Course."))
		return false;
	if (!Validate_text(frm.nextofkinfirstname, "Please enter your Next Of Kin's First Name."))
		return false;
	if (!Validate_text(frm.nextofkinlastname, "Please enter your Next Of Kin's Last Name."))
		return false;
	if (!Validate_text(frm.nextofkinstreet, "Please enter your Next Of Kin's Street."))
		return false;
	if (!Validate_text(frm.nextofkinsuburb, "Please enter your Next Of Kin's Suburb."))
		return false;
	if (!Validate_text(frm.nextofkinstate, "Please enter your Next Of Kin's State."))
		return false;
	if (!Validate_text(frm.nextofkinpostcode, "Please enter your Next Of Kin's Postcode."))
		return false;
	if (!Validate_text(frm.nextofkincountry, "Please enter your Next Of Kin's Country."))
		return false;
		
	nextofkinbestcontactfld = eval('frm.nextofkin' + bestcontact[nextofkincontactbestval]);
	if (!Validate_text(nextofkinbestcontactfld, "Please enter your Next Of Kin's best contact Phone #."))
		return false;
		
	roomtypepreferenceselected = false;
	for (var i=0 ; i < frm.roomtypepreference.length ; i++) {
		if (frm.roomtypepreference[i].checked) roomtypepreferenceselected = true;
	}
	
	if (!roomtypepreferenceselected) {
		frm.roomtypepreference[0].focus();
		alert("Please select your room type preference\n- by clicking the radio button next to the type you prefer.");
		return false;
	}
	
	if (!Validate_date(frm, 'entrydate', "Please enter your intended Entry Date."))
		return false;

	return true;
}

function form_application_login(frm) {

	if (!Validate_text(frm.username, "Please enter your Username."))
		return false;
	if (!Validate_text(frm.password, "Please enter your Password."))
		return false;
		
	return true;
}

function form_home_contactus(frm) {

	if (!Validate_text(frm.firstname, "Please enter your first name."))
		return false;
	if (!Validate_text(frm.lastname, "Please enter your last name."))
		return false;
	if (!Validate_text(frm.street, "Please enter your street."))
		return false;
	if (!Validate_text(frm.city, "Please enter your city."))
		return false;
	if (!Validate_text(frm.state, "Please enter your state."))
		return false;
	if (!Validate_int(frm.postcode, "Please enter your post code."))
		return false;
	if (!Validate_text(frm.phone, "Please enter your contact phone number."))
		return false;
	if (!Validate_text(frm.email, "Please enter your email address."))
		return false;

	return true;
}


function form_checkinwizard_stage3(frm) {

	if (!Validate_text(frm.cc_cardnumber, ">> Credit Card Payment Method\n\nYou must enter your credit card number."))
		return false;
	if (!Validate_text(frm.cc_cardname, ">> Credit Card Payment Method\n\nYou must enter your name as it appears on your credit card."))
		return false;
	
	return true;
}