// JavaScript Document for the Tenants form
<!--

function checkDate(val)	{
	var today = new Date();
	var year = today.getFullYear();
if ((year-val)<25)	{
		document.building.heating_year.disabled=true;
		document.building.heating_year.value='N/A';
		document.building.plumbing_year.disabled=true;
		document.building.plumbing_year.value='N/A';
		document.building.wiring_year.disabled=true;
		document.building.wiring_year.value='N/A';
		document.building.roof_year.disabled=true;
		document.building.roof_year.value='N/A';
	}
	else	{
		document.building.heating_year.disabled=false;
		document.building.heating_year.value='';
		document.building.plumbing_year.disabled=false;
		document.building.plumbing_year.value='';
		document.building.wiring_year.disabled=false;
		document.building.wiring_year.value='';
		document.building.roof_year.disabled=false;
		document.building.roof_year.value='';
	}
}

function toggleTenants(){
	if (document.building.tenants[0].checked && document.building.num_of_tenants.disabled){
		document.building.num_of_tenants.disabled=false;
		document.building.num_of_tenants.value='';
		document.building.rent_type[0].disabled=false;
		document.building.rent_type[1].disabled=false;
		document.building.room_location.disabled=false;
		document.building.room_location.value='';
	}
	else if (document.building.tenants[1].checked){
		document.building.num_of_tenants.disabled=true;
		document.building.num_of_tenants.value='Not Applicable';
		document.building.rent_type[0].disabled=true;
		document.building.rent_type[1].disabled=true;
		document.building.room_location.disabled=true;
		document.building.room_location.value='Not Applicable';
	}
}


function toggleOlderHome(){
	if (document.building.older_home[0].checked && document.building.heating_year.disabled){
		document.building.heating_year.disabled=false;
		document.building.heating_year.value='';
		document.building.plumbing_year.disabled=false;
		document.building.plumbing_year.value='';
		document.building.wiring_year.disabled=false;
		document.building.wiring_year.value='';
		document.building.roof_year.disabled=false;
		document.building.roof_year.value='';
	}
	else if(document.building.older_home[1].checked){
		document.building.heating_year.disabled=true;
		document.building.heating_year.value='N/A';
		document.building.plumbing_year.disabled=true;
		document.building.plumbing_year.value='N/A';
		document.building.wiring_year.disabled=true;
		document.building.wiring_year.value='N/A';
		document.building.roof_year.disabled=true;
		document.building.roof_year.value='N/A';
	}
}

function toggleHeatingType(ext){

var doc = document.building;

	if (doc['heating_type' + ext][0].checked){
		doc['heating_type_other' + ext].disabled=true;
		doc['heating_type_other' + ext].value='Not Applicable';
		doc['tank_location' + ext][0].disabled=true;
		doc['tank_location' + ext][1].disabled=true;
		doc['tank_depth' + ext][0].disabled=true;
		doc['tank_depth' + ext][1].disabled=true;
		doc['tank_age' + ext].disabled=true;
		doc['tank_age' + ext].value='N/A';
	}
	else if (doc['heating_type' + ext][1].checked){
		doc['heating_type_other' + ext].disabled=true;
		doc['heating_type_other' + ext].value='Not Applicable';
		doc['tank_location' + ext][0].disabled=false;
		doc['tank_location' + ext][1].disabled=false;
		doc['tank_depth' + ext][0].disabled=false;
		doc['tank_depth' + ext][1].disabled=false;
		doc['tank_age' + ext].disabled=false;
		doc['tank_age' + ext].value='';
	}
	if (doc['heating_type' + ext][2].checked){
		doc['heating_type_other' + ext].disabled=true;
		doc['heating_type_other' + ext].value='Not Applicable';
		doc['tank_location' + ext][0].disabled=true;
		doc['tank_location' + ext][1].disabled=true;
		doc['tank_depth' + ext][0].disabled=true;
		doc['tank_depth' + ext][1].disabled=true;
		doc['tank_age' + ext].disabled=true;
		doc['tank_age' + ext].value='N/A';
	}
	else if (doc['heating_type' + ext][3].checked && doc['heating_type_other' + ext].disabled){
		doc['heating_type_other' + ext].disabled=false;
		doc['heating_type_other' + ext].value='';
		doc['tank_location' + ext][0].disabled=true;
		doc['tank_location' + ext][1].disabled=true;
		doc['tank_depth' + ext][0].disabled=true;
		doc['tank_depth' + ext][1].disabled=true;
		doc['tank_age' + ext].disabled=true;
		doc['tank_age' + ext].value='N/A';
	}			
}


