// Dlg_BuiltForm.cpp : implementation file
//

#include "stdafx.h"
#include "SAPP1.h"
#include "Dlg_BuiltForm.h"
#include "SAPP1Dlg.h"

int chkDwellingTypeNewAsDesigned;
int chkDwellingTypeNewAsBuilt;
int chkDwellingTypeNewExtension;
int chkDwellingTypeNewCreatedByChange;
int chkDwellingTypeExisting;
int chkDwellingTypeOther;

// CDlg_BuiltForm dialog

IMPLEMENT_DYNAMIC(CDlg_BuiltForm, CDialog)
CDlg_BuiltForm::CDlg_BuiltForm(CWnd* pParent /*=NULL*/)
	: CDialog(CDlg_BuiltForm::IDD, pParent)
	, str_editBuiltDate(_T(""))
	, str_comboLocation(_T(""))
	, str_editStorey1Area(_T(""))
	, str_editStorey2Area(_T(""))
	, str_editStorey3Area(_T(""))
	, str_editStorey4Area(_T(""))
	, str_editStorey5Area(_T(""))
	, str_editStorey6Area(_T(""))
	, str_editStorey1Height(_T(""))
	, str_editStorey2Height(_T(""))
	, str_editStorey3Height(_T(""))
	, str_editStorey4Height(_T(""))
	, str_editStorey5Height(_T(""))
	, str_editStorey6Height(_T(""))
{
}

CDlg_BuiltForm::~CDlg_BuiltForm()
{
}

void CDlg_BuiltForm::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_STATIC_2, m_labelBuiltForm);
	DDX_Control(pDX, IDC_STATIC_1, m_labelLocation);
	DDX_Control(pDX, IDC_STATIC_3, m_labelStoreys);
	DDX_Control(pDX, IDC_RADIO1, m_btnDwellingTypeNewAsDesigned);
	DDX_Control(pDX, IDC_RADIO2, m_btnDwellingTypeNewAsBuilt);
	DDX_Control(pDX, IDC_RADIO3, m_btnDwellingTypeNewExtension);
	DDX_Control(pDX, IDC_RADIO4, m_btnDwellingTypeNewCreatedByChange);
	DDX_Control(pDX, IDC_RADIO5, m_btnDwellingTypeExisting);
	DDX_Control(pDX, IDC_RADIO6, m_btnDwellingTypeOther);
	DDX_Control(pDX, IDC_RADIO7, m_btnPropertyTypeHouse);
	DDX_Control(pDX, IDC_RADIO8, m_btnPropertyTypeBungalow);
	DDX_Control(pDX, IDC_RADIO9, m_btnPropertyTypeFlat);
	DDX_Control(pDX, IDC_RADIO10, m_btnPropertyTypeMaisonette);
	DDX_Control(pDX, IDC_RADIO11, m_btnBuiltFormDetached);
	DDX_Control(pDX, IDC_RADIO12, m_btnBuiltFormSemiDetached);
	DDX_Control(pDX, IDC_RADIO13, m_btnBuiltFormMidTerr);
	DDX_Control(pDX, IDC_RADIO14, m_btnBuiltFormEndTerr);
	DDX_Control(pDX, IDC_RADIO15, m_btnBuiltFormEncMidTerr);
	DDX_Control(pDX, IDC_RADIO16, m_btnBuiltFormEncEndTerr);
	DDX_Control(pDX, IDC_RADIO17, m_btnFlatTypeGround);
	DDX_Control(pDX, IDC_RADIO18, m_btnFlatTypeMidFloor);
	DDX_Control(pDX, IDC_RADIO19, m_btnFlatTypeTopFloor);
	DDX_Control(pDX, IDC_RADIO25, m_btnShelteredSides1);
	DDX_Control(pDX, IDC_RADIO26, m_btnShelteredSides2);
	DDX_Control(pDX, IDC_RADIO27, m_btnShelteredSides3);
	DDX_Control(pDX, IDC_RADIO28, m_btnShelteredSides4);
	DDX_Control(pDX, IDC_RADIO29, m_btnTerrainDenseUrban);
	DDX_Control(pDX, IDC_RADIO30, m_btnTerrainLowRiseUrban);
	DDX_Control(pDX, IDC_RADIO31, m_btnTerrainRural);
	DDX_Control(pDX, IDC_RADIO20, m_btnExposureExposed);
	DDX_Control(pDX, IDC_RADIO21, m_btnExposureAboveAvg);
	DDX_Control(pDX, IDC_RADIO22, m_btnExposureAvg);
	DDX_Control(pDX, IDC_RADIO23, m_btnExposureBelowAvg);
	DDX_Control(pDX, IDC_RADIO24, m_btnExposureSheltered);
	DDX_Control(pDX, IDC_COMBO1, m_comboLocation);
	DDX_Control(pDX, IDC_EDIT13, m_editStorey1Area);
	DDX_Control(pDX, IDC_EDIT15, m_editStorey2Area);
	DDX_Control(pDX, IDC_EDIT17, m_editStorey3Area);
	DDX_Control(pDX, IDC_EDIT19, m_editStorey4Area);
	DDX_Control(pDX, IDC_EDIT21, m_editStorey5Area);
	DDX_Control(pDX, IDC_EDIT23, m_editStorey6Area);
	DDX_Control(pDX, IDC_EDIT14, m_editStorey1Height);
	DDX_Control(pDX, IDC_EDIT16, m_editStorey2Height);
	DDX_Control(pDX, IDC_EDIT18, m_editStorey3Height);
	DDX_Control(pDX, IDC_EDIT20, m_editStorey4Height);
	DDX_Control(pDX, IDC_EDIT22, m_editStorey5Height);
	DDX_Control(pDX, IDC_EDIT24, m_editStorey6Height);
	DDX_Control(pDX, IDC_CHECK2, m_btnStorey1Basement);
	DDX_Control(pDX, IDC_CHECK4, m_btnStorey2Basement);
	DDX_Control(pDX, IDC_CHECK6, m_btnStorey3Basement);
	DDX_Control(pDX, IDC_CHECK8, m_btnStorey4Basement);
	DDX_Control(pDX, IDC_CHECK10, m_btnStorey5Basement);
	DDX_Control(pDX, IDC_CHECK12, m_btnStorey6Basement);
	DDX_Control(pDX, IDC_CHECK1, m_btnStorey1);
	DDX_Control(pDX, IDC_CHECK3, m_btnStorey2);
	DDX_Control(pDX, IDC_CHECK5, m_btnStorey3);
	DDX_Control(pDX, IDC_CHECK7, m_btnStorey4);
	DDX_Control(pDX, IDC_CHECK9, m_btnStorey5);
	DDX_Control(pDX, IDC_CHECK11, m_btnStorey6);
	DDX_Control(pDX, IDC_EDIT12, m_editBuiltDate);
	DDX_Text(pDX, IDC_EDIT12, str_editBuiltDate);
	DDX_CBString(pDX, IDC_COMBO1, str_comboLocation);
		DDX_Text(pDX, IDC_EDIT13, str_editStorey1Area);
	DDX_Text(pDX, IDC_EDIT15, str_editStorey2Area);
	DDX_Text(pDX, IDC_EDIT17, str_editStorey3Area);
	DDX_Text(pDX, IDC_EDIT19, str_editStorey4Area);
	DDX_Text(pDX, IDC_EDIT21, str_editStorey5Area);
	DDX_Text(pDX, IDC_EDIT23, str_editStorey6Area);
	DDX_Text(pDX, IDC_EDIT14, str_editStorey1Height);
	DDX_Text(pDX, IDC_EDIT16, str_editStorey2Height);
	DDX_Text(pDX, IDC_EDIT18, str_editStorey3Height);
	DDX_Text(pDX, IDC_EDIT20, str_editStorey4Height);
	DDX_Text(pDX, IDC_EDIT22, str_editStorey5Height);
	DDX_Text(pDX, IDC_EDIT24, str_editStorey6Height);
	DDX_Control(pDX, IDC_STATIC_FT, m_labelFlatType);
	DDX_Control(pDX, IDC_STATIC_frameFlat, m_frameFlat);
	DDX_Control(pDX, IDC_STATIC_dwellingType, m_labelDwellingType);
	DDX_Control(pDX, IDC_STATIC_propertyType, m_labelPropertyType);
	DDX_Control(pDX, IDC_STATIC_detachment, m_labelDetachment);
	DDX_Control(pDX, IDC_STATIC_FT2, m_labelYearOfBuilt);
	DDX_Control(pDX, IDC_STATIC_location, m_labelLocation1);
	DDX_Control(pDX, IDC_STATIC_shelteredSides, m_labelShelteredSides);
	DDX_Control(pDX, IDC_STATIC_terrain, m_labelTerrain);
	DDX_Control(pDX, IDC_STATIC_storeys, m_labelStoreys1);
}

