// Dlg_ThermalBridging.cpp : implementation file
//

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

// CDlg_ThermalBridging dialog

IMPLEMENT_DYNAMIC(CDlg_ThermalBridging, CDialog)
CDlg_ThermalBridging::CDlg_ThermalBridging(CWnd* pParent /*=NULL*/)
	: CDialog(CDlg_ThermalBridging::IDD, pParent)
	, str_editGFPerimeter(_T(""))
	, str_editFloorWithingDwellinPerimeter(_T(""))
	, str_editFloorBetweenDwellinPerimeter(_T(""))
	, str_editBalconyWithingDwellingLength(_T(""))
	, str_editBalconyBetweenDwellingLength(_T(""))
	, str_editEavesAtCeiling(_T(""))
	, str_editEavesAtRafter(_T(""))
	, str_editGableAtCeiling(_T(""))
	, str_editGableAtRafter(_T(""))
	, str_editLengthNormalCorners(_T(""))
	, str_editLengthInvertedCorners(_T(""))
	, str_edirPartWallBetweenDwelling(_T(""))
	, str_comboMetalBoxLintelUserDef(_T(""))
	, str_comboOtherLintelUserDef(_T(""))
	, str_comboJambUserDef(_T(""))
	, str_comboGFPerimeterUserDef(_T(""))
	, str_comboFloorWithinDwellingUserDef(_T(""))
	, str_comboFloorBwDwellingUserDef(_T(""))
	, str_comboBalcWithinDwellingLengthUserDef(_T(""))
	, str_comboBalcBwDwellingLengthUserDef(_T(""))
	, str_comboEavesInsAtCeilingUserDef(_T(""))
	, str_comboEavesInsAtRafterUserDef(_T(""))
	, str_comboGableInsAtCeilingUserDef(_T(""))
	, str_comboGableInsAtRafetUserDef(_T(""))
	, str_comboLengthOfNormalCornersUserDef(_T(""))
	, str_comboLengthOfInvertedCornersUserDef(_T(""))
	, str_comboPartWallBetweenDwellingUserDef(_T(""))
	, str_editMetalBoxLintelSiValue(_T(""))
	, str_editOtherLintelsSiValue(_T(""))
	, str_editSillSiValue(_T(""))
	, str_editJambSiValue(_T(""))
	, str_editGFPerimeterSiValue(_T(""))
	, str_editFloorWithinDwellingSiValue(_T(""))
	, str_editFloorBetweenDwellingSiValue(_T(""))
	, str_editBalconyWithinDwellingSiValue(_T(""))
	, str_editBalconyBwDwellingSiValue(_T(""))
	, str_editEavesInsAtCelingSiValue(_T(""))
	, str_editEavesInsAtRafterSiValue(_T(""))
	, str_editGableInsAtCeilingSiValue(_T(""))
	, str_editGableInsAtRafterSiValue(_T(""))
	, str_editlLengthOfNormalCornersSiValue(_T(""))
	, str_editLengthOfInvertedCornersSiValue(_T(""))
	, str_editPartBwDwellingLengthSiValue(_T(""))
	, str_editMetalBoxLintelResult(_T(""))
	, str_editOtherLintelsResult(_T(""))
	, str_editSillResult(_T(""))
	, str_editJambResult(_T(""))
	, str_editGFPerimeterResult(_T(""))
	, str_editFloorWithinDwellingPerimeterResult(_T(""))
	, str_editFloorBetweenDwellingPerimeterResult(_T(""))
	, str_editBalcWithDwellingLengthResult(_T(""))
	, str_editBalconyBwDwellingLengthResult(_T(""))
	, str_editEavesInsCeilingResult(_T(""))
	, str_editEavesInsRafterResult(_T(""))
	, str_editGableInsCeilingResult(_T(""))
	, str_editGableInsRafterResult(_T(""))
	, str_editLengthNormalCornersResult(_T(""))
	, str_editLengthInvertedCornersResult(_T(""))
	, str_editPartyWallBwDwellingResult(_T(""))
	, str_comboSillUserDef_2(_T(""))
	, str_editYvalue(_T(""))
	, m_chkEnter(0)
	, m_chkCalculate(0)
{
}

CDlg_ThermalBridging::~CDlg_ThermalBridging()
{
}

