function do_mandatoryFieldFocus(field) {
	field.style.backgroundColor = "white";
}
function do_mandatoryFieldBlur(field,requireColor)	{
	if (!field.value.length){
		field.style.backgroundColor = requireColor;
	}
}

function checkTerms() {

	var submitMe;
	var ischecked  = false;
	
	if (document.tenancyApply.selectOffice.options[document.tenancyApply.selectOffice.selectedIndex].value == 0){
		alert('Please choose an office to send this form to from the list!');
		return false;
	}
	else {
		submitMe = true;
	}
	
	if ((!document.tenancyApply.propAdvert[0].checked)&&(!document.tenancyApply.propAdvert[1].checked)&&(!document.tenancyApply.propAdvert[2].checked)&&(!document.tenancyApply.propAdvert[3].checked)&&(!document.tenancyApply.propAdvert[4].checked)){
		alert('Please select where you saw the property advertised.');
		return false;
	}
	else {
		submitMe = true;
	}
	
	if ((!document.tenancyApply.Pets[0].checked)&&(!document.tenancyApply.Pets[1].checked)){
		alert('Please select weather you own a pet or not.');
		return false;
	}
	else {
		submitMe = true;
	}
	
	if ((!document.tenancyApply.onTheMove[0].checked)&&(!document.tenancyApply.onTheMove[1].checked)){
		alert('Please select if you want On The Move to contact you to arrange your services.');
		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;
	}	
}

function validateqQforms(){
	return objForm.submitCheck();
}
function validateForm(){		
	if (validateqQforms()){
		document.tenancyApply.submit();
	}
}

/* date script */
function fixPosition(divname) {
	divstyle = getDivStyle(divname);
	positionerImgName = divname + 'Pos';
	isPlacedUnder = false;
	if (isPlacedUnder) {
	 setPosition(divstyle,positionerImgName,true);
	} 
	else {
	 setPosition(divstyle,positionerImgName)
	}
}

function toggleDatePicker(eltName,formElt) {
	var x = formElt.indexOf('.');
	var formName = formElt.substring(0,x);
	var formEltName = formElt.substring(x+1);
	newCalendar(eltName,document.forms[formName].elements[formEltName]);
	toggleVisible(eltName);
}

function do_displayPetType(type) {
	if (type == "display")	{
		document.getElementById("petTypeTr").style.display = "inline";
	}
	else {
		document.getElementById("petTypeTr").style.display = "none";
	}
}

function do_displayInternet(type) {
	if (type == "display")	{
		document.getElementById("advertInternet").style.display = "inline";
		document.getElementById("advertOther").style.display = "none";
	}
	else {
		document.getElementById("advertInternet").style.display = "none";
		document.getElementById("advertOther").style.display = "none";
	}
}

function do_displayOther(type) {
	if (type == "display")	{
		document.getElementById("advertOther").style.display = "inline";
		document.getElementById("advertInternet").style.display = "none";
	}
	else {
		document.getElementById("advertInternet").style.display = "none";
		document.getElementById("advertOther").style.display = "none";
	}
}