function toggle2nd(ext)	{

var doc = document.building;

	if(!(document.getElementById(ext).checked))	{
doc['heating_type' + ext][0].disabled=true;
doc['heating_type' + ext][1].disabled=true;
doc['heating_type' + ext][2].disabled=true;
doc['heating_type' + ext][3].disabled=true;
doc['heating_type_other' + ext].disabled=true;
doc['heating_type_other' + ext].value='Not Applicable';
doc['tank_location' + ext][0].disabled=true;
doc['tank_location' + ext][1].disabled=true;
doc['tank_depth' + ext][0].disabled=true;
doc['tank_depth' + ext][1].disabled=true;
doc['tank_age' + ext].disabled=true;
doc['tank_age' + ext].value='N/A';
	}
	else	{
doc['heating_type' + ext][0].disabled=false;
doc['heating_type' + ext][1].disabled=false;
doc['heating_type' + ext][2].disabled=false;
doc['heating_type' + ext][3].disabled=false;
toggleHeatingType(ext);
	}
}

function toggleExtWalls(){
	if (document.building.ext_walls[12].selected){
		document.building.ext_walls_other.disabled=false;
		document.building.ext_walls_other.value='';
	}
	else {
		document.building.ext_walls_other.disabled=true;
		document.building.ext_walls_other.value='Not Applicable';
	}
}

function toggleRoofing(){
	if (document.building.roofing[12].selected){
		document.building.roofing_other.disabled=false;
		document.building.roofing_other.value='';
	}
	else {
		document.building.roofing_other.disabled=true;
		document.building.roofing_other.value='Not Applicable';
	}
}


function toggleDeck(){
	if (document.building.deck[0].checked && document.building.deck_type.disabled){
		document.building.deck_type.disabled=false;
		document.building.sq_foot_deck.disabled=false;
		document.building.sq_foot_deck.value='';
		document.building.enclosed_deck[0].disabled=false;
		document.building.enclosed_deck[1].disabled=false;
	}
	else if (document.building.deck[1].checked){
		document.building.deck_type.disabled=true;
		document.building.sq_foot_deck.disabled=true;
		document.building.sq_foot_deck.value='Not Applicable';
		document.building.enclosed_deck[0].disabled=true;
		document.building.enclosed_deck[1].disabled=true;
	}
}

function togglePool(){
	if (document.building.swimming_pool[0].checked && document.building.pool_size.disabled){
		document.building.pool_location[0].disabled=false;
		document.building.pool_location[1].disabled=false;
		document.building.pool_size.disabled=false;
		document.building.pool_size.value='';
	}
	else if(document.building.swimming_pool[1].checked){
		document.building.pool_location[0].disabled=true;
		document.building.pool_location[1].disabled=true;
		document.building.pool_size.disabled=true;
		document.building.pool_size.value='Not Applicable';
	}
	
}

function toggleFireplace(){
	if (document.building.fireplace_type[0].disabled && document.building.fireplace[0].checked){
		document.building.fireplace_type[0].disabled=false;
		document.building.fireplace_type[1].disabled=false;
		document.building.fireplace_type[2].disabled=false;
		document.building.fireplace_type[3].disabled=false;
	}
	else if (document.building.fireplace[1].checked){
		document.building.fireplace_type[0].disabled=true;
		document.building.fireplace_type[1].disabled=true;
		document.building.fireplace_type[2].disabled=true;
		document.building.fireplace_type[3].disabled=true;
	}
}

function toggleAc(){
	if (document.building.ac[0].checked && document.building.ac_ducts[0].disabled){
		document.building.ac_ducts[0].disabled=false; 
		document.building.ac_ducts[1].disabled=false;
		document.building.ac_electric_pump[0].disabled=false;
		document.building.ac_electric_pump[1].disabled=false;
		document.building.ac_house_fan[0].disabled=false;
		document.building.ac_house_fan[1].disabled=false;
	}
	else if(document.building.ac[1].checked){
		document.building.ac_ducts[0].disabled=true; 
		document.building.ac_ducts[1].disabled=true;
		document.building.ac_electric_pump[0].disabled=true;
		document.building.ac_electric_pump[1].disabled=true;
		document.building.ac_house_fan[0].disabled=true;
		document.building.ac_house_fan[1].disabled=true;
	}
}

function toggleMortgage(){
	if (document.building.mortgage[0].checked && document.building.mortgagee_details.disabled){
		document.building.mortgagee_details.disabled=false;
		document.building.mortgagee_details.value='';
		document.building.mortgage_amount.disabled=false;
		document.building.mortgage_amount.value='';
	}
	else if(document.building.mortgage[1].checked){
		document.building.mortgagee_details.disabled=true;
		document.building.mortgagee_details.value='Not Applicable';
		document.building.mortgage_amount.disabled=true;
		document.building.mortgage_amount.value='Not Applicable';
	}
}



-->