void CDlg_ThermalBridging::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_STATIC_1, m_labelTherm);
	DDX_Control(pDX, IDC_EDIT_GFperimeter, m_editGFPerimeter);
	DDX_Control(pDX, IDC_EDIT_FbwDwellingPerimeter, m_editFloorWithingDwellinPerimeter);
	DDX_Control(pDX, IDC_EDIT_FWithingDwellingPerimeter, m_editFloorBetweenDwellinPerimeter);
	DDX_Control(pDX, IDC_EDIT_BalcWithDwellingLendth, m_editBalconyWithingDwellingLength);
	DDX_Control(pDX, IDC_EDIT_BalconyBetweenDwellingLength, m_editBalconyBetweenDwellingLength);
	DDX_Control(pDX, IDC_EDIT_EavesInsAtCeiling, m_editEavesAtCeiling);
	DDX_Control(pDX, IDC_EDIT_EvaesInsAtRafter, m_editEavesAtRafter);
	DDX_Control(pDX, IDC_EDIT_GableAtCeiling, m_editGableAtCeiling);
	DDX_Control(pDX, IDC_EDIT_GableAtRafter, m_editGableAtRafter);
	DDX_Control(pDX, IDC_EDIT_NOrmalCornersLength, m_editLengthNormalCorners);
	DDX_Control(pDX, IDC_EDIT_InvertedCornersLength, m_editLengthInvertedCorners);
	DDX_Control(pDX, IDC_EDIT_PartyWall, m_edirPartWallBetweenDwelling);
	DDX_Control(pDX, IDC_COMBO2, m_comboMetalBoxLintelUserDef);
	DDX_Control(pDX, IDC_COMBO4, m_comboOtherLintelUserDef);
	DDX_Control(pDX, IDC_COMBO12, m_comboJambUserDef);
	DDX_Control(pDX, IDC_COMBO13, m_comboGFPerimeterUserDef);
	DDX_Control(pDX, IDC_COMBO14, m_comboFloorWithinDwellingUserDef);
	DDX_Control(pDX, IDC_COMBO15, m_comboFloorBwDwellingUserDef);
	DDX_Control(pDX, IDC_COMBO16, m_comboBalcWithinDwellingLengthUserDef);
	DDX_Control(pDX, IDC_COMBO17, m_comboBalcBwDwellingLengthUserDef);
	DDX_Control(pDX, IDC_COMBO18, m_comboEavesInsAtCeilingUserDef);
	DDX_Control(pDX, IDC_COMBO19, m_comboEavesInsAtRafterUserDef);
	DDX_Control(pDX, IDC_COMBO20, m_comboGableInsAtCeilingUserDef);
	DDX_Control(pDX, IDC_COMBO21, m_comboGableInsAtRafetUserDef);
	DDX_Control(pDX, IDC_COMBO22, m_comboLengthOfNormalCornersUserDef);
	DDX_Control(pDX, IDC_COMBO23, m_comboLengthOfInvertedCornersUserDef);
	DDX_Control(pDX, IDC_COMBO1, m_comboPartWallBetweenDwellingUserDef);
	DDX_Control(pDX, IDC_EDIT_MetalBoxLintelValue, m_editMetalBoxLintelSiValue);
	DDX_Control(pDX, IDC_EDITOtherLintelValue, m_editOtherLintelsSiValue);
	DDX_Control(pDX, IDC_EDITSilllValue, m_editSillSiValue);
	DDX_Control(pDX, IDC_EDITJambValue, m_editJambSiValue);
	DDX_Control(pDX, IDC_EDIT_GFperimeter2, m_editGFPerimeterSiValue);
	DDX_Control(pDX, IDC_EDIT_FbwDwellingPerimeter2, m_editFloorWithinDwellingSiValue);
	DDX_Control(pDX, IDC_EDIT_FWithingDwellingPerimeter2, m_editFloorBetweenDwellingSiValue);
	DDX_Control(pDX, IDC_EDIT_BalcWithDwellingLendth2, m_editBalconyWithinDwellingSiValue);
	DDX_Control(pDX, IDC_EDIT_BalconyBetweenDwellingLength2, m_editBalconyBwDwellingSiValue);
	DDX_Control(pDX, IDC_EDIT_EavesInsAtCeiling2, m_editEavesInsAtCelingSiValue);
	DDX_Control(pDX, IDC_EDIT_EvaesInsAtRafter2, m_editEavesInsAtRafterSiValue);
	DDX_Control(pDX, IDC_EDIT_GableAtCeiling2, m_editGableInsAtCeilingSiValue);
	DDX_Control(pDX, IDC_EDIT_GableAtRafter2, m_editGableInsAtRafterSiValue);
	DDX_Control(pDX, IDC_EDIT_NOrmalCornersLength2, m_editlLengthOfNormalCornersSiValue);
	DDX_Control(pDX, IDC_EDIT_InvertedCornersLength2, m_editLengthOfInvertedCornersSiValue);
	DDX_Control(pDX, IDC_EDIT_PartyWall2, m_editPartBwDwellingLengthSiValue);
	DDX_Control(pDX, IDC_EDIT_MetalBoxLintelValue2, m_editMetalBoxLintelResult);
	DDX_Control(pDX, IDC_EDITOtherLintelValue2, m_editOtherLintelsResult);
	DDX_Control(pDX, IDC_EDITSilllValue2, m_editSillResult);
	DDX_Control(pDX, IDC_EDITJambValue2, m_editJambResult);
	DDX_Control(pDX, IDC_EDIT_GFperimeter3, m_editGFPerimeterResult);
	DDX_Control(pDX, IDC_EDIT_FbwDwellingPerimeter3, m_editFloorWithinDwellingPerimeterResult);
	DDX_Control(pDX, IDC_EDIT_FWithingDwellingPerimeter3, m_editFloorBetweenDwellingPerimeterResult);
	DDX_Control(pDX, IDC_EDIT_BalcWithDwellingLendth3, m_editBalcWithDwellingLengthResult);
	DDX_Control(pDX, IDC_EDIT_BalconyBetweenDwellingLength3, m_editBalconyBwDwellingLengthResult);
	DDX_Control(pDX, IDC_EDIT_EavesInsAtCeiling3, m_editEavesInsCeilingResult);
	DDX_Control(pDX, IDC_EDIT_EvaesInsAtRafter3, m_editEavesInsRafterResult);
	DDX_Control(pDX, IDC_EDIT_GableAtCeiling3, m_editGableInsCeilingResult);
	DDX_Control(pDX, IDC_EDIT_GableAtRafter3, m_editGableInsRafterResult);
	DDX_Control(pDX, IDC_EDIT_NOrmalCornersLength3, m_editLengthNormalCornersResult);
	DDX_Control(pDX, IDC_EDIT_InvertedCornersLength3, m_editLengthInvertedCornersResult);
	DDX_Control(pDX, IDC_EDIT_PartyWall3, m_editPartyWallBwDwellingResult);
	DDX_Text(pDX, IDC_EDIT_GFperimeter, str_editGFPerimeter);
	DDX_Text(pDX, IDC_EDIT_FbwDwellingPerimeter, str_editFloorWithingDwellinPerimeter);
	DDX_Text(pDX, IDC_EDIT_FWithingDwellingPerimeter, str_editFloorBetweenDwellinPerimeter);
	DDX_Text(pDX, IDC_EDIT_BalcWithDwellingLendth, str_editBalconyWithingDwellingLength);
	DDX_Text(pDX, IDC_EDIT_BalconyBetweenDwellingLength, str_editBalconyBetweenDwellingLength);
	DDX_Text(pDX, IDC_EDIT_EavesInsAtCeiling, str_editEavesAtCeiling);
	DDX_Text(pDX, IDC_EDIT_EvaesInsAtRafter, str_editEavesAtRafter);
	DDX_Text(pDX, IDC_EDIT_GableAtCeiling, str_editGableAtCeiling);
	DDX_Text(pDX, IDC_EDIT_GableAtRafter, str_editGableAtRafter);
	DDX_Text(pDX, IDC_EDIT_NOrmalCornersLength, str_editLengthNormalCorners);
	DDX_Text(pDX, IDC_EDIT_InvertedCornersLength, str_editLengthInvertedCorners);
	DDX_Text(pDX, IDC_EDIT_PartyWall, str_edirPartWallBetweenDwelling);
	DDX_CBString(pDX, IDC_COMBO2, str_comboMetalBoxLintelUserDef);
	DDX_CBString(pDX, IDC_COMBO4, str_comboOtherLintelUserDef);
	DDX_CBString(pDX, IDC_COMBO12, str_comboJambUserDef);
	DDX_CBString(pDX, IDC_COMBO13, str_comboGFPerimeterUserDef);
	DDX_CBString(pDX, IDC_COMBO14, str_comboFloorWithinDwellingUserDef);
	DDX_CBString(pDX, IDC_COMBO15, str_comboFloorBwDwellingUserDef);
	DDX_CBString(pDX, IDC_COMBO16, str_comboBalcWithinDwellingLengthUserDef);
	DDX_CBString(pDX, IDC_COMBO17, str_comboBalcBwDwellingLengthUserDef);
	DDX_CBString(pDX, IDC_COMBO18, str_comboEavesInsAtCeilingUserDef);
	DDX_CBString(pDX, IDC_COMBO19, str_comboEavesInsAtRafterUserDef);
	DDX_CBString(pDX, IDC_COMBO20, str_comboGableInsAtCeilingUserDef);
	DDX_CBString(pDX, IDC_COMBO21, str_comboGableInsAtRafetUserDef);
	DDX_CBString(pDX, IDC_COMBO22, str_comboLengthOfNormalCornersUserDef);
	DDX_CBString(pDX, IDC_COMBO23, str_comboLengthOfInvertedCornersUserDef);
	DDX_CBString(pDX, IDC_COMBO1, str_comboPartWallBetweenDwellingUserDef);
	DDX_Text(pDX, IDC_EDIT_MetalBoxLintelValue, str_editMetalBoxLintelSiValue);
	DDX_Text(pDX, IDC_EDITOtherLintelValue, str_editOtherLintelsSiValue);
	DDX_Text(pDX, IDC_EDITSilllValue, str_editSillSiValue);
	DDX_Text(pDX, IDC_EDITJambValue, str_editJambSiValue);
	DDX_Text(pDX, IDC_EDIT_GFperimeter2, str_editGFPerimeterSiValue);
	DDX_Text(pDX, IDC_EDIT_FbwDwellingPerimeter2, str_editFloorWithinDwellingSiValue);
	DDX_Text(pDX, IDC_EDIT_FWithingDwellingPerimeter2, str_editFloorBetweenDwellingSiValue);
	DDX_Text(pDX, IDC_EDIT_BalcWithDwellingLendth2, str_editBalconyWithinDwellingSiValue);
	DDX_Text(pDX, IDC_EDIT_BalconyBetweenDwellingLength2, str_editBalconyBwDwellingSiValue);
	DDX_Text(pDX, IDC_EDIT_EavesInsAtCeiling2, str_editEavesInsAtCelingSiValue);
	DDX_Text(pDX, IDC_EDIT_EvaesInsAtRafter2, str_editEavesInsAtRafterSiValue);
	DDX_Text(pDX, IDC_EDIT_GableAtCeiling2, str_editGableInsAtCeilingSiValue);
	DDX_Text(pDX, IDC_EDIT_GableAtRafter2, str_editGableInsAtRafterSiValue);
	DDX_Text(pDX, IDC_EDIT_NOrmalCornersLength2, str_editlLengthOfNormalCornersSiValue);
	DDX_Text(pDX, IDC_EDIT_InvertedCornersLength2, str_editLengthOfInvertedCornersSiValue);
	DDX_Text(pDX, IDC_EDIT_PartyWall2, str_editPartBwDwellingLengthSiValue);
	DDX_Text(pDX, IDC_EDIT_MetalBoxLintelValue2, str_editMetalBoxLintelResult);
	DDX_Text(pDX, IDC_EDITOtherLintelValue2, str_editOtherLintelsResult);
	DDX_Text(pDX, IDC_EDITSilllValue2, str_editSillResult);
	DDX_Text(pDX, IDC_EDITJambValue2, str_editJambResult);
	DDX_Text(pDX, IDC_EDIT_GFperimeter3, str_editGFPerimeterResult);
	DDX_Text(pDX, IDC_EDIT_FbwDwellingPerimeter3, str_editFloorWithinDwellingPerimeterResult);
	DDX_Text(pDX, IDC_EDIT_FWithingDwellingPerimeter3, str_editFloorBetweenDwellingPerimeterResult);
	DDX_Text(pDX, IDC_EDIT_BalcWithDwellingLendth3, str_editBalcWithDwellingLengthResult);
	DDX_Text(pDX, IDC_EDIT_BalconyBetweenDwellingLength3, str_editBalconyBwDwellingLengthResult);
	DDX_Text(pDX, IDC_EDIT_EavesInsAtCeiling3, str_editEavesInsCeilingResult);
	DDX_Text(pDX, IDC_EDIT_EvaesInsAtRafter3, str_editEavesInsRafterResult);
	DDX_Text(pDX, IDC_EDIT_GableAtCeiling3, str_editGableInsCeilingResult);
	DDX_Text(pDX, IDC_EDIT_GableAtRafter3, str_editGableInsRafterResult);
	DDX_Text(pDX, IDC_EDIT_NOrmalCornersLength3, str_editLengthNormalCornersResult);
	DDX_Text(pDX, IDC_EDIT_InvertedCornersLength3, str_editLengthInvertedCornersResult);
	DDX_Text(pDX, IDC_EDIT_PartyWall3, str_editPartyWallBwDwellingResult);
	DDX_Control(pDX, IDC_COMBO5, m_comboSillUserDef_2);
	DDX_CBString(pDX, IDC_COMBO5, str_comboSillUserDef_2);
	DDX_Control(pDX, IDC_CHECK1, m_btnEnter);
	DDX_Control(pDX, IDC_CHECK2, m_btnCalculate);
	DDX_Control(pDX, IDC_EDIT_GFperimeter4, m_editYvalue);
	DDX_Text(pDX, IDC_EDIT_GFperimeter4, str_editYvalue);
}