BEGIN_MESSAGE_MAP(CDlg_BuiltForm, CDialog)
	ON_BN_CLICKED(IDC_RADIO1, OnBnClickedRadio1)
	ON_BN_CLICKED(IDC_RADIO2, OnBnClickedRadio2)
	ON_BN_CLICKED(IDC_RADIO3, OnBnClickedRadio3)
	ON_BN_CLICKED(IDC_RADIO4, OnBnClickedRadio4)
	ON_BN_CLICKED(IDC_RADIO5, OnBnClickedRadio5)
	ON_BN_CLICKED(IDC_RADIO6, OnBnClickedRadio6)
	ON_BN_CLICKED(IDC_RADIO7, OnBnClickedRadio7)
	ON_BN_CLICKED(IDC_RADIO8, OnBnClickedRadio8)
	ON_BN_CLICKED(IDC_RADIO9, OnBnClickedRadio9)
	ON_BN_CLICKED(IDC_RADIO10, OnBnClickedRadio10)
	ON_BN_CLICKED(IDC_RADIO11, OnBnClickedRadio11)
	ON_BN_CLICKED(IDC_RADIO12, OnBnClickedRadio12)
	ON_BN_CLICKED(IDC_RADIO13, OnBnClickedRadio13)
	ON_BN_CLICKED(IDC_RADIO14, OnBnClickedRadio14)
	ON_BN_CLICKED(IDC_RADIO15, OnBnClickedRadio15)
	ON_BN_CLICKED(IDC_RADIO16, OnBnClickedRadio16)
	ON_BN_CLICKED(IDC_RADIO17, OnBnClickedRadio17)
	ON_BN_CLICKED(IDC_RADIO18, OnBnClickedRadio18)
	ON_BN_CLICKED(IDC_RADIO19, OnBnClickedRadio19)
	ON_BN_CLICKED(IDC_RADIO25, OnBnClickedRadio25)
	ON_BN_CLICKED(IDC_RADIO26, OnBnClickedRadio26)
	ON_BN_CLICKED(IDC_RADIO27, OnBnClickedRadio27)
	ON_BN_CLICKED(IDC_RADIO28, OnBnClickedRadio28)
	ON_BN_CLICKED(IDC_RADIO29, OnBnClickedRadio29)
	ON_BN_CLICKED(IDC_RADIO30, OnBnClickedRadio30)
	ON_BN_CLICKED(IDC_RADIO31, OnBnClickedRadio31)
	ON_BN_CLICKED(IDC_RADIO20, OnBnClickedRadio20)
	ON_BN_CLICKED(IDC_RADIO21, OnBnClickedRadio21)
	ON_BN_CLICKED(IDC_RADIO22, OnBnClickedRadio22)
	ON_BN_CLICKED(IDC_RADIO23, OnBnClickedRadio23)
	ON_BN_CLICKED(IDC_RADIO24, OnBnClickedRadio24)
	ON_CBN_SELCHANGE(IDC_COMBO1, OnCbnSelchangeCombo1)
	ON_CBN_SELCHANGE(IDC_COMBO5, OnCbnSelchangeCombo5)
	ON_CBN_SELCHANGE(IDC_COMBO6, OnCbnSelchangeCombo6)
	ON_CBN_SELCHANGE(IDC_COMBO7, OnCbnSelchangeCombo7)
	ON_CBN_SELCHANGE(IDC_COMBO8, OnCbnSelchangeCombo8)
	ON_CBN_SELCHANGE(IDC_COMBO9, OnCbnSelchangeCombo9)
	ON_CBN_SELCHANGE(IDC_COMBO10, OnCbnSelchangeCombo10)
	ON_BN_CLICKED(IDC_CHECK1, OnBnClickedCheck1)
	ON_BN_CLICKED(IDC_CHECK3, OnBnClickedCheck3)
	ON_BN_CLICKED(IDC_CHECK5, OnBnClickedCheck5)
	ON_BN_CLICKED(IDC_CHECK7, OnBnClickedCheck7)
	ON_BN_CLICKED(IDC_CHECK9, OnBnClickedCheck9)
	ON_BN_CLICKED(IDC_CHECK11, OnBnClickedCheck11)
	ON_BN_CLICKED(IDC_CHECK2, OnBnClickedCheck2)
	ON_BN_CLICKED(IDC_CHECK4, OnBnClickedCheck4)
	ON_BN_CLICKED(IDC_CHECK6, OnBnClickedCheck6)
	ON_BN_CLICKED(IDC_CHECK8, OnBnClickedCheck8)
	ON_BN_CLICKED(IDC_CHECK10, OnBnClickedCheck10)
	ON_BN_CLICKED(IDC_CHECK12, OnBnClickedCheck12)
	ON_EN_CHANGE(IDC_EDIT13, OnEnChangeEdit13)
	ON_EN_CHANGE(IDC_EDIT15, OnEnChangeEdit15)
	ON_EN_CHANGE(IDC_EDIT17, OnEnChangeEdit17)
	ON_EN_CHANGE(IDC_EDIT19, OnEnChangeEdit19)
	ON_EN_CHANGE(IDC_EDIT21, OnEnChangeEdit21)
	ON_EN_CHANGE(IDC_EDIT23, OnEnChangeEdit23)
	ON_EN_CHANGE(IDC_EDIT14, OnEnChangeEdit14)
	ON_EN_CHANGE(IDC_EDIT16, OnEnChangeEdit16)
	ON_EN_CHANGE(IDC_EDIT18, OnEnChangeEdit18)
	ON_EN_CHANGE(IDC_EDIT20, OnEnChangeEdit20)
	ON_EN_CHANGE(IDC_EDIT22, OnEnChangeEdit22)
	ON_EN_CHANGE(IDC_EDIT24, OnEnChangeEdit24)
	ON_EN_CHANGE(IDC_EDIT12, OnEnChangeEdit12)
	ON_STN_CLICKED(IDC_STATIC_3, OnStnClickedStatic3)
