// set the path to the qForms directory
qFormAPI.setLibraryPath("lib/js/");
// this loads all the default libraries
qFormAPI.include("*");

function submitButtonRollover(action) {
	document.getElementById('submitButton').style.cursor='pointer';
	if (action=='over') {
		document.getElementById('submitButton').className='lightRedBG white11' ; 
	}
	else {
		document.getElementById('submitButton').className='redBG white11' ; 
	}
}

/* for tenancy application page */
function do_displayPetType(type) {
	if (type == "display") {
		document.getElementById("petTypeTr").style.display = "inline";
	}
	else {
		document.getElementById("petTypeTr").style.display = "none";
	}
}

function checkTerms() {

	var submitMe;
	
	if ((!document.tenancyapply.References[0].checked)&&(!document.tenancyapply.References[1].checked)){
		alert('Please Select "Do you have rental references?');
		return false;
	}
	else {
		submitMe = true;
	}
	
	if ((!document.tenancyapply.Pets[0].checked)&&(!document.tenancyapply.Pets[1].checked)){
		alert('Please Select "Do you have any Pets?');
		return false;
	}
	else {
		submitMe = true;
	}
	
	if ((!document.tenancyapply.Authorise[0].checked)&&(!document.tenancyapply.Authorise[1].checked)){
		alert('Please authorise that the above information is correct');
		return false;
	}
	else if (document.tenancyapply.Authorise[1].checked){
		alert('You must authorise that the above information is correct');
		return false;
	}
	else {
		return true;
	}	
}