BEGIN_MESSAGE_MAP(CDlg_ThermalBridging, CDialog)
	ON_CBN_SELCHANGE(IDC_COMBO2, OnCbnSelchangeCombo2)
	ON_EN_CHANGE(IDC_EDIT_GFperimeter, OnEnChangeEditGfperimeter)
	ON_CBN_SELCHANGE(IDC_COMBO4, OnCbnSelchangeCombo4)
	ON_CBN_SELCHANGE(IDC_COMBO11, OnCbnSelchangeCombo11)
	ON_CBN_SELCHANGE(IDC_COMBO12, OnCbnSelchangeCombo12)
	ON_CBN_SELCHANGE(IDC_COMBO13, OnCbnSelchangeCombo13)
	ON_CBN_SELCHANGE(IDC_COMBO14, OnCbnSelchangeCombo14)
	ON_CBN_SELCHANGE(IDC_COMBO15, OnCbnSelchangeCombo15)
	ON_CBN_SELCHANGE(IDC_COMBO16, OnCbnSelchangeCombo16)
	ON_CBN_SELCHANGE(IDC_COMBO17, OnCbnSelchangeCombo17)
	ON_CBN_SELCHANGE(IDC_COMBO18, OnCbnSelchangeCombo18)
	ON_CBN_SELCHANGE(IDC_COMBO19, OnCbnSelchangeCombo19)
	ON_CBN_SELCHANGE(IDC_COMBO20, OnCbnSelchangeCombo20)
	ON_CBN_SELCHANGE(IDC_COMBO21, OnCbnSelchangeCombo21)
	ON_CBN_SELCHANGE(IDC_COMBO22, OnCbnSelchangeCombo22)
	ON_CBN_SELCHANGE(IDC_COMBO23, OnCbnSelchangeCombo23)
	ON_CBN_SELCHANGE(IDC_COMBO1, OnCbnSelchangeCombo1)
	ON_EN_CHANGE(IDC_EDIT_FbwDwellingPerimeter, OnEnChangeEditFbwdwellingperimeter)
	ON_EN_CHANGE(IDC_EDIT_FWithingDwellingPerimeter, OnEnChangeEditFwithingdwellingperimeter)
	ON_EN_CHANGE(IDC_EDIT_BalcWithDwellingLendth, OnEnChangeEditBalcwithdwellinglendth)
	ON_EN_CHANGE(IDC_EDIT_BalconyBetweenDwellingLength, OnEnChangeEditBalconybetweendwellinglength)
	ON_EN_CHANGE(IDC_EDIT_EavesInsAtCeiling, OnEnChangeEditEavesinsatceiling)
	ON_EN_CHANGE(IDC_EDIT_EvaesInsAtRafter, OnEnChangeEditEvaesinsatrafter)
	ON_EN_CHANGE(IDC_EDIT_GableAtCeiling, OnEnChangeEditGableatceiling)
	ON_EN_CHANGE(IDC_EDIT_GableAtRafter, OnEnChangeEditGableatrafter)
	ON_EN_CHANGE(IDC_EDIT_NOrmalCornersLength, OnEnChangeEditNormalcornerslength)
	ON_EN_CHANGE(IDC_EDIT_InvertedCornersLength, OnEnChangeEditInvertedcornerslength)
	ON_EN_CHANGE(IDC_EDIT_PartyWall, OnEnChangeEditPartywall)
	ON_EN_CHANGE(IDC_EDIT_MetalBoxLintelValue, OnEnChangeEditMetalboxlintelvalue)
	ON_EN_CHANGE(IDC_EDITOtherLintelValue, OnEnChangeEditotherlintelvalue)
	ON_EN_CHANGE(IDC_EDITSilllValue, OnEnChangeEditsilllvalue)
	ON_EN_CHANGE(IDC_EDITJambValue, OnEnChangeEditjambvalue)
	ON_EN_CHANGE(IDC_EDIT_GFperimeter2, OnEnChangeEditGfperimeter2)
	ON_EN_CHANGE(IDC_EDIT_FbwDwellingPerimeter2, OnEnChangeEditFbwdwellingperimeter2)
	ON_EN_CHANGE(IDC_EDIT_FWithingDwellingPerimeter2, OnEnChangeEditFwithingdwellingperimeter2)
	ON_EN_CHANGE(IDC_EDIT_BalcWithDwellingLendth2, OnEnChangeEditBalcwithdwellinglendth2)
	ON_EN_CHANGE(IDC_EDIT_BalconyBetweenDwellingLength2, OnEnChangeEditBalconybetweendwellinglength2)
	ON_EN_CHANGE(IDC_EDIT_EavesInsAtCeiling2, OnEnChangeEditEavesinsatceiling2)
	ON_EN_CHANGE(IDC_EDIT_EvaesInsAtRafter2, OnEnChangeEditEvaesinsatrafter2)
	ON_EN_CHANGE(IDC_EDIT_GableAtCeiling2, OnEnChangeEditGableatceiling2)
	ON_EN_CHANGE(IDC_EDIT_GableAtRafter2, OnEnChangeEditGableatrafter2)
	ON_EN_CHANGE(IDC_EDIT_NOrmalCornersLength2, OnEnChangeEditNormalcornerslength2)
	ON_EN_CHANGE(IDC_EDIT_InvertedCornersLength2, OnEnChangeEditInvertedcornerslength2)
	ON_EN_CHANGE(IDC_EDIT_PartyWall2, OnEnChangeEditPartywall2)
	ON_CBN_SELCHANGE(IDC_COMBO5, OnCbnSelchangeCombo5)
	ON_BN_CLICKED(IDC_CHECK1, OnBnClickedCheck1)
	ON_BN_CLICKED(IDC_CHECK2, OnBnClickedCheck2)
	ON_EN_CHANGE(IDC_EDIT_GFperimeter4, OnEnChangeEditGfperimeter4)
END_MESSAGE_MAP()

// CDlg_ThermalBridging message handlers

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

	//---------------------------------------------------
	// LABELS
	//---------------------------------------------------
	CFont *m_Font1 = new CFont;
	m_Font1->CreatePointFont(90, "Arial Bold");

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

	//---------------------------------------------------
	// DROP DOWNS
	//---------------------------------------------------
	AddStringsToComboBoxesForThermalBridgingDlg();	

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

		m_comboMetalBoxLintelUserDef.SetCurSel(0);
		m_comboOtherLintelUserDef.SetCurSel(0);
		m_comboSillUserDef_2.SetCurSel(0);
		m_comboJambUserDef.SetCurSel(0);
		m_comboGFPerimeterUserDef.SetCurSel(0);
		m_comboFloorWithinDwellingUserDef.SetCurSel(0);
		m_comboFloorBwDwellingUserDef.SetCurSel(0);
		m_comboBalcWithinDwellingLengthUserDef.SetCurSel(0);
		m_comboBalcBwDwellingLengthUserDef.SetCurSel(0);
		m_comboEavesInsAtCeilingUserDef.SetCurSel(0);
		m_comboEavesInsAtRafterUserDef.SetCurSel(0);
		m_comboGableInsAtCeilingUserDef.SetCurSel(0);
		m_comboGableInsAtRafetUserDef.SetCurSel(0);
		m_comboLengthOfNormalCornersUserDef.SetCurSel(0);
		m_comboLengthOfInvertedCornersUserDef.SetCurSel(0);
		m_comboPartWallBetweenDwellingUserDef.SetCurSel(0);

	UpdateData(FALSE);
	}
	
	DisplayValuesForThermalBridgingDlg();
	
	EnterOrCalculateyValue();

	EnableOrDisableEditBoxes();

	return TRUE;
}

void CDlg_ThermalBridging::AddStringsToComboBoxesForThermalBridgingDlg()
{
	m_comboMetalBoxLintelUserDef.InsertString(0,"No");
	m_comboMetalBoxLintelUserDef.InsertString(1,"Yes");

	m_comboOtherLintelUserDef.InsertString(0,"No");
	m_comboOtherLintelUserDef.InsertString(1,"Yes");

	m_comboSillUserDef_2.InsertString(0,"No");
	m_comboSillUserDef_2.InsertString(1,"Yes");

	m_comboJambUserDef.InsertString(0,"No");
	m_comboJambUserDef.InsertString(1,"Yes");

	m_comboGFPerimeterUserDef.InsertString(0,"No");
	m_comboGFPerimeterUserDef.InsertString(1,"Yes");

	m_comboFloorWithinDwellingUserDef.InsertString(0,"No");
	m_comboFloorWithinDwellingUserDef.InsertString(1,"Yes");

	m_comboFloorBwDwellingUserDef.InsertString(0,"No");
	m_comboFloorBwDwellingUserDef.InsertString(1,"Yes");

	m_comboBalcWithinDwellingLengthUserDef.InsertString(0,"No");
	m_comboBalcWithinDwellingLengthUserDef.InsertString(1,"Yes");

	m_comboBalcBwDwellingLengthUserDef.InsertString(0,"No");
	m_comboBalcBwDwellingLengthUserDef.InsertString(1,"Yes");

	m_comboEavesInsAtCeilingUserDef.InsertString(0,"No");
	m_comboEavesInsAtCeilingUserDef.InsertString(1,"Yes");

	m_comboEavesInsAtRafterUserDef.InsertString(0,"No");
	m_comboEavesInsAtRafterUserDef.InsertString(1,"Yes");

	m_comboGableInsAtCeilingUserDef.InsertString(0,"No");
	m_comboGableInsAtCeilingUserDef.InsertString(1,"Yes");

	m_comboGableInsAtRafetUserDef.InsertString(0,"No");
	m_comboGableInsAtRafetUserDef.InsertString(1,"Yes");

	m_comboLengthOfNormalCornersUserDef.InsertString(0,"No");
	m_comboLengthOfNormalCornersUserDef.InsertString(1,"Yes");

	m_comboLengthOfInvertedCornersUserDef.InsertString(0,"No");
	m_comboLengthOfInvertedCornersUserDef.InsertString(1,"Yes");

	m_comboPartWallBetweenDwellingUserDef.InsertString(0,"No");
	m_comboPartWallBetweenDwellingUserDef.InsertString(1,"Yes");

	m_comboMetalBoxLintelUserDef.SetCurSel(0);
	m_comboOtherLintelUserDef.SetCurSel(0);
	m_comboSillUserDef_2.SetCurSel(0);
	m_comboJambUserDef.SetCurSel(0);
	m_comboGFPerimeterUserDef.SetCurSel(0);
	m_comboFloorWithinDwellingUserDef.SetCurSel(0);
	m_comboFloorBwDwellingUserDef.SetCurSel(0);
	m_comboBalcWithinDwellingLengthUserDef.SetCurSel(0);
	m_comboBalcBwDwellingLengthUserDef.SetCurSel(0);
	m_comboEavesInsAtCeilingUserDef.SetCurSel(0);
	m_comboEavesInsAtRafterUserDef.SetCurSel(0);
	m_comboGableInsAtCeilingUserDef.SetCurSel(0);
	m_comboGableInsAtRafetUserDef.SetCurSel(0);
	m_comboLengthOfNormalCornersUserDef.SetCurSel(0);
	m_comboLengthOfInvertedCornersUserDef.SetCurSel(0);
	m_comboPartWallBetweenDwellingUserDef.SetCurSel(0);
}