END_MESSAGE_MAP()

// CDlg_BuiltForm message handlers

BOOL CDlg_BuiltForm::OnInitDialog()
{
	CDialog::OnInitDialog();

	//---------------------------------------------------
	// LABELS
	//---------------------------------------------------
	CFont *m_Font1 = new CFont;
	m_Font1->CreatePointFont(90, "Arial Bold");
	
	m_labelBuiltForm.SetFont(m_Font1); 
	m_labelBuiltForm.SetTextColor(BLUE); 

	m_labelLocation.SetFont(m_Font1); 
	m_labelLocation.SetTextColor(BLUE); 

	m_labelStoreys.SetFont(m_Font1); 
	m_labelStoreys.SetTextColor(BLUE); 

	m_labelFlatType.SetTextColor(NAVYBLUE); 
	m_labelDwellingType.SetTextColor(NAVYBLUE); 
	m_labelPropertyType.SetTextColor(NAVYBLUE); 
	m_labelDetachment.SetTextColor(NAVYBLUE); 
	m_labelYearOfBuilt.SetTextColor(NAVYBLUE); 
	m_labelLocation1.SetTextColor(NAVYBLUE); 
	m_labelShelteredSides.SetTextColor(NAVYBLUE); 
	m_labelTerrain.SetTextColor(NAVYBLUE); 
	m_labelStoreys1.SetTextColor(NAVYBLUE); 

	//---------------------------------------------------
	// Hide labels and buttons for flat type	
	m_frameFlat.EnableWindow(FALSE);
	m_labelFlatType.EnableWindow(FALSE);
	m_btnFlatTypeGround.EnableWindow(FALSE);
	m_btnFlatTypeMidFloor.EnableWindow(FALSE);
	m_btnFlatTypeTopFloor.EnableWindow(FALSE);

	//---------------------------------------------------
	// DROP DOWN MENUS
	//---------------------------------------------------
	AddStringsToBuiltFormDlg();

	if(file_new_selected ==true)
	{
		SetAllValuesToDefault();
	}

	DisplayValuesForBuiltFormDlg();

	return TRUE;
}

void CDlg_BuiltForm::AddStringsToBuiltFormDlg()
{
	//---------------------------------------------
	//	CLIMATE
	//---------------------------------------------
	unsigned int i = 0;
	i = ClimateData_1.size();
	int index = 0;

	m_comboLocation.InsertString(0,"Select weather..");

	index = 1;
	for(i= 0; i<ClimateData_1.size();i++)
	{
		m_comboLocation.InsertString(index,ClimateData_1[i].locationName);
		index++;
	}
}

void CDlg_BuiltForm::DisplayValuesForBuiltFormDlg()
{
	int check;
	
	//-----------------------------------------------
	// PROPERTY TYPE
	//-----------------------------------------------	
	if (builtForm == "House")
	{
		m_btnPropertyTypeHouse.SetCheck(1);
	}
	else if (builtForm == "Bungalow")
	{
		m_btnPropertyTypeBungalow.SetCheck(1);
	}
	else if (builtForm == "Flat")
	{
		m_btnPropertyTypeFlat.SetCheck(1);
	}
	else if (builtForm == "Maisonette")
	{
		m_btnPropertyTypeMaisonette.SetCheck(1);
	}

	 if ((builtForm == "Flat") || (builtForm == "Maisonette"))
	{
		// Enable labels and buttons for flat type		
		m_frameFlat.EnableWindow(TRUE);
		m_labelFlatType.EnableWindow(TRUE);
		m_btnFlatTypeGround.EnableWindow(TRUE);
		m_btnFlatTypeMidFloor.EnableWindow(TRUE);
		m_btnFlatTypeTopFloor.EnableWindow(TRUE);
	}
	else 
	{
		// Disable labels and buttons for flat type		
		m_frameFlat.EnableWindow(FALSE);
		m_labelFlatType.EnableWindow(FALSE);
		m_btnFlatTypeGround.EnableWindow(FALSE);
		m_btnFlatTypeMidFloor.EnableWindow(FALSE);
		m_btnFlatTypeTopFloor.EnableWindow(FALSE);
	}

	if  ((builtForm == "House") || (builtForm == "Bungalow"))
	{
		m_btnBuiltFormDetached.EnableWindow(TRUE);
		m_btnBuiltFormSemiDetached.EnableWindow(TRUE);
		m_btnBuiltFormMidTerr.EnableWindow(TRUE);
		m_btnBuiltFormEndTerr.EnableWindow(TRUE);
		m_btnBuiltFormEncMidTerr.EnableWindow(TRUE);
		m_btnBuiltFormEncEndTerr.EnableWindow(TRUE);	
	}
	else
	{
		m_btnBuiltFormDetached.EnableWindow(FALSE);
		m_btnBuiltFormSemiDetached.EnableWindow(FALSE);
		m_btnBuiltFormMidTerr.EnableWindow(FALSE);
		m_btnBuiltFormEndTerr.EnableWindow(FALSE);
		m_btnBuiltFormEncMidTerr.EnableWindow(FALSE);
		m_btnBuiltFormEncEndTerr.EnableWindow(FALSE);	
	}

	//-----------------------------------------------
	// BUILT FORM
	//-----------------------------------------------
	if (Detachment == "Detached")
	{
		m_btnBuiltFormDetached.SetCheck(1);
	}
	else if (Detachment == "Semi-detached")
	{
		m_btnBuiltFormSemiDetached.SetCheck(1);
	}
	else if (Detachment == "Mid terrace")
	{
		m_btnBuiltFormMidTerr.SetCheck(1);
	}
	else if (Detachment == "End terrace")
	{
		m_btnBuiltFormEndTerr.SetCheck(1);
	}
	else if (Detachment == "Enclosed mid terrace")
	{
		m_btnBuiltFormEncMidTerr.SetCheck(1);
	}
	else if (Detachment == "Enclosed end terrace")
	{
		m_btnBuiltFormEncEndTerr.SetCheck(1);
	}


	//-----------------------------------------------
	// FLAT TYPE
	//-----------------------------------------------
	if (FlatPosition == "Ground floor")
	{
		m_btnFlatTypeGround.SetCheck(1);
	}
	else if (FlatPosition == "Mid floor")
	{
		m_btnFlatTypeMidFloor.SetCheck(1);
	}
	else if (FlatPosition == "Top floor")
	{
		m_btnFlatTypeTopFloor.SetCheck(1);
	}

	//-----------------------------------------------
	// YEAR BUILT
	//-----------------------------------------------
	str_editBuiltDate.Format ("%s", yearPropertBuilt);

	//-----------------------------------------------
	// DEGREE DAY LOCATION
	//-----------------------------------------------
	str_comboLocation.Format("%s",locationString);

	//-----------------------------------------------
	// SHELTERED SIDES
	//-----------------------------------------------
	if (dwellingShelteredSides ==1 )
	{
		m_btnShelteredSides1.SetCheck(1);
	}
	else if (dwellingShelteredSides ==2 )
	{
		m_btnShelteredSides2.SetCheck(1);
	}
	else if (dwellingShelteredSides ==3 )
	{
		m_btnShelteredSides3.SetCheck(1);
	}
	else if (dwellingShelteredSides ==4 )
	{
		m_btnShelteredSides4.SetCheck(1);
	}

	//-----------------------------------------------
	// TERRAIN
	//-----------------------------------------------
	if (dwellingTerrain == "Dense urban")
	{
		m_btnTerrainDenseUrban.SetCheck(1);
	}
	else if (dwellingTerrain == "Low rise urban/suburban")
	{
		m_btnTerrainLowRiseUrban.SetCheck(1);
	}
	else if (dwellingTerrain == "Rural")
	{
		m_btnTerrainRural.SetCheck(1);
	}

	//-----------------------------------------------
	// TYPE OF DWELLING
	//-----------------------------------------------
	if (dwellingType == "New dwelling as designed")
	{
		chkDwellingTypeNewAsDesigned = 1;
		chkDwellingTypeNewAsBuilt = 0;
		chkDwellingTypeNewExtension = 0;
		chkDwellingTypeNewCreatedByChange = 0;
		chkDwellingTypeExisting = 0;
		chkDwellingTypeOther = 0;
		
		m_btnDwellingTypeNewAsDesigned.SetCheck(1);
		m_btnDwellingTypeNewAsBuilt.SetCheck(0);
		m_btnDwellingTypeNewExtension.SetCheck(0);
		m_btnDwellingTypeNewCreatedByChange.SetCheck(0);
		m_btnDwellingTypeExisting.SetCheck(0);
		m_btnDwellingTypeOther.SetCheck(0);
	}
	else if (dwellingType == "New dwelling as built")
	{
		chkDwellingTypeNewAsDesigned = 0;
		chkDwellingTypeNewAsBuilt = 1;
		chkDwellingTypeNewExtension = 0;
		chkDwellingTypeNewCreatedByChange = 0;
		chkDwellingTypeExisting = 0;
		chkDwellingTypeOther = 0;
	
		m_btnDwellingTypeNewAsDesigned.SetCheck(0);
		m_btnDwellingTypeNewAsBuilt.SetCheck(1);
		m_btnDwellingTypeNewExtension.SetCheck(0);
		m_btnDwellingTypeNewCreatedByChange.SetCheck(0);
		m_btnDwellingTypeExisting.SetCheck(0);
		m_btnDwellingTypeOther.SetCheck(0);

		check = m_btnDwellingTypeNewAsBuilt.GetCheck();
	}
	else if (dwellingType == "New extension to existing dwelling")
	{
		chkDwellingTypeNewAsDesigned = 0;
		chkDwellingTypeNewAsBuilt = 0;
		chkDwellingTypeNewExtension = 1;
		chkDwellingTypeNewCreatedByChange = 0;
		chkDwellingTypeExisting = 0;
		chkDwellingTypeOther = 0;
	
		m_btnDwellingTypeNewAsDesigned.SetCheck(0);
		m_btnDwellingTypeNewAsBuilt.SetCheck(0);
		m_btnDwellingTypeNewExtension.SetCheck(1);
		m_btnDwellingTypeNewCreatedByChange.SetCheck(0);
		m_btnDwellingTypeExisting.SetCheck(0);
		m_btnDwellingTypeOther.SetCheck(0);
	}
	else if (dwellingType == "New dwelling created by change of use")
	{
		chkDwellingTypeNewAsDesigned = 0;
		chkDwellingTypeNewAsBuilt = 0;
		chkDwellingTypeNewExtension = 0;
		chkDwellingTypeNewCreatedByChange = 1;
		chkDwellingTypeExisting = 0;
		chkDwellingTypeOther = 0;

		m_btnDwellingTypeNewAsDesigned.SetCheck(0);
		m_btnDwellingTypeNewAsBuilt.SetCheck(0);
		m_btnDwellingTypeNewExtension.SetCheck(0);
		m_btnDwellingTypeNewCreatedByChange.SetCheck(1);
		m_btnDwellingTypeExisting.SetCheck(0);
		m_btnDwellingTypeOther.SetCheck(0);
	}
	else if (dwellingType == "Existing dwelling")
	{
		chkDwellingTypeNewAsDesigned = 0;
		chkDwellingTypeNewAsBuilt = 0;
		chkDwellingTypeNewExtension = 0;
		chkDwellingTypeNewCreatedByChange = 0;
		chkDwellingTypeExisting = 1;
		chkDwellingTypeOther = 0;
		
		m_btnDwellingTypeNewAsDesigned.SetCheck(0);
		m_btnDwellingTypeNewAsBuilt.SetCheck(0);
		m_btnDwellingTypeNewExtension.SetCheck(0);
		m_btnDwellingTypeNewCreatedByChange.SetCheck(0);
		m_btnDwellingTypeExisting.SetCheck(1);
		m_btnDwellingTypeOther.SetCheck(0);
	}
	else if (dwellingType == "Other")
	{
		chkDwellingTypeNewAsDesigned = 0;
		chkDwellingTypeNewAsBuilt = 0;
		chkDwellingTypeNewExtension = 0;
		chkDwellingTypeNewCreatedByChange = 0;
		chkDwellingTypeExisting = 0;
		chkDwellingTypeOther = 1;

		m_btnDwellingTypeNewAsDesigned.SetCheck(0);
		m_btnDwellingTypeNewAsBuilt.SetCheck(0);
		m_btnDwellingTypeNewExtension.SetCheck(0);
		m_btnDwellingTypeNewCreatedByChange.SetCheck(0);
		m_btnDwellingTypeExisting.SetCheck(0);
		m_btnDwellingTypeOther.SetCheck(1);
	}

	//-----------------------------------------------
	// BASEMENT FOR STOREYS SELECTED
	//----------------------------------------------	
	// if  checked	
	if(storey1Basement == "yes")
	{
		m_btnStorey1Basement.SetCheck(1);
	}
	if(storey2Basement == "yes")
	{
		m_btnStorey2Basement.SetCheck(1);
	}
	if(storey3Basement == "yes")
	{
		m_btnStorey3Basement.SetCheck(1);
	}
	if(storey4Basement == "yes")
	{
		m_btnStorey4Basement.SetCheck(1);
	}
	if(storey5Basement == "yes")
	{
		m_btnStorey5Basement.SetCheck(1);
	}
	if(storey6Basement == "yes")
	{
		m_btnStorey6Basement.SetCheck(1);
	}

	// if  not checked
	if(storey1Basement == "no")
	{
		m_btnStorey1Basement.SetCheck(0);
	}
	if(storey2Basement == "no")
	{
		m_btnStorey2Basement.SetCheck(0);
	}
	if(storey3Basement == "no")
	{
		m_btnStorey3Basement.SetCheck(0);
	}
	if(storey4Basement == "no")
	{
		m_btnStorey4Basement.SetCheck(0);
	}
	if(storey5Basement == "no")
	{
		m_btnStorey5Basement.SetCheck(0);
	}
	if(storey6Basement == "no")
	{
		m_btnStorey6Basement.SetCheck(0);
	}

	//-----------------------------------------------
	// AREA OF STOREYS 
	//-----------------------------------------------		
	str_editStorey1Area.Format("%.1f",storey1Area);
	str_editStorey2Area.Format("%.1f",storey2Area);
	str_editStorey3Area.Format("%.1f",storey3Area);
	str_editStorey4Area.Format("%.1f",storey4Area);
	str_editStorey5Area.Format("%.1f",storey5Area);
	str_editStorey6Area.Format("%.1f",storey6Area);

	//-----------------------------------------------
	// HEIGHT OF STOREYS 
	//-----------------------------------------------		
	str_editStorey1Height.Format("%.1f",storey1Height);
	str_editStorey2Height.Format("%.1f",storey2Height);
	str_editStorey3Height.Format("%.1f",storey3Height);
	str_editStorey4Height.Format("%.1f",storey4Height);
	str_editStorey5Height.Format("%.1f",storey5Height);
	str_editStorey6Height.Format("%.1f",storey6Height);

	TFA = storey1Area +
		  storey2Area +
		  storey3Area +
		  storey4Area +
		  storey5Area +
		  storey6Area;

	UpdateData(FALSE);
}