void CDlg_ThermalBridging::DisplayValuesForThermalBridgingDlg()
{
	str_editYvalue.Format("%.2f", yValueEntry);
	str_editGFPerimeter.Format("%.2f", ThermBGFPerimeter);
	str_editFloorWithingDwellinPerimeter.Format("%.2f", ThermBFloorWithingDwellinPerimeter);
	str_editFloorBetweenDwellinPerimeter.Format("%.2f", ThermBFloorBetweenDwellinPerimeter);
	str_editBalconyWithingDwellingLength.Format("%.2f", ThermBBalconyWithingDwellingLength);
	str_editBalconyBetweenDwellingLength.Format("%.2f", ThermBBalconyBetweenDwellingLength);
	str_editEavesAtCeiling.Format("%.2f", ThermBEavesAtCeiling);
	str_editEavesAtRafter.Format("%.2f", ThermBEavesAtRafter);
	str_editGableAtCeiling.Format("%.2f", ThermBGableAtCeiling);
	str_editGableAtRafter.Format("%.2f", ThermBGableAtRafter);
	str_editLengthNormalCorners.Format("%.2f", ThermBLengthNormalCorners);
	str_editLengthInvertedCorners.Format("%.2f", ThermBLengthInvertedCorners);
	str_edirPartWallBetweenDwelling.Format("%.2f", ThermBPartWallBetweenDwelling);

	str_comboMetalBoxLintelUserDef.Format("%s", ThermBMetalBoxLintelUserDef);
	str_comboOtherLintelUserDef.Format("%s", ThermBOtherLintelUserDef);
	str_comboSillUserDef_2.Format("%s", ThermBSillUserDef);
	str_comboJambUserDef.Format("%s", ThermBJambUserDef);
	str_comboGFPerimeterUserDef.Format("%s", ThermBGFPerimeterUserDef);
	str_comboFloorWithinDwellingUserDef.Format("%s", ThermBFloorWithinDwellingUserDef);
	str_comboFloorBwDwellingUserDef.Format("%s", ThermBFloorBwDwellingUserDef);
	str_comboBalcWithinDwellingLengthUserDef.Format("%s", ThermBBalcWithinDwellingLengthUserDef);
	str_comboBalcBwDwellingLengthUserDef.Format("%s", ThermBBalcBwDwellingLengthUserDef);
	str_comboEavesInsAtCeilingUserDef.Format("%s", ThermBEavesInsAtCeilingUserDef);
	str_comboEavesInsAtRafterUserDef.Format("%s", ThermBEavesInsAtRafterUserDef);
	str_comboGableInsAtCeilingUserDef.Format("%s", ThermBGableInsAtCeilingUserDef);
	str_comboGableInsAtRafetUserDef.Format("%s", ThermBGableInsAtRafetUserDef);
	str_comboLengthOfNormalCornersUserDef.Format("%s", ThermBLengthOfNormalCornersUserDef);
	str_comboLengthOfInvertedCornersUserDef.Format("%s", ThermBLengthOfInvertedCornersUserDef);
	str_comboPartWallBetweenDwellingUserDef.Format("%s", ThermBPartWallBetweenDwellingUserDef);

	str_editMetalBoxLintelSiValue.Format("%.2f", ThermBMetalBoxLintelSiValue);
	str_editOtherLintelsSiValue.Format("%.2f", ThermBOtherLintelsSiValue);
	str_editSillSiValue.Format("%.2f", ThermBSillSiValue);
	str_editJambSiValue.Format("%.2f", ThermBJambSiValue);
	str_editGFPerimeterSiValue.Format("%.2f", ThermBGFPerimeterSiValue);
	str_editFloorWithinDwellingSiValue.Format("%.2f", ThermBFloorWithinDwellingSiValue);
	str_editFloorBetweenDwellingSiValue.Format("%.2f", ThermBFloorBetweenDwellingSiValue);
	str_editBalconyWithinDwellingSiValue.Format("%.2f", ThermBBalconyWithinDwellingSiValue);
	str_editBalconyBwDwellingSiValue.Format("%.2f", ThermBBalconyBwDwellingSiValue);
	str_editEavesInsAtCelingSiValue.Format("%.2f", ThermBEavesInsAtCelingSiValue);
	str_editEavesInsAtRafterSiValue.Format("%.2f", ThermBEavesInsAtRafterSiValue);
	str_editGableInsAtCeilingSiValue.Format("%.2f", ThermBGableInsAtCeilingSiValue);
	str_editGableInsAtRafterSiValue.Format("%.2f", ThermBGableInsAtRafterSiValue);
	str_editlLengthOfNormalCornersSiValue.Format("%.2f", ThermBLengthOfNormalCornersSiValue);
	str_editLengthOfInvertedCornersSiValue.Format("%.2f", ThermBLengthOfInvertedCornersSiValue);
	str_editPartBwDwellingLengthSiValue.Format("%.2f", ThermBPartBwDwellingLengthSiValue);

	str_editMetalBoxLintelResult.Format("%.2f", ThermBMetalBoxLintelResult);
	str_editOtherLintelsResult.Format("%.2f", ThermBOtherLintelsResult);
	str_editSillResult.Format("%.2f", ThermBSillResult);
	str_editJambResult.Format("%.2f", ThermBJambResult);
	str_editGFPerimeterResult.Format("%.2f", ThermBGFPerimeterResult);
	str_editFloorWithinDwellingPerimeterResult.Format("%.2f", ThermBFloorWithinDwellingPerimeterResult);
	str_editFloorBetweenDwellingPerimeterResult.Format("%.2f", ThermBFloorBetweenDwellingPerimeterResult);
	str_editBalcWithDwellingLengthResult.Format("%.2f", ThermBBalcWithDwellingLengthResult);
	str_editBalconyBwDwellingLengthResult.Format("%.2f", ThermBBalconyBwDwellingLengthResult);
	str_editEavesInsCeilingResult.Format("%.2f", ThermBEavesInsCeilingResult);
	str_editEavesInsRafterResult.Format("%.2f", ThermBEavesInsRafterResult);
	str_editGableInsCeilingResult.Format("%.2f", ThermBGableInsCeilingResult);
	str_editGableInsRafterResult.Format("%.2f", ThermBGableInsRafterResult);
	str_editLengthNormalCornersResult.Format("%.2f", ThermBLengthNormalCornersResult);
	str_editLengthInvertedCornersResult.Format("%.2f", ThermBLengthInvertedCornersResult);
	str_editPartyWallBwDwellingResult.Format("%.2f", ThermBPartyWallBwDwellingResult);

	UpdateData(FALSE);
}