void CDlg_BuiltForm::ReadInputsFromBuiltFormDlg()
{
	UpdateData(TRUE);

	//-----------------------------------------------
	// TYPE OF DWELLING
	//-----------------------------------------------
	if( chkDwellingTypeNewAsDesigned==1)
	{
		dwellingType = "New dwelling as designed";
	}
	else if( chkDwellingTypeNewAsBuilt==1)
	{
		dwellingType = "New dwelling as built";
	}
	else if( chkDwellingTypeNewExtension ==1)
	{
		dwellingType = "New extension to existing dwelling";
	}
	else if( chkDwellingTypeNewCreatedByChange ==1)
	{
		dwellingType = "New dwelling created by change of use";
	}
	else if( chkDwellingTypeExisting ==1)
	{
		dwellingType = "Existing dwelling";
	}
	else if( chkDwellingTypeOther ==1)
	{
		dwellingType = "Other";
	}

	//-----------------------------------------------
	// PROPERTY TYPE
	//-----------------------------------------------
	if( m_btnPropertyTypeHouse.GetCheck()==1)
	{
		builtForm = "House";
	}
	else if( m_btnPropertyTypeBungalow.GetCheck()==1)
	{
		builtForm = "Bungalow";
	}
	else if( m_btnPropertyTypeFlat.GetCheck()==1)
	{
		builtForm = "Flat";
	}
	else if( m_btnPropertyTypeMaisonette.GetCheck()==1)
	{
		builtForm = "Maisonette";
	}

	if  ((builtForm == "Flat") || (builtForm == "Maisonette"))
	{
		// Enable labels and buttons for flat type
		
		m_frameFlat.EnableWindow(TRUE);
		m_labelFlatType.EnableWindow(TRUE);
		m_btnFlatTypeGround.EnableWindow(TRUE);
		m_btnFlatTypeMidFloor.EnableWindow(TRUE);
		m_btnFlatTypeTopFloor.EnableWindow(TRUE);
	}
	else 
	{
		// Disable labels and buttons for flat type
		m_frameFlat.EnableWindow(FALSE);
		m_labelFlatType.EnableWindow(FALSE);
		m_btnFlatTypeGround.EnableWindow(FALSE);
		m_btnFlatTypeMidFloor.EnableWindow(FALSE);
		m_btnFlatTypeTopFloor.EnableWindow(FALSE);
	}

	if  ((builtForm == "House") || (builtForm == "Bungalow"))
	{
		m_btnBuiltFormDetached.EnableWindow(TRUE);
		m_btnBuiltFormSemiDetached.EnableWindow(TRUE);
		m_btnBuiltFormMidTerr.EnableWindow(TRUE);
		m_btnBuiltFormEndTerr.EnableWindow(TRUE);
		m_btnBuiltFormEncMidTerr.EnableWindow(TRUE);
		m_btnBuiltFormEncEndTerr.EnableWindow(TRUE);	
	}
	else
	{
		m_btnBuiltFormDetached.EnableWindow(FALSE);
		m_btnBuiltFormSemiDetached.EnableWindow(FALSE);
		m_btnBuiltFormMidTerr.EnableWindow(FALSE);
		m_btnBuiltFormEndTerr.EnableWindow(FALSE);
		m_btnBuiltFormEncMidTerr.EnableWindow(FALSE);
		m_btnBuiltFormEncEndTerr.EnableWindow(FALSE);	
	}

	//-----------------------------------------------
	// BUILT FORM
	//-----------------------------------------------
	if( m_btnBuiltFormDetached.GetCheck()==1)
	{
		Detachment = "Detached";
	}
	else if( m_btnBuiltFormSemiDetached.GetCheck()==1)
	{
		Detachment = "Semi-detached";
	}
	else if( m_btnBuiltFormMidTerr.GetCheck()==1)
	{
		Detachment = "Mid terrace";
	}
	else if( m_btnBuiltFormEndTerr.GetCheck()==1)
	{
		Detachment = "End terrace";
	}
	else if( m_btnBuiltFormEncMidTerr.GetCheck()==1)
	{
		Detachment = "Enclosed mid terrace";
	}
	else if( m_btnBuiltFormEncEndTerr.GetCheck()==1)
	{
		Detachment = "Enclosed end terrace";
	}

	//-----------------------------------------------
	// FLAT TYPE
	//-----------------------------------------------
	if( m_btnFlatTypeGround.GetCheck()==1)
	{
		FlatPosition = "Ground floor";
	}
	else if( m_btnFlatTypeMidFloor.GetCheck()==1)
	{
		FlatPosition = "Mid floor";
	}
	else if( m_btnFlatTypeTopFloor.GetCheck()==1)
	{
		FlatPosition = "Top floor";
	}

	//-----------------------------------------------
	// YEAR BUILT
	//-----------------------------------------------
	yearPropertBuilt = str_editBuiltDate;

	//-----------------------------------------------
	// DEGREE DAY LOCATION
	//-----------------------------------------------
	locationString = str_comboLocation;
	is_locationString_changed = true;
	
	//-----------------------------------------------
	// SHELTERED SIDES
	//-----------------------------------------------
	if( m_btnShelteredSides1.GetCheck()==1)
	{
		dwellingShelteredSides = 1;
	}
	else if( m_btnShelteredSides2.GetCheck()==1)
	{
		dwellingShelteredSides = 2;
	}
	else if( m_btnShelteredSides3.GetCheck()==1)
	{
		dwellingShelteredSides = 3;
	}
	else if( m_btnShelteredSides4.GetCheck()==1)
	{
		dwellingShelteredSides = 4;
	}

	//-----------------------------------------------
	// TERRAIN
	//-----------------------------------------------
	if( m_btnTerrainDenseUrban.GetCheck()==1)
	{
		dwellingTerrain = "Dense urban";
	}
	else if( m_btnTerrainLowRiseUrban.GetCheck()==1)
	{
		dwellingTerrain = "Low rise urban/suburban";
	}
	else if( m_btnTerrainRural.GetCheck()==1)
	{
		dwellingTerrain = "Rural";
	}

	//-----------------------------------------------
	// BASEMENT FOR STOREYS SELECTED
	//-----------------------------------------------	
	// if  checked
	if( m_btnStorey1Basement.GetCheck()==1)
	{
		storey1Basement = "yes";
	}
	if( m_btnStorey2Basement.GetCheck()==1)
	{
		storey2Basement = "yes";
	}
	if( m_btnStorey3Basement.GetCheck()==1)
	{
		storey3Basement = "yes";
	}
	if( m_btnStorey4Basement.GetCheck()==1)
	{
		storey4Basement = "yes";
	}
	if( m_btnStorey5Basement.GetCheck()==1)
	{
		storey5Basement = "yes";
	}
	if( m_btnStorey6Basement.GetCheck()==1)
	{
		storey6Basement = "yes";
	}

	// if  not checked
	if( m_btnStorey1Basement.GetCheck()==0)
	{
		storey1Basement = "no";
	}
	if( m_btnStorey2Basement.GetCheck()==0)
	{
		storey2Basement = "no";
	}
	if( m_btnStorey3Basement.GetCheck()==0)
	{
		storey3Basement = "no";
	}
	if( m_btnStorey4Basement.GetCheck()==0)
	{
		storey4Basement = "no";
	}
	if( m_btnStorey5Basement.GetCheck()==0)
	{
		storey5Basement = "no";
	}
	if( m_btnStorey6Basement.GetCheck()==0)
	{
		storey6Basement = "no";
	}

	//-----------------------------------------------
	// AREA OF STOREYS 
	//-----------------------------------------------		
	storey1Area = atof(str_editStorey1Area);
	storey2Area = atof(str_editStorey2Area);
	storey3Area = atof(str_editStorey3Area);
	storey4Area = atof(str_editStorey4Area);
	storey5Area = atof(str_editStorey5Area);
	storey6Area = atof(str_editStorey6Area);

	//-----------------------------------------------
	// HEIGHT OF STOREYS 
	//-----------------------------------------------		
	storey1Height = atof(str_editStorey1Height);
	storey2Height = atof(str_editStorey2Height);
	storey3Height = atof(str_editStorey3Height);
	storey4Height = atof(str_editStorey4Height);
	storey5Height = atof(str_editStorey5Height);
	storey6Height = atof(str_editStorey6Height);

	TFA = storey1Area +
		  storey2Area +
		  storey3Area +
		  storey4Area +
		  storey5Area +
		  storey6Area;
}
void CDlg_BuiltForm::OnBnClickedRadio1()
{
    m_btnDwellingTypeNewAsBuilt.SetCheck(0);
	m_btnDwellingTypeNewExtension.SetCheck(0);
	m_btnDwellingTypeNewCreatedByChange.SetCheck(0);
	m_btnDwellingTypeExisting.SetCheck(0);
	m_btnDwellingTypeOther.SetCheck(0);

	chkDwellingTypeNewAsDesigned  = 1;
	chkDwellingTypeNewAsBuilt     = 0;
	chkDwellingTypeNewExtension   = 0;
	chkDwellingTypeNewCreatedByChange =  0;
	chkDwellingTypeExisting       = 0;
	chkDwellingTypeOther          = 0;

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio2()
{
	m_btnDwellingTypeNewAsDesigned.SetCheck(0);
	m_btnDwellingTypeNewExtension.SetCheck(0);
	m_btnDwellingTypeNewCreatedByChange.SetCheck(0);
	m_btnDwellingTypeExisting.SetCheck(0);
	m_btnDwellingTypeOther.SetCheck(0);

	chkDwellingTypeNewAsDesigned  = 0;
	chkDwellingTypeNewAsBuilt     = 1;
	chkDwellingTypeNewExtension   = 0;
	chkDwellingTypeNewCreatedByChange =  0;
	chkDwellingTypeExisting       =0;
	chkDwellingTypeOther          = 0;

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio3()
{
	m_btnDwellingTypeNewAsDesigned.SetCheck(0);
	m_btnDwellingTypeNewAsBuilt.SetCheck(0);
	m_btnDwellingTypeNewCreatedByChange.SetCheck(0);
	m_btnDwellingTypeExisting.SetCheck(0);
	m_btnDwellingTypeOther.SetCheck(0);

	chkDwellingTypeNewAsDesigned  = 0;
	chkDwellingTypeNewAsBuilt     = 0;
	chkDwellingTypeNewExtension   = 1;
	chkDwellingTypeNewCreatedByChange =  0;
	chkDwellingTypeExisting       = 0;
	chkDwellingTypeOther          = 0;

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio4()
{
	m_btnDwellingTypeNewAsDesigned.SetCheck(0);
	m_btnDwellingTypeNewAsBuilt.SetCheck(0);
	m_btnDwellingTypeNewExtension.SetCheck(0);
	m_btnDwellingTypeExisting.SetCheck(0);
	m_btnDwellingTypeOther.SetCheck(0);

	chkDwellingTypeNewAsDesigned  = 0;
	chkDwellingTypeNewAsBuilt     = 0;
	chkDwellingTypeNewExtension   = 0;
	chkDwellingTypeNewCreatedByChange = 1;
	chkDwellingTypeExisting       = 0;
	chkDwellingTypeOther          = 0;

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio5()
{
	m_btnDwellingTypeNewAsDesigned.SetCheck(0);
	m_btnDwellingTypeNewAsBuilt.SetCheck(0);
	m_btnDwellingTypeNewExtension.SetCheck(0);
	m_btnDwellingTypeNewCreatedByChange.SetCheck(0);
	m_btnDwellingTypeOther.SetCheck(0);

	chkDwellingTypeNewAsDesigned  = 0;
	chkDwellingTypeNewAsBuilt     = 0;
	chkDwellingTypeNewExtension   = 0;
	chkDwellingTypeNewCreatedByChange =  0;
	chkDwellingTypeExisting       = 1;
	chkDwellingTypeOther          = 0;

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio6()
{
	m_btnDwellingTypeNewAsDesigned.SetCheck(0);
	m_btnDwellingTypeNewAsBuilt.SetCheck(0);
	m_btnDwellingTypeNewExtension.SetCheck(0);
	m_btnDwellingTypeNewCreatedByChange.SetCheck(0);
	m_btnDwellingTypeExisting.SetCheck(0);

	chkDwellingTypeNewAsDesigned  = 0;
	chkDwellingTypeNewAsBuilt     = 0;
	chkDwellingTypeNewExtension   = 0;
	chkDwellingTypeNewCreatedByChange =  0;
	chkDwellingTypeExisting       = 0;
	chkDwellingTypeOther          = 1;

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio7()
{
	m_btnPropertyTypeBungalow.SetCheck(0);
	m_btnPropertyTypeFlat.SetCheck(0);
	m_btnPropertyTypeMaisonette.SetCheck(0);

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio8()
{
	m_btnPropertyTypeHouse.SetCheck(0);

	m_btnPropertyTypeFlat.SetCheck(0);
	m_btnPropertyTypeMaisonette.SetCheck(0);

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio9()
{
	m_btnPropertyTypeHouse.SetCheck(0);
	m_btnPropertyTypeBungalow.SetCheck(0);
	m_btnPropertyTypeMaisonette.SetCheck(0);

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio10()
{
	m_btnPropertyTypeHouse.SetCheck(0);
	m_btnPropertyTypeBungalow.SetCheck(0);
	m_btnPropertyTypeFlat.SetCheck(0);

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio11()
{
	m_btnBuiltFormSemiDetached.SetCheck(0);
	m_btnBuiltFormMidTerr.SetCheck(0);
	m_btnBuiltFormEndTerr.SetCheck(0);
	m_btnBuiltFormEncMidTerr.SetCheck(0);
	m_btnBuiltFormEncEndTerr.SetCheck(0);

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio12()
{
	m_btnBuiltFormDetached.SetCheck(0);
	m_btnBuiltFormMidTerr.SetCheck(0);
	m_btnBuiltFormEndTerr.SetCheck(0);
	m_btnBuiltFormEncMidTerr.SetCheck(0);
	m_btnBuiltFormEncEndTerr.SetCheck(0);

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio13()
{
	m_btnBuiltFormDetached.SetCheck(0);
	m_btnBuiltFormSemiDetached.SetCheck(0);
	m_btnBuiltFormEndTerr.SetCheck(0);
	m_btnBuiltFormEncMidTerr.SetCheck(0);
	m_btnBuiltFormEncEndTerr.SetCheck(0);

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio14()
{
	m_btnBuiltFormDetached.SetCheck(0);
	m_btnBuiltFormSemiDetached.SetCheck(0);
	m_btnBuiltFormMidTerr.SetCheck(0);
	m_btnBuiltFormEncMidTerr.SetCheck(0);
	m_btnBuiltFormEncEndTerr.SetCheck(0);

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio15()
{
	m_btnBuiltFormDetached.SetCheck(0);
	m_btnBuiltFormSemiDetached.SetCheck(0);
	m_btnBuiltFormMidTerr.SetCheck(0);
	m_btnBuiltFormEndTerr.SetCheck(0);
	m_btnBuiltFormEncEndTerr.SetCheck(0);

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio16()
{
	m_btnBuiltFormDetached.SetCheck(0);
	m_btnBuiltFormSemiDetached.SetCheck(0);
	m_btnBuiltFormMidTerr.SetCheck(0);
	m_btnBuiltFormEndTerr.SetCheck(0);
	m_btnBuiltFormEncMidTerr.SetCheck(0);

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio17()
{
	m_btnFlatTypeMidFloor.SetCheck(0);
	m_btnFlatTypeTopFloor.SetCheck(0);

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio18()
{
	m_btnFlatTypeGround.SetCheck(0);
	m_btnFlatTypeTopFloor.SetCheck(0);

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio19()
{
	m_btnFlatTypeGround.SetCheck(0);
	m_btnFlatTypeMidFloor.SetCheck(0);

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio25()
{
	m_btnShelteredSides2.SetCheck(0);
	m_btnShelteredSides3.SetCheck(0);
	m_btnShelteredSides4.SetCheck(0);

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio26()
{
	m_btnShelteredSides1.SetCheck(0);
	m_btnShelteredSides3.SetCheck(0);
	m_btnShelteredSides4.SetCheck(0);

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio27()
{
	m_btnShelteredSides1.SetCheck(0);
	m_btnShelteredSides2.SetCheck(0);
	m_btnShelteredSides4.SetCheck(0);

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio28()
{
	m_btnShelteredSides1.SetCheck(0);
	m_btnShelteredSides2.SetCheck(0);
	m_btnShelteredSides3.SetCheck(0);

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio29()
{
	m_btnTerrainLowRiseUrban.SetCheck(0);
	m_btnTerrainRural.SetCheck(0);

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio30()
{
	m_btnTerrainDenseUrban.SetCheck(0);
	m_btnTerrainRural.SetCheck(0);

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio31()
{
	m_btnTerrainDenseUrban.SetCheck(0);
	m_btnTerrainLowRiseUrban.SetCheck(0);

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio20()
{
	m_btnExposureAboveAvg.SetCheck(0);
	m_btnExposureAvg.SetCheck(0);
	m_btnExposureBelowAvg.SetCheck(0);
	m_btnExposureSheltered.SetCheck(0);

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio21()
{
	m_btnExposureExposed.SetCheck(0);
	m_btnExposureAvg.SetCheck(0);
	m_btnExposureBelowAvg.SetCheck(0);
	m_btnExposureSheltered.SetCheck(0);
	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio22()
{
	m_btnExposureExposed.SetCheck(0);
	m_btnExposureAboveAvg.SetCheck(0);
	m_btnExposureBelowAvg.SetCheck(0);
	m_btnExposureSheltered.SetCheck(0);

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio23()
{
	m_btnExposureExposed.SetCheck(0);
	m_btnExposureAboveAvg.SetCheck(0);
	m_btnExposureAvg.SetCheck(0);
	m_btnExposureSheltered.SetCheck(0);

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedRadio24()
{
	m_btnExposureExposed.SetCheck(0);
	m_btnExposureAboveAvg.SetCheck(0);
	m_btnExposureAvg.SetCheck(0);
	m_btnExposureBelowAvg.SetCheck(0);

	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnCbnSelchangeCombo1()
{
	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnCbnSelchangeCombo5()
{
	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnCbnSelchangeCombo6()
{
	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnCbnSelchangeCombo7()
{
	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnCbnSelchangeCombo8()
{
	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnCbnSelchangeCombo9()
{
	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnCbnSelchangeCombo10()
{
	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedCheck1()
{
	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedCheck3()
{
	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedCheck5()
{
	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedCheck7()
{
	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedCheck9()
{
	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedCheck11()
{
	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedCheck2()
{
	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedCheck4()
{
	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedCheck6()
{
	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedCheck8()
{
	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedCheck10()
{
	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnBnClickedCheck12()
{
	ReadInputsFromBuiltFormDlg();
}

void CDlg_BuiltForm::OnEnChangeEdit13()
{
	TFA_from_HEM = false;
	//------------------------------------------------------------------------------
	// Empty edit box if user types any character other than numeric characters or '.'
	UpdateData(TRUE);
	static TCHAR * lpszValidChars = _T(".0123456789");
	
	// szText is the string we want to check for invalid chracters
	if (_tcsspnp(str_editStorey1Area, lpszValidChars) != 0) 
	{
		str_editStorey1Area = " ";
		UpdateData(FALSE);
		return;
	}

	// Check if value entered is within range
	isCheckRange_areaStorey1 = true;

	ReadInputsFromBuiltFormDlg();	
}

void CDlg_BuiltForm::OnEnChangeEdit15()
{
	TFA_from_HEM = false;
	//------------------------------------------------------------------------------
	// Empty edit box if user types any character other than numeric characters or '.'
	UpdateData(TRUE);
	static TCHAR * lpszValidChars = _T(".0123456789");
	
	// szText is the string we want to check for invalid chracters
	if (_tcsspnp(str_editStorey2Area, lpszValidChars) != 0) 
	{
		str_editStorey2Area = " ";
		UpdateData(FALSE);
		return;
	}

	// Check if value entered is within range
	isCheckRange_areaStorey2 = true;

	ReadInputsFromBuiltFormDlg();	
}

void CDlg_BuiltForm::OnEnChangeEdit17()
{
	TFA_from_HEM = false;
	//------------------------------------------------------------------------------
	// Empty edit box if user types any character other than numeric characters or '.'
	UpdateData(TRUE);
	static TCHAR * lpszValidChars = _T(".0123456789");
	
	// szText is the string we want to check for invalid chracters
	if (_tcsspnp(str_editStorey3Area, lpszValidChars) != 0) 
	{
		str_editStorey3Area = " ";
		UpdateData(FALSE);
		return;
	}
	// Check if value entered is within range
	isCheckRange_areaStorey3 = true;

	ReadInputsFromBuiltFormDlg();	
}

void CDlg_BuiltForm::OnEnChangeEdit19()
{
	TFA_from_HEM = false;
	//------------------------------------------------------------------------------
	// Empty edit box if user types any character other than numeric characters or '.'
	UpdateData(TRUE);
	static TCHAR * lpszValidChars = _T(".0123456789");
	
	// szText is the string we want to check for invalid chracters
	if (_tcsspnp(str_editStorey4Area, lpszValidChars) != 0) 
	{
		str_editStorey4Area = " ";
		UpdateData(FALSE);
		return;
	}
	// Check if value entered is within range
	isCheckRange_areaStorey4 = true;

	ReadInputsFromBuiltFormDlg();	
}

void CDlg_BuiltForm::OnEnChangeEdit21()
{
	TFA_from_HEM = false;
	//------------------------------------------------------------------------------
	// Empty edit box if user types any character other than numeric characters or '.'
	UpdateData(TRUE);
	static TCHAR * lpszValidChars = _T(".0123456789");
	
	// szText is the string we want to check for invalid chracters
	if (_tcsspnp(str_editStorey5Area, lpszValidChars) != 0) 
	{
		str_editStorey5Area = " ";
		UpdateData(FALSE);
		return;
	}
	// Check if value entered is within range
	isCheckRange_areaStorey5 = true;

	ReadInputsFromBuiltFormDlg();	
}

void CDlg_BuiltForm::OnEnChangeEdit23()
{
	TFA_from_HEM = false;

	//------------------------------------------------------------------------------
	// Empty edit box if user types any character other than numeric characters or '.'
	UpdateData(TRUE);
	static TCHAR * lpszValidChars = _T(".0123456789");
	
	// szText is the string we want to check for invalid chracters
	if (_tcsspnp(str_editStorey6Area, lpszValidChars) != 0) 
	{
		str_editStorey6Area = " ";
		UpdateData(FALSE);
		return;
	}
	// Check if value entered is within range
	isCheckRange_areaStorey6 = true;

	ReadInputsFromBuiltFormDlg();	
}

void CDlg_BuiltForm::OnEnChangeEdit14()
{
	//------------------------------------------------------------------------------
	// Empty edit box if user types any character other than numeric characters or '.'
	UpdateData(TRUE);
	static TCHAR * lpszValidChars = _T(".0123456789");
	
	// szText is the string we want to check for invalid chracters
	if (_tcsspnp(str_editStorey1Height, lpszValidChars) != 0) 
	{
		str_editStorey1Height = " ";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromBuiltFormDlg();

	// Check if value entered is within range
	isCheckRange_heightStorey1 = true;
}

void CDlg_BuiltForm::OnEnChangeEdit16()
{
	//------------------------------------------------------------------------------
	// Empty edit box if user types any character other than numeric characters or '.'
	UpdateData(TRUE);
	static TCHAR * lpszValidChars = _T(".0123456789");
	
	// szText is the string we want to check for invalid chracters
	if (_tcsspnp(str_editStorey2Height, lpszValidChars) != 0) 
	{
		str_editStorey2Height = " ";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromBuiltFormDlg();

	// Check if value entered is within range
	isCheckRange_heightStorey2 = true;
}

void CDlg_BuiltForm::OnEnChangeEdit18()
{
	//------------------------------------------------------------------------------
	// Empty edit box if user types any character other than numeric characters or '.'
	UpdateData(TRUE);
	static TCHAR * lpszValidChars = _T(".0123456789");
	
	// szText is the string we want to check for invalid chracters
	if (_tcsspnp(str_editStorey3Height, lpszValidChars) != 0) 
	{
		str_editStorey3Height = " ";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromBuiltFormDlg();

	// Check if value entered is within range
	isCheckRange_heightStorey3 = true;
}

void CDlg_BuiltForm::OnEnChangeEdit20()
{
	//------------------------------------------------------------------------------
	// Empty edit box if user types any character other than numeric characters or '.'
	UpdateData(TRUE);
	static TCHAR * lpszValidChars = _T(".0123456789");
	
	// szText is the string we want to check for invalid chracters
	if (_tcsspnp(str_editStorey4Height, lpszValidChars) != 0) 
	{
		str_editStorey4Height = " ";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromBuiltFormDlg();

	// Check if value entered is within range
	isCheckRange_heightStorey4 = true;
}

void CDlg_BuiltForm::OnEnChangeEdit22()
{
	//------------------------------------------------------------------------------
	// Empty edit box if user types any character other than numeric characters or '.'
	UpdateData(TRUE);
	static TCHAR * lpszValidChars = _T(".0123456789");
	
	// szText is the string we want to check for invalid chracters
	if (_tcsspnp(str_editStorey5Height, lpszValidChars) != 0) 
	{
		str_editStorey5Height = " ";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromBuiltFormDlg();

	// Check if value entered is within range
	isCheckRange_heightStorey5 = true;
}

void CDlg_BuiltForm::OnEnChangeEdit24()
{
	//------------------------------------------------------------------------------
	// Empty edit box if user types any character other than numeric characters or '.'
	UpdateData(TRUE);
	static TCHAR * lpszValidChars = _T(".0123456789");
	
	// szText is the string we want to check for invalid chracters
	if (_tcsspnp(str_editStorey6Height, lpszValidChars) != 0) 
	{
		str_editStorey6Height = " ";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromBuiltFormDlg();

	// Check if value entered is within range
	isCheckRange_heightStorey6 = true;
}

void CDlg_BuiltForm::OnEnChangeEdit12()
{
	ReadInputsFromBuiltFormDlg();
}

BOOL CDlg_BuiltForm::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	if(pMsg->message==WM_KEYDOWN)
	{
		if(pMsg->wParam==VK_RETURN || pMsg->wParam==VK_ESCAPE)
			pMsg->wParam=NULL ;
	} 

	return CDialog::PreTranslateMessage(pMsg);
}
void CDlg_BuiltForm::OnStnClickedStatic3()
{
	// TODO: Add your control notification handler code here
}