void CDlg_ThermalBridging::ReadInputsFromThermalBridgingDlg()
{
	UpdateData(TRUE);

	yValueEntry = atof(str_editYvalue);
	ThermBGFPerimeter = atof(str_editGFPerimeter);
	ThermBFloorWithingDwellinPerimeter  = atof(str_editFloorWithingDwellinPerimeter);
	ThermBFloorBetweenDwellinPerimeter = atof(str_editFloorBetweenDwellinPerimeter);
	ThermBBalconyWithingDwellingLength = atof(str_editBalconyWithingDwellingLength);
	ThermBBalconyBetweenDwellingLength = atof(str_editBalconyBetweenDwellingLength);
	ThermBEavesAtCeiling = atof(str_editEavesAtCeiling);
	ThermBEavesAtRafter = atof(str_editEavesAtRafter);
	ThermBGableAtCeiling = atof(str_editGableAtCeiling);
	ThermBGableAtRafter = atof(str_editGableAtRafter);
	ThermBLengthNormalCorners = atof(str_editLengthNormalCorners);
	ThermBLengthInvertedCorners = atof(str_editLengthInvertedCorners);
	ThermBPartWallBetweenDwelling = atof(str_edirPartWallBetweenDwelling);

	ThermBMetalBoxLintelUserDef = str_comboMetalBoxLintelUserDef;
	ThermBOtherLintelUserDef = str_comboOtherLintelUserDef;
	ThermBSillUserDef = str_comboSillUserDef_2;
	ThermBJambUserDef = str_comboJambUserDef;
	ThermBGFPerimeterUserDef = str_comboGFPerimeterUserDef;
	ThermBFloorWithinDwellingUserDef = str_comboFloorWithinDwellingUserDef;
	ThermBFloorBwDwellingUserDef = str_comboFloorBwDwellingUserDef;
	ThermBBalcWithinDwellingLengthUserDef = str_comboBalcWithinDwellingLengthUserDef;
	ThermBBalcBwDwellingLengthUserDef = str_comboBalcBwDwellingLengthUserDef;
	ThermBEavesInsAtCeilingUserDef = str_comboEavesInsAtCeilingUserDef;
	ThermBEavesInsAtRafterUserDef = str_comboEavesInsAtRafterUserDef;
	ThermBGableInsAtCeilingUserDef = str_comboGableInsAtCeilingUserDef;
	ThermBGableInsAtRafetUserDef = str_comboGableInsAtRafetUserDef;
	ThermBLengthOfNormalCornersUserDef = str_comboLengthOfNormalCornersUserDef;
	ThermBLengthOfInvertedCornersUserDef = str_comboLengthOfInvertedCornersUserDef;
	ThermBPartWallBetweenDwellingUserDef = str_comboPartWallBetweenDwellingUserDef;

	ThermBMetalBoxLintelSiValue = atof(str_editMetalBoxLintelSiValue);
	ThermBOtherLintelsSiValue = atof(str_editOtherLintelsSiValue);
	ThermBSillSiValue = atof(str_editSillSiValue);
	ThermBJambSiValue = atof(str_editJambSiValue);
	ThermBGFPerimeterSiValue = atof(str_editGFPerimeterSiValue);
	ThermBFloorWithinDwellingSiValue = atof(str_editFloorWithinDwellingSiValue);
	ThermBFloorBetweenDwellingSiValue = atof(str_editFloorBetweenDwellingSiValue);
	ThermBBalconyWithinDwellingSiValue = atof(str_editBalconyWithinDwellingSiValue);
	ThermBBalconyBwDwellingSiValue = atof(str_editBalconyBwDwellingSiValue);
	ThermBEavesInsAtCelingSiValue = atof(str_editEavesInsAtCelingSiValue);
	ThermBEavesInsAtRafterSiValue = atof(str_editEavesInsAtRafterSiValue);
	ThermBGableInsAtCeilingSiValue = atof(str_editGableInsAtCeilingSiValue);
	ThermBGableInsAtRafterSiValue = atof(str_editGableInsAtRafterSiValue);
	ThermBLengthOfNormalCornersSiValue = atof(str_editlLengthOfNormalCornersSiValue);
	ThermBLengthOfInvertedCornersSiValue = atof(str_editLengthOfInvertedCornersSiValue);
	ThermBPartBwDwellingLengthSiValue = atof(str_editPartBwDwellingLengthSiValue);

	ThermBMetalBoxLintelResult = ThermBMetalBoxLintelSiValue;
	ThermBOtherLintelsResult   = ThermBOtherLintelsSiValue ;
	ThermBSillResult           = ThermBSillSiValue ;
	ThermBJambResult           = ThermBJambSiValue;
	ThermBGFPerimeterResult                    =  ThermBGFPerimeter * ThermBGFPerimeterSiValue;
	ThermBFloorWithinDwellingPerimeterResult   = ThermBFloorWithingDwellinPerimeter * ThermBFloorWithinDwellingSiValue;
	ThermBFloorBetweenDwellingPerimeterResult  = ThermBFloorBetweenDwellinPerimeter * ThermBFloorBetweenDwellingSiValue ;
	ThermBBalcWithDwellingLengthResult   = ThermBBalconyWithingDwellingLength * ThermBBalconyWithinDwellingSiValue;
	ThermBBalconyBwDwellingLengthResult  = ThermBBalconyBetweenDwellingLength * ThermBBalconyBwDwellingSiValue;
	ThermBEavesInsCeilingResult  = ThermBEavesAtCeiling * ThermBEavesInsAtCelingSiValue;
	ThermBEavesInsRafterResult   = ThermBEavesAtRafter * ThermBEavesInsAtRafterSiValue;
	ThermBGableInsCeilingResult  = ThermBGableAtCeiling * ThermBGableInsAtCeilingSiValue ;
	ThermBGableInsRafterResult   = ThermBGableAtRafter * ThermBGableInsAtRafterSiValue;
	ThermBLengthNormalCornersResult   = ThermBLengthNormalCorners * ThermBLengthOfNormalCornersSiValue ;
	ThermBLengthInvertedCornersResult = ThermBLengthInvertedCorners * ThermBLengthOfInvertedCornersSiValue;
	ThermBPartyWallBwDwellingResult   = ThermBPartWallBetweenDwelling * ThermBPartBwDwellingLengthSiValue;

	str_editMetalBoxLintelResult.Format("%.2f", ThermBMetalBoxLintelResult);
	str_editOtherLintelsResult.Format("%.2f", ThermBOtherLintelsResult);
	str_editSillResult.Format("%.2f", ThermBSillResult);
	str_editJambResult.Format("%.2f", ThermBJambResult);
	str_editGFPerimeterResult.Format("%.2f", ThermBGFPerimeterResult);
	str_editFloorWithinDwellingPerimeterResult.Format("%.2f", ThermBFloorWithinDwellingPerimeterResult);
	str_editFloorBetweenDwellingPerimeterResult.Format("%.2f", ThermBFloorBetweenDwellingPerimeterResult);
	str_editBalcWithDwellingLengthResult.Format("%.2f", ThermBBalcWithDwellingLengthResult);
	str_editBalconyBwDwellingLengthResult.Format("%.2f", ThermBBalconyBwDwellingLengthResult);
	str_editEavesInsCeilingResult.Format("%.2f", ThermBEavesInsCeilingResult);
	str_editEavesInsRafterResult.Format("%.2f", ThermBEavesInsRafterResult);
	str_editGableInsCeilingResult.Format("%.2f", ThermBGableInsCeilingResult);
	str_editGableInsRafterResult.Format("%.2f", ThermBGableInsRafterResult);
	str_editLengthNormalCornersResult.Format("%.2f", ThermBLengthNormalCornersResult);
	str_editLengthInvertedCornersResult.Format("%.2f", ThermBLengthInvertedCornersResult);
	str_editPartyWallBwDwellingResult.Format("%.2f", ThermBPartyWallBwDwellingResult);

	UpdateData(FALSE);
}
void CDlg_ThermalBridging::OnCbnSelchangeCombo2()
{
	EnableOrDisableEditBoxes();
	ReadInputsFromThermalBridgingDlg();
}

void CDlg_ThermalBridging::EnableOrDisableEditBoxes()
{
	UpdateData(TRUE);
	
	//------------------------------------------
	// Disable edit boxes
	if(str_comboMetalBoxLintelUserDef == "Yes")
	{
		m_editMetalBoxLintelSiValue.SetReadOnly(FALSE);
	}

	if(str_comboOtherLintelUserDef == "Yes")
	{
		m_editOtherLintelsSiValue.SetReadOnly(FALSE);
	}

	if(str_comboSillUserDef_2 == "Yes")
	{
		m_editSillSiValue.SetReadOnly(FALSE);
	}

	if(str_comboJambUserDef == "Yes")
	{
		m_editJambSiValue.SetReadOnly(FALSE);
	}

	if(str_comboGFPerimeterUserDef == "Yes")
	{
		m_editGFPerimeterSiValue.SetReadOnly(FALSE);
	}

	if(str_comboFloorWithinDwellingUserDef == "Yes")
	{
		m_editFloorWithinDwellingSiValue.SetReadOnly(FALSE);
	}

	if(str_comboFloorBwDwellingUserDef == "Yes")
	{
		m_editFloorBetweenDwellingSiValue.SetReadOnly(FALSE);
	}

	if(str_comboBalcWithinDwellingLengthUserDef == "Yes")
	{
		m_editBalconyWithinDwellingSiValue.SetReadOnly(FALSE);
	}

	if(str_comboBalcBwDwellingLengthUserDef == "Yes")
	{
		m_editBalconyBwDwellingSiValue.SetReadOnly(FALSE);
	}

	if(str_comboEavesInsAtCeilingUserDef == "Yes")
	{
		m_editEavesInsAtCelingSiValue.SetReadOnly(FALSE);
	}

	if(str_comboEavesInsAtRafterUserDef == "Yes")
	{
		m_editEavesInsAtRafterSiValue.SetReadOnly(FALSE);
	}

	if(str_comboGableInsAtCeilingUserDef == "Yes")
	{
		m_editGableInsAtCeilingSiValue.SetReadOnly(FALSE);
	}

	if(str_comboGableInsAtRafetUserDef == "Yes")
	{
		m_editGableInsAtRafterSiValue.SetReadOnly(FALSE);
	}

	if(str_comboLengthOfNormalCornersUserDef == "Yes")
	{
		m_editlLengthOfNormalCornersSiValue.SetReadOnly(FALSE);
	}

	if(str_comboLengthOfInvertedCornersUserDef == "Yes")
	{
		m_editLengthOfInvertedCornersSiValue.SetReadOnly(FALSE);
	}

	if(str_comboPartWallBetweenDwellingUserDef == "Yes")
	{
		m_editPartBwDwellingLengthSiValue.SetReadOnly(FALSE);
	}

	//---------------------------------------------------
	// Enable edit boxes
	if(str_comboMetalBoxLintelUserDef == "No")
	{
		m_editMetalBoxLintelSiValue.SetReadOnly(TRUE);
		str_editMetalBoxLintelSiValue.Format("%.2f",0.5);
	}

	if(str_comboOtherLintelUserDef == "No")
	{
		m_editOtherLintelsSiValue.SetReadOnly(TRUE);
		str_editOtherLintelsSiValue.Format("%.2f",0.3);
	}

	if(str_comboSillUserDef_2 == "No")
	{
		m_editSillSiValue.SetReadOnly(TRUE);
		str_editSillSiValue.Format("%.2f",0.04);
	}

	if(str_comboJambUserDef == "No")
	{
		m_editJambSiValue.SetReadOnly(TRUE);
		str_editJambSiValue.Format("%.2f",0.05);
	}

	if(str_comboGFPerimeterUserDef == "No")
	{
		m_editGFPerimeterSiValue.SetReadOnly(TRUE);
		str_editGFPerimeterSiValue.Format("%.2f",0.16);
	}

	if(str_comboFloorWithinDwellingUserDef == "No")
	{
		m_editFloorWithinDwellingSiValue.SetReadOnly(TRUE);
		str_editFloorWithinDwellingSiValue.Format("%.2f",0.07);
	}

	if(str_comboFloorBwDwellingUserDef == "No")
	{
		m_editFloorBetweenDwellingSiValue.SetReadOnly(TRUE);
		str_editFloorBetweenDwellingSiValue.Format("%.2f",0.07);
	}

	if(str_comboBalcWithinDwellingLengthUserDef == "No")
	{
		m_editBalconyWithinDwellingSiValue.SetReadOnly(TRUE);
		str_editBalconyWithinDwellingSiValue.Format("%.f",0);
	}

	if(str_comboBalcBwDwellingLengthUserDef == "No")
	{
		m_editBalconyBwDwellingSiValue.SetReadOnly(TRUE);
		str_editBalconyBwDwellingSiValue.Format("%.2f",0.04);
	}

	if(str_comboEavesInsAtCeilingUserDef == "No")
	{
		m_editEavesInsAtCelingSiValue.SetReadOnly(TRUE);
		str_editEavesInsAtCelingSiValue.Format("%.2f",0.06);
	}

	if(str_comboEavesInsAtRafterUserDef == "No")
	{
		m_editEavesInsAtRafterSiValue.SetReadOnly(TRUE);
		str_editEavesInsAtRafterSiValue.Format("%.2f",0.04);
	}

	if(str_comboGableInsAtCeilingUserDef == "No")
	{
		m_editGableInsAtCeilingSiValue.SetReadOnly(TRUE);
		str_editGableInsAtCeilingSiValue.Format("%.2f",0.24);
	}

	if(str_comboGableInsAtRafetUserDef == "No")
	{
		m_editGableInsAtRafterSiValue.SetReadOnly(TRUE);
		str_editGableInsAtRafterSiValue.Format("%.2f",0.04);
	}

	if(str_comboLengthOfNormalCornersUserDef == "No")
	{
		m_editlLengthOfNormalCornersSiValue.SetReadOnly(TRUE);
		str_editlLengthOfNormalCornersSiValue.Format("%.2f",0.09);
	}

	if(str_comboLengthOfInvertedCornersUserDef == "No")
	{
		m_editLengthOfInvertedCornersSiValue.SetReadOnly(TRUE);
		str_editLengthOfInvertedCornersSiValue.Format("%.2f",-0.09);
	}

	if(str_comboPartWallBetweenDwellingUserDef == "No")
	{
		m_editPartBwDwellingLengthSiValue.SetReadOnly(TRUE);
		str_editPartBwDwellingLengthSiValue.Format("%.2f",0.03);
	}

	UpdateData(FALSE);
}

void CDlg_ThermalBridging::OnEnChangeEditGfperimeter()
{
	//------------------------------------------------------------------------------
	// 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_editGFPerimeter, lpszValidChars) != 0) 
	{
		str_editGFPerimeter = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
	
	// Check limit
	isCheckRange_ThermBGFPerimeter = true;
}

void CDlg_ThermalBridging::OnCbnSelchangeCombo4()
{
	EnableOrDisableEditBoxes();
	ReadInputsFromThermalBridgingDlg();
}

void CDlg_ThermalBridging::OnCbnSelchangeCombo11()
{
	EnableOrDisableEditBoxes();
	ReadInputsFromThermalBridgingDlg();
}

void CDlg_ThermalBridging::OnCbnSelchangeCombo12()
{
	EnableOrDisableEditBoxes();
	ReadInputsFromThermalBridgingDlg();
}

void CDlg_ThermalBridging::OnCbnSelchangeCombo13()
{
	EnableOrDisableEditBoxes();
	ReadInputsFromThermalBridgingDlg();
}

void CDlg_ThermalBridging::OnCbnSelchangeCombo14()
{
	EnableOrDisableEditBoxes();
	ReadInputsFromThermalBridgingDlg();
}

void CDlg_ThermalBridging::OnCbnSelchangeCombo15()
{
	EnableOrDisableEditBoxes();
	ReadInputsFromThermalBridgingDlg();
}

void CDlg_ThermalBridging::OnCbnSelchangeCombo16()
{
	EnableOrDisableEditBoxes();
	ReadInputsFromThermalBridgingDlg();
}

void CDlg_ThermalBridging::OnCbnSelchangeCombo17()
{
	EnableOrDisableEditBoxes();
	ReadInputsFromThermalBridgingDlg();
}

void CDlg_ThermalBridging::OnCbnSelchangeCombo18()
{
	EnableOrDisableEditBoxes();
	ReadInputsFromThermalBridgingDlg();
}

void CDlg_ThermalBridging::OnCbnSelchangeCombo19()
{
	EnableOrDisableEditBoxes();
	ReadInputsFromThermalBridgingDlg();
}

void CDlg_ThermalBridging::OnCbnSelchangeCombo20()
{
	EnableOrDisableEditBoxes();
	ReadInputsFromThermalBridgingDlg();
}

void CDlg_ThermalBridging::OnCbnSelchangeCombo21()
{
	EnableOrDisableEditBoxes();
	ReadInputsFromThermalBridgingDlg();
}

void CDlg_ThermalBridging::OnCbnSelchangeCombo22()
{
	EnableOrDisableEditBoxes();
	ReadInputsFromThermalBridgingDlg();
}

void CDlg_ThermalBridging::OnCbnSelchangeCombo23()
{
	EnableOrDisableEditBoxes();
	ReadInputsFromThermalBridgingDlg();
}

void CDlg_ThermalBridging::OnCbnSelchangeCombo1()
{
	EnableOrDisableEditBoxes();
	ReadInputsFromThermalBridgingDlg();
}

void CDlg_ThermalBridging::OnEnChangeEditFbwdwellingperimeter()
{
	//------------------------------------------------------------------------------
	// 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_editFloorWithingDwellinPerimeter, lpszValidChars) != 0) 
	{
		str_editFloorWithingDwellinPerimeter = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
	
	// Check limit
	isCheckRange_ThermBFloorWithingDwellinPerimeter  = true;
}

void CDlg_ThermalBridging::OnEnChangeEditFwithingdwellingperimeter()
{
	//------------------------------------------------------------------------------
	// 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_editFloorBetweenDwellinPerimeter, lpszValidChars) != 0) 
	{
		str_editFloorBetweenDwellinPerimeter = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
	
	// Check limit
	isCheckRange_ThermBFloorBetweenDwellinPerimeter  = true;
}

void CDlg_ThermalBridging::OnEnChangeEditBalcwithdwellinglendth()
{
	//------------------------------------------------------------------------------
	// 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_editBalconyWithingDwellingLength, lpszValidChars) != 0) 
	{
		str_editBalconyWithingDwellingLength = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
	
	// Check limit
	isCheckRange_ThermBBalconyWithingDwellingLength  = true;
}

void CDlg_ThermalBridging::OnEnChangeEditBalconybetweendwellinglength()
{
	//------------------------------------------------------------------------------
	// 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_editBalconyBetweenDwellingLength, lpszValidChars) != 0) 
	{
		str_editBalconyBetweenDwellingLength = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
	
	// Check limit
	isCheckRange_ThermBBalconyBetweenDwellingLength  = true;
}

void CDlg_ThermalBridging::OnEnChangeEditEavesinsatceiling()
{
	//------------------------------------------------------------------------------
	// 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_editEavesAtCeiling, lpszValidChars) != 0) 
	{
		str_editEavesAtCeiling = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
	
	// Check limit
	isCheckRange_ThermBEavesAtCeiling   = true;
}

void CDlg_ThermalBridging::OnEnChangeEditEvaesinsatrafter()
{
	//------------------------------------------------------------------------------
	// 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_editEavesAtRafter, lpszValidChars) != 0) 
	{
		str_editEavesAtRafter = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
	
	// Check limit
	isCheckRange_ThermBEavesAtRafter    = true;
}

void CDlg_ThermalBridging::OnEnChangeEditGableatceiling()
{
	//------------------------------------------------------------------------------
	// 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_editGableAtCeiling, lpszValidChars) != 0) 
	{
		str_editGableAtCeiling = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
	
	// Check limit
	isCheckRange_ThermBGableAtCeiling    = true;
}

void CDlg_ThermalBridging::OnEnChangeEditGableatrafter()
{
	//------------------------------------------------------------------------------
	// 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_editGableAtRafter, lpszValidChars) != 0) 
	{
		str_editGableAtRafter = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
	
	// Check limit
	isCheckRange_ThermBGableAtRafter    = true;
}

void CDlg_ThermalBridging::OnEnChangeEditNormalcornerslength()
{
	//------------------------------------------------------------------------------
	// 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_editLengthNormalCorners, lpszValidChars) != 0) 
	{
		str_editLengthNormalCorners = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
	
	// Check limit
	isCheckRange_ThermBLengthNormalCorners   = true;
}

void CDlg_ThermalBridging::OnEnChangeEditInvertedcornerslength()
{
	//------------------------------------------------------------------------------
	// 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_editLengthInvertedCorners, lpszValidChars) != 0) 
	{
		str_editLengthInvertedCorners = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
		
	// Check limit
	isCheckRange_ThermBLengthInvertedCorners   = true;
}

void CDlg_ThermalBridging::OnEnChangeEditPartywall()
{
	//------------------------------------------------------------------------------
	// 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_edirPartWallBetweenDwelling, lpszValidChars) != 0) 
	{
		str_edirPartWallBetweenDwelling = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
		
	// Check limit
	isCheckRange_ThermBPartWallBetweenDwelling   = true;
}

void CDlg_ThermalBridging::OnEnChangeEditMetalboxlintelvalue()
{
	//------------------------------------------------------------------------------
	// 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_editMetalBoxLintelSiValue, lpszValidChars) != 0) 
	{
		str_editMetalBoxLintelSiValue = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
}

void CDlg_ThermalBridging::OnEnChangeEditotherlintelvalue()
{
	//------------------------------------------------------------------------------
	// 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_editOtherLintelsSiValue, lpszValidChars) != 0) 
	{
		str_editOtherLintelsSiValue = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
}

void CDlg_ThermalBridging::OnEnChangeEditsilllvalue()
{
	//------------------------------------------------------------------------------
	// 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_editSillSiValue, lpszValidChars) != 0) 
	{
		str_editSillSiValue = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
}

void CDlg_ThermalBridging::OnEnChangeEditjambvalue()
{
	//------------------------------------------------------------------------------
	// 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_editJambSiValue, lpszValidChars) != 0) 
	{
		str_editJambSiValue = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
}

void CDlg_ThermalBridging::OnEnChangeEditGfperimeter2()
{
	//------------------------------------------------------------------------------
	// 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_editGFPerimeterSiValue, lpszValidChars) != 0) 
	{
		str_editGFPerimeterSiValue = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
		
	// Check limit
	isCheckRange_ThermBGFPerimeterSiValue  = true;
}

void CDlg_ThermalBridging::OnEnChangeEditFbwdwellingperimeter2()
{
	//------------------------------------------------------------------------------
	// 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_editFloorWithinDwellingSiValue, lpszValidChars) != 0) 
	{
		str_editFloorWithinDwellingSiValue = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
		
	// Check limit
	isCheckRange_ThermBFloorWithinDwellingSiValue  = true;
}

void CDlg_ThermalBridging::OnEnChangeEditFwithingdwellingperimeter2()
{
	//------------------------------------------------------------------------------
	// 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_editFloorBetweenDwellingSiValue, lpszValidChars) != 0) 
	{
		str_editFloorBetweenDwellingSiValue = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
		
	// Check limit
	isCheckRange_ThermBFloorBetweenDwellingSiValue  = true;
}

void CDlg_ThermalBridging::OnEnChangeEditBalcwithdwellinglendth2()
{
	//------------------------------------------------------------------------------
	// 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_editBalconyWithinDwellingSiValue, lpszValidChars) != 0) 
	{
		str_editBalconyWithinDwellingSiValue = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
		
	// Check limit
	isCheckRange_ThermBBalconyWithinDwellingSiValue  = true;
}

void CDlg_ThermalBridging::OnEnChangeEditBalconybetweendwellinglength2()
{
	//------------------------------------------------------------------------------
	// 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_editBalconyBwDwellingSiValue, lpszValidChars) != 0) 
	{
		str_editBalconyBwDwellingSiValue = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
		
	// Check limit
	isCheckRange_ThermBBalconyBwDwellingSiValue  = true;
}

void CDlg_ThermalBridging::OnEnChangeEditEavesinsatceiling2()
{
	//------------------------------------------------------------------------------
	// 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_editEavesInsAtCelingSiValue, lpszValidChars) != 0) 
	{
		str_editEavesInsAtCelingSiValue = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
			
	// Check limit
	isCheckRange_ThermBEavesInsAtCelingSiValue  = true;
}

void CDlg_ThermalBridging::OnEnChangeEditEvaesinsatrafter2()
{
	//------------------------------------------------------------------------------
	// 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_editEavesInsAtRafterSiValue, lpszValidChars) != 0) 
	{
		str_editEavesInsAtRafterSiValue = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
			
	// Check limit
	isCheckRange_ThermBEavesInsAtRafterSiValue = true;
}

void CDlg_ThermalBridging::OnEnChangeEditGableatceiling2()
{
	//------------------------------------------------------------------------------
	// 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_editGableInsAtCeilingSiValue, lpszValidChars) != 0) 
	{
		str_editGableInsAtCeilingSiValue = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
			
	// Check limit
	isCheckRange_ThermBGableInsAtCeilingSiValue = true;
}

void CDlg_ThermalBridging::OnEnChangeEditGableatrafter2()
{
	//------------------------------------------------------------------------------
	// 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_editGableInsAtRafterSiValue, lpszValidChars) != 0) 
	{
		str_editGableInsAtRafterSiValue = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
			
	// Check limit
	isCheckRange_ThermBGableInsAtRafterSiValue = true;
}

void CDlg_ThermalBridging::OnEnChangeEditNormalcornerslength2()
{
	//------------------------------------------------------------------------------
	// 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_editlLengthOfNormalCornersSiValue, lpszValidChars) != 0) 
	{
		str_editlLengthOfNormalCornersSiValue = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
			
	// Check limit
	isCheckRange_ThermBLengthOfNormalCornersSiValue  = true;
}

void CDlg_ThermalBridging::OnEnChangeEditInvertedcornerslength2()
{
	//------------------------------------------------------------------------------
	// 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_editLengthOfInvertedCornersSiValue, lpszValidChars) != 0) 
	{
		str_editLengthOfInvertedCornersSiValue = "";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromThermalBridgingDlg();
				
	// Check limit
	isCheckRange_ThermBLengthOfInvertedCornersSiValue  = true;
}

void CDlg_ThermalBridging::OnEnChangeEditPartywall2()
{
	//------------------------------------------------------------------------------
	// 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_editPartBwDwellingLengthSiValue, lpszValidChars) != 0) 
	{
		str_editPartBwDwellingLengthSiValue = "";
		UpdateData(FALSE);
	}
	ReadInputsFromThermalBridgingDlg();
				
	// Check limit
	isCheckRange_ThermBPartBwDwellingLengthSiValue   = true;
}

void CDlg_ThermalBridging::OnCbnSelchangeCombo5()
{
	EnableOrDisableEditBoxes();
	ReadInputsFromThermalBridgingDlg();
}

void CDlg_ThermalBridging::EnterOrCalculateyValue()
{
	netAreaWindows = winNArea+   
					  winNEArea+ 
				      winEArea+   
				      winSEArea+ 
				      winSArea+   
			          winSWArea+ 
				      winWArea+   
				      winNWArea;
				    
	netAreaRoofLights = rooflightsArea;

	extAreaSum = netAreaDoors     +
				 netAreaWindows   +
				 netAreaRoofLights+
				 netAreaGF +
				 netAreaExFloor  +
				 netAreaWallType1+
				 netAreaWallType2+
				 netAreaRoofType1 +
				 netAreaRoofType2 ;

	extUvalueXareaSum = (netAreaDoors      * UvalueDoors)     +
						(netAreaWindows    * UvalueWindows)   + 
						(netAreaRoofLights * UvalueRooflights)+
						(netAreaGF         * UvalueGF) +
						(netAreaExFloor    * UvalueExposedFloor)  +
						(netAreaWallType1  * UvalueWallType1)+
						(netAreaWallType2  * UvalueWallType2)+
						(netAreaRoofType1  * UvalueRoofTYpe1) +
						(netAreaRoofType2  * UvalueRoofType2);

	
	if(enterYValue == 1)
	{
		m_btnEnter.SetCheck(1);
		m_btnCalculate.SetCheck(0);

		m_chkEnter = 1;
		m_chkCalculate = 0;


		m_editYvalue.EnableWindow(TRUE);

		// Disable controls
		m_editGFPerimeter.EnableWindow(FALSE);
		m_editFloorWithingDwellinPerimeter.EnableWindow(FALSE);
		m_editFloorBetweenDwellinPerimeter.EnableWindow(FALSE);
		m_editBalconyWithingDwellingLength.EnableWindow(FALSE);
		m_editBalconyBetweenDwellingLength.EnableWindow(FALSE);
		m_editEavesAtCeiling.EnableWindow(FALSE);
		m_editEavesAtRafter.EnableWindow(FALSE);
		m_editGableAtCeiling.EnableWindow(FALSE);
		m_editGableAtRafter.EnableWindow(FALSE);
		m_editLengthNormalCorners.EnableWindow(FALSE);
		m_editLengthInvertedCorners.EnableWindow(FALSE);
		m_edirPartWallBetweenDwelling.EnableWindow(FALSE);

		m_comboGFPerimeterUserDef.EnableWindow(FALSE);
		m_comboFloorWithinDwellingUserDef.EnableWindow(FALSE);
		m_comboFloorBwDwellingUserDef.EnableWindow(FALSE);
		m_comboBalcWithinDwellingLengthUserDef.EnableWindow(FALSE);
		m_comboBalcBwDwellingLengthUserDef.EnableWindow(FALSE);
		m_comboEavesInsAtCeilingUserDef.EnableWindow(FALSE);
		m_comboEavesInsAtRafterUserDef.EnableWindow(FALSE);
		m_comboGableInsAtCeilingUserDef.EnableWindow(FALSE);
		m_comboGableInsAtRafetUserDef.EnableWindow(FALSE);
		m_comboLengthOfNormalCornersUserDef.EnableWindow(FALSE);
		m_comboLengthOfInvertedCornersUserDef.EnableWindow(FALSE);
		m_comboPartWallBetweenDwellingUserDef.EnableWindow(FALSE);

		m_editGFPerimeterSiValue.EnableWindow(FALSE);
		m_editFloorWithinDwellingSiValue.EnableWindow(FALSE);
		m_editFloorBetweenDwellingSiValue.EnableWindow(FALSE);
		m_editBalconyWithinDwellingSiValue.EnableWindow(FALSE);
		m_editBalconyBwDwellingSiValue.EnableWindow(FALSE);
		m_editEavesInsAtCelingSiValue.EnableWindow(FALSE);
		m_editEavesInsAtRafterSiValue.EnableWindow(FALSE);
		m_editGableInsAtCeilingSiValue.EnableWindow(FALSE);
		m_editGableInsAtRafterSiValue.EnableWindow(FALSE);
		m_editlLengthOfNormalCornersSiValue.EnableWindow(FALSE);
		m_editLengthOfInvertedCornersSiValue.EnableWindow(FALSE);
		m_editPartBwDwellingLengthSiValue.EnableWindow(FALSE);

		m_editGFPerimeterResult.EnableWindow(FALSE);
		m_editFloorWithinDwellingPerimeterResult.EnableWindow(FALSE);
		m_editFloorBetweenDwellingPerimeterResult.EnableWindow(FALSE);
		m_editBalcWithDwellingLengthResult.EnableWindow(FALSE);
		m_editBalconyBwDwellingLengthResult.EnableWindow(FALSE);
		m_editEavesInsCeilingResult.EnableWindow(FALSE);
		m_editEavesInsRafterResult.EnableWindow(FALSE);
		m_editGableInsCeilingResult.EnableWindow(FALSE);
		m_editGableInsRafterResult.EnableWindow(FALSE);
		m_editLengthNormalCornersResult.EnableWindow(FALSE);
		m_editLengthInvertedCornersResult.EnableWindow(FALSE);
		m_editPartyWallBwDwellingResult.EnableWindow(FALSE);

		thermBridgeYvalue_grossArea = (extAreaSum * yValueEntry)/extUvalueXareaSum;
	}
	else if(enterYValue == 0)
	{
		m_editYvalue.EnableWindow(FALSE);

		m_btnEnter.SetCheck(0);
		m_btnCalculate.SetCheck(1);

		m_editGFPerimeter.EnableWindow(TRUE);
		m_editFloorWithingDwellinPerimeter.EnableWindow(TRUE);
		m_editFloorBetweenDwellinPerimeter.EnableWindow(TRUE);
		m_editBalconyWithingDwellingLength.EnableWindow(TRUE);
		m_editBalconyBetweenDwellingLength.EnableWindow(TRUE);
		m_editEavesAtCeiling.EnableWindow(TRUE);
		m_editEavesAtRafter.EnableWindow(TRUE);
		m_editGableAtCeiling.EnableWindow(TRUE);
		m_editGableAtRafter.EnableWindow(TRUE);
		m_editLengthNormalCorners.EnableWindow(TRUE);
		m_editLengthInvertedCorners.EnableWindow(TRUE);
		m_edirPartWallBetweenDwelling.EnableWindow(TRUE);

		m_comboGFPerimeterUserDef.EnableWindow(TRUE);
		m_comboFloorWithinDwellingUserDef.EnableWindow(TRUE);
		m_comboFloorBwDwellingUserDef.EnableWindow(TRUE);
		m_comboBalcWithinDwellingLengthUserDef.EnableWindow(TRUE);
		m_comboBalcBwDwellingLengthUserDef.EnableWindow(TRUE);
		m_comboEavesInsAtCeilingUserDef.EnableWindow(TRUE);
		m_comboEavesInsAtRafterUserDef.EnableWindow(TRUE);
		m_comboGableInsAtCeilingUserDef.EnableWindow(TRUE);
		m_comboGableInsAtRafetUserDef.EnableWindow(TRUE);
		m_comboLengthOfNormalCornersUserDef.EnableWindow(TRUE);
		m_comboLengthOfInvertedCornersUserDef.EnableWindow(TRUE);
		m_comboPartWallBetweenDwellingUserDef.EnableWindow(TRUE);

		m_editGFPerimeterSiValue.EnableWindow(TRUE);
		m_editFloorWithinDwellingSiValue.EnableWindow(TRUE);
		m_editFloorBetweenDwellingSiValue.EnableWindow(TRUE);
		m_editBalconyWithinDwellingSiValue.EnableWindow(TRUE);
		m_editBalconyBwDwellingSiValue.EnableWindow(TRUE);
		m_editEavesInsAtCelingSiValue.EnableWindow(TRUE);
		m_editEavesInsAtRafterSiValue.EnableWindow(TRUE);
		m_editGableInsAtCeilingSiValue.EnableWindow(TRUE);
		m_editGableInsAtRafterSiValue.EnableWindow(TRUE);
		m_editlLengthOfNormalCornersSiValue.EnableWindow(TRUE);
		m_editLengthOfInvertedCornersSiValue.EnableWindow(TRUE);
		m_editPartBwDwellingLengthSiValue.EnableWindow(TRUE);

		m_editGFPerimeterResult.EnableWindow(TRUE);
		m_editFloorWithinDwellingPerimeterResult.EnableWindow(TRUE);
		m_editFloorBetweenDwellingPerimeterResult.EnableWindow(TRUE);
		m_editBalcWithDwellingLengthResult.EnableWindow(TRUE);
		m_editBalconyBwDwellingLengthResult.EnableWindow(TRUE);
		m_editEavesInsCeilingResult.EnableWindow(TRUE);
		m_editEavesInsRafterResult.EnableWindow(TRUE);
		m_editGableInsCeilingResult.EnableWindow(TRUE);
		m_editGableInsRafterResult.EnableWindow(TRUE);
		m_editLengthNormalCornersResult.EnableWindow(TRUE);
		m_editLengthInvertedCornersResult.EnableWindow(TRUE);
		m_editPartyWallBwDwellingResult.EnableWindow(TRUE);

	
		thermBridgeYvalue_grossArea = ( ThermBMetalBoxLintelResult +
										ThermBOtherLintelsResult+
										ThermBSillResult+
										ThermBJambResult+
										ThermBGFPerimeterResult+
										ThermBFloorWithinDwellingPerimeterResult+
										ThermBFloorBetweenDwellingPerimeterResult+
										ThermBBalcWithDwellingLengthResult+
										ThermBBalconyBwDwellingLengthResult+
										ThermBEavesInsCeilingResult+
										ThermBEavesInsRafterResult+
										ThermBGableInsCeilingResult+
										ThermBGableInsRafterResult+
										ThermBLengthNormalCornersResult+
										ThermBLengthInvertedCornersResult+
										ThermBPartyWallBwDwellingResult) / extUvalueXareaSum;
	}
}

void CDlg_ThermalBridging::OnBnClickedCheck1()
{
	m_btnEnter.SetCheck(1);
	m_btnCalculate.SetCheck(0);
	
	enterYValue = 1;
	EnterOrCalculateyValue();
}

void CDlg_ThermalBridging::OnBnClickedCheck2()
{
	m_btnEnter.SetCheck(0);
	m_btnCalculate.SetCheck(1);	
	enterYValue = 0;
	EnterOrCalculateyValue();
}

void CDlg_ThermalBridging::OnEnChangeEditGfperimeter4()
{
	yValue_from_HEM = false;
	ReadInputsFromThermalBridgingDlg();
	
	// Check limit
	isCheckRange_yValueEntry = true;
}

BOOL CDlg_ThermalBridging::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);
}