// Dlg_Renewables1.cpp : implementation file
//

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

// CDlg_Renewables1 dialog

IMPLEMENT_DYNAMIC(CDlg_Renewables1, CDialog)
CDlg_Renewables1::CDlg_Renewables1(CWnd* pParent /*=NULL*/)
	: CDialog(CDlg_Renewables1::IDD, pParent)
	, str_edituHydroAnnualAvgHead(_T(""))
	, str_edituHydroAnnualAvgFlow(_T(""))
	, str_edituHydroEff(_T(""))
	, str_editCHPheatToPowerRatio(_T(""))
	, str_editCHPElectricEff(_T(""))
	, str_comboCHPFuel(_T(""))
	, str_editCHPHeatingEff(_T(""))
	, str_editCHPHeatingFraction(_T(""))
	, str_editMVHRThermalEff(_T(""))
	, str_combouHydro(_T(""))
	, str_combouCHPyn(_T(""))
	, str_comboMVHR(_T(""))
	, str_comboFGHRSpresent(_T(""))
	, str_editFGHRSstoreVolume(_T(""))
	, str_editFGHRSusefulFracHtRec(_T(""))
	, str_comboFGHRSfittedMain(_T(""))
	, str_comboFGHRSfittedSec(_T(""))
	, str_comboFGHRStype(_T(""))
	, str_editFGHRStotFracHeatRec(_T(""))
	, str_editFGHRSelecPowerReq(_T(""))
	, str_comboFGHRSpvPoweredHt(_T(""))
	, str_editFGHRSpvPkPower(_T(""))
	, str_comboFGHRSpvPkOrientation(_T(""))
	, str_comboFGHRSpvTilt(_T(""))
	, str_comboFGHRSpvOvershading(_T(""))
	, str_editFGHRScableLoss(_T(""))
	, str_comboFGHRSstore(_T(""))
	, str_comboWWHRSpresent(_T(""))
	, str_comboWWHRSType1(_T(""))
	, str_editTotalNumOfRooms(_T(""))
	, str_editNumMixerShowersWithBath1(_T(""))
	, str_editNumMixerShowersWithoutBath1(_T(""))
	, str_comboWWHRSType2(_T(""))
	, str_editNumMixerShowersWithBath2(_T(""))
	, str_editNumMixerShowersWithoutBath2(_T(""))
	, str_WWHRStype1Model(_T(""))
	, str_WWHRStype2Model(_T(""))
	, str_WWHRStype1ModelQualifier(_T(""))
	, str_WWHRStype2ModelQualifier(_T(""))
	, str_comboDetermineFGHRS(_T(""))
{
}

CDlg_Renewables1::~CDlg_Renewables1()
{
}

void CDlg_Renewables1::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_STATIC_1, m_labelMicroHydro);
	DDX_Control(pDX, IDC_EDIT1, m_edituHydroAnnualAvgHead);
	DDX_Text(pDX, IDC_EDIT1, str_edituHydroAnnualAvgHead);
	DDX_Control(pDX, IDC_EDIT4, m_edituHydroAnnualAvgFlow);
	DDX_Text(pDX, IDC_EDIT4, str_edituHydroAnnualAvgFlow);
	DDX_Control(pDX, IDC_EDIT5, m_edituHydroEff);
	DDX_Text(pDX, IDC_EDIT5, str_edituHydroEff);
	DDX_Control(pDX, IDC_EDIT11, m_editCHPheatToPowerRatio);
	DDX_Text(pDX, IDC_EDIT11, str_editCHPheatToPowerRatio);
	DDX_Control(pDX, IDC_EDIT12, m_editCHPElectricEff);
	DDX_Text(pDX, IDC_EDIT12, str_editCHPElectricEff);
	DDX_Control(pDX, IDC_COMBO1, m_comboCHPFuel);
	DDX_CBString(pDX, IDC_COMBO1, str_comboCHPFuel);
	DDX_Control(pDX, IDC_EDIT13, m_editCHPHeatingEff);
	DDX_Text(pDX, IDC_EDIT13, str_editCHPHeatingEff);
	DDX_Control(pDX, IDC_EDIT14, m_editCHPHeatingFraction);
	DDX_Text(pDX, IDC_EDIT14, str_editCHPHeatingFraction);
	DDX_Control(pDX, IDC_EDIT15, m_editMVHRThermalEff);
	DDX_Text(pDX, IDC_EDIT15, str_editMVHRThermalEff);
	DDX_Control(pDX, IDC_STATIC_3, m_labeluCHP);
	DDX_Control(pDX, IDC_STATIC_4, m_labelMVHR);
	DDX_Control(pDX, IDC_COMBO2, m_combouHydro);
	DDX_CBString(pDX, IDC_COMBO2, str_combouHydro);
	DDX_Control(pDX, IDC_COMBO11, m_combouCHPyn);
	DDX_CBString(pDX, IDC_COMBO11, str_combouCHPyn);
	DDX_Control(pDX, IDC_COMBO12, m_comboMVHR);
	DDX_CBString(pDX, IDC_COMBO12, str_comboMVHR);
	DDX_Control(pDX, IDC_STATIC_5, m_labelWWHRS);
	DDX_Control(pDX, IDC_STATIC_6, m_labelFGHRS);
	DDX_Control(pDX, IDC_STATIC_MVHR, m_labelMVHRinputs);
	DDX_Control(pDX, IDC_COMBO5, m_comboFGHRSpresent);
	DDX_CBString(pDX, IDC_COMBO5, str_comboFGHRSpresent);
	DDX_Control(pDX, IDC_EDIT2, m_editFGHRSstoreVolume);
	DDX_Control(pDX, IDC_EDIT3, m_editFGHRSusefulFracHtRec);
	DDX_Control(pDX, IDC_COMBO4, m_comboFGHRSfittedMain);
	DDX_Control(pDX, IDC_COMBO13, m_comboFGHRSfittedSec);
	DDX_Control(pDX, IDC_COMBO29, m_comboFGHRStype);
	DDX_Control(pDX, IDC_EDIT6, m_editFGHRStotFracHeatRec);
	DDX_Control(pDX, IDC_EDIT7, m_editFGHRSelecPowerReq);
	DDX_Control(pDX, IDC_COMBO30, m_comboFGHRSpvPoweredHt);
	DDX_Control(pDX, IDC_EDII_PVpeakPower, m_editFGHRSpvPkPower);
	DDX_Control(pDX, IDC_COMBO_PVcollectorOrient, m_comboFGHRSpvPkOrientation);
	DDX_Control(pDX, IDC_COMBO__PVcollectorTilt, m_comboFGHRSpvTilt);
	DDX_Control(pDX, IDC_COMBO_PVovershading, m_comboFGHRSpvOvershading);
	DDX_Control(pDX, IDC_EDII_PVpeakPower2, m_editFGHRScableLoss);
	DDX_Text(pDX, IDC_EDIT2, str_editFGHRSstoreVolume);
	DDX_Text(pDX, IDC_EDIT3, str_editFGHRSusefulFracHtRec);
	DDX_CBString(pDX, IDC_COMBO4, str_comboFGHRSfittedMain);
	DDX_CBString(pDX, IDC_COMBO13, str_comboFGHRSfittedSec);
	DDX_CBString(pDX, IDC_COMBO29, str_comboFGHRStype);
	DDX_Text(pDX, IDC_EDIT6, str_editFGHRStotFracHeatRec);
	DDX_Text(pDX, IDC_EDIT7, str_editFGHRSelecPowerReq);
	DDX_CBString(pDX, IDC_COMBO30, str_comboFGHRSpvPoweredHt);
	DDX_Text(pDX, IDC_EDII_PVpeakPower, str_editFGHRSpvPkPower);
	DDX_CBString(pDX, IDC_COMBO_PVcollectorOrient, str_comboFGHRSpvPkOrientation);
	DDX_CBString(pDX, IDC_COMBO__PVcollectorTilt, str_comboFGHRSpvTilt);
	DDX_CBString(pDX, IDC_COMBO_PVovershading, str_comboFGHRSpvOvershading);
	DDX_Text(pDX, IDC_EDII_PVpeakPower2, str_editFGHRScableLoss);
	DDX_Control(pDX, IDC_COMBO6, m_comboFGHRSstore);
	DDX_CBString(pDX, IDC_COMBO6, str_comboFGHRSstore);
	DDX_Control(pDX, IDC_COMBO31, m_comboWWHRSpresent);
	DDX_Control(pDX, IDC_COMBO32, m_comboWWHRSType1);
	DDX_Control(pDX, IDC_EDIT16, m_editTotalNumOfRooms);
	DDX_Control(pDX, IDC_EDIT17, m_editNumMixerShowersWithBath1);
	DDX_Control(pDX, IDC_EDIT18, m_editNumMixerShowersWithoutBath1);
	DDX_CBString(pDX, IDC_COMBO31, str_comboWWHRSpresent);
	DDX_CBString(pDX, IDC_COMBO32, str_comboWWHRSType1);
	DDX_Text(pDX, IDC_EDIT16, str_editTotalNumOfRooms);
	DDX_Text(pDX, IDC_EDIT17, str_editNumMixerShowersWithBath1);
	DDX_Text(pDX, IDC_EDIT18, str_editNumMixerShowersWithoutBath1);
	DDX_Control(pDX, IDC_COMBO33, m_comboWWHRSType2);
	DDX_CBString(pDX, IDC_COMBO33, str_comboWWHRSType2);
	DDX_Control(pDX, IDC_EDIT19, m_editNumMixerShowersWithBath2);
	DDX_Text(pDX, IDC_EDIT19, str_editNumMixerShowersWithBath2);
	DDX_Control(pDX, IDC_EDIT20, m_editNumMixerShowersWithoutBath2);
	DDX_Text(pDX, IDC_EDIT20, str_editNumMixerShowersWithoutBath2);
	DDX_Control(pDX, IDC_COMBO34, m_WWHRStype1Model);
	DDX_Control(pDX, IDC_COMBO35, m_WWHRStype2Model);
	DDX_Control(pDX, IDC_COMBO36, m_WWHRStype1ModelQualifier);
	DDX_Control(pDX, IDC_COMBO37, m_WWHRStype2ModelQualifier);
	DDX_CBString(pDX, IDC_COMBO34, str_WWHRStype1Model);
	DDX_CBString(pDX, IDC_COMBO35, str_WWHRStype2Model);
	DDX_CBString(pDX, IDC_COMBO36, str_WWHRStype1ModelQualifier);
	DDX_CBString(pDX, IDC_COMBO37, str_WWHRStype2ModelQualifier);
	DDX_Control(pDX, IDC_COMBO38, m_comboDetermineFGHRS);
	DDX_CBString(pDX, IDC_COMBO38, str_comboDetermineFGHRS);
}

BEGIN_MESSAGE_MAP(CDlg_Renewables1, CDialog)
	ON_EN_CHANGE(IDC_EDIT1, OnEnChangeEdit1)
	ON_EN_CHANGE(IDC_EDIT4, OnEnChangeEdit4)
	ON_EN_CHANGE(IDC_EDIT5, OnEnChangeEdit5)
	ON_EN_CHANGE(IDC_EDIT6, OnEnChangeEdit6)
	ON_EN_CHANGE(IDC_EDIT7, OnEnChangeEdit7)
	ON_EN_CHANGE(IDC_EDIT8, OnEnChangeEdit8)
	ON_EN_CHANGE(IDC_EDIT9, OnEnChangeEdit9)
	ON_EN_CHANGE(IDC_EDIT11, OnEnChangeEdit11)
	ON_EN_CHANGE(IDC_EDIT12, OnEnChangeEdit12)
	ON_CBN_SELCHANGE(IDC_COMBO1, OnCbnSelchangeCombo1)
	ON_EN_CHANGE(IDC_EDIT13, OnEnChangeEdit13)
	ON_EN_CHANGE(IDC_EDIT14, OnEnChangeEdit14)
	ON_EN_CHANGE(IDC_EDIT15, OnEnChangeEdit15)
	ON_CBN_SELCHANGE(IDC_COMBO2, OnCbnSelchangeCombo2)
	ON_CBN_SELCHANGE(IDC_COMBO4, OnCbnSelchangeCombo4)
	ON_CBN_SELCHANGE(IDC_COMBO11, OnCbnSelchangeCombo11)
	ON_CBN_SELCHANGE(IDC_COMBO12, OnCbnSelchangeCombo12)
	ON_CBN_SELCHANGE(IDC_COMBO5, OnCbnSelchangeCombo5)
	ON_EN_CHANGE(IDC_EDIT2, OnEnChangeEdit2)
	ON_EN_CHANGE(IDC_EDIT3, OnEnChangeEdit3)
	ON_CBN_SELCHANGE(IDC_COMBO13, OnCbnSelchangeCombo13)
	ON_CBN_SELCHANGE(IDC_COMBO29, OnCbnSelchangeCombo29)
	ON_CBN_SELCHANGE(IDC_COMBO30, OnCbnSelchangeCombo30)
	ON_EN_CHANGE(IDC_EDII_PVpeakPower, OnEnChangeEdiiPvpeakpower)
	ON_CBN_SELCHANGE(IDC_COMBO_PVcollectorOrient, OnCbnSelchangeComboPvcollectororient)
	ON_CBN_SELCHANGE(IDC_COMBO__PVcollectorTilt, OnCbnSelchangeCombo)
	ON_CBN_SELCHANGE(IDC_COMBO_PVovershading, OnCbnSelchangeComboPvovershading)
	ON_EN_CHANGE(IDC_EDII_PVpeakPower2, OnEnChangeEdiiPvpeakpower2)
	ON_CBN_SELCHANGE(IDC_COMBO6, OnCbnSelchangeCombo6)
	ON_CBN_SELCHANGE(IDC_COMBO31, OnCbnSelchangeCombo31)
	ON_CBN_SELCHANGE(IDC_COMBO32, OnCbnSelchangeCombo32)
	ON_EN_CHANGE(IDC_EDIT16, OnEnChangeEdit16)
	ON_EN_CHANGE(IDC_EDIT17, OnEnChangeEdit17)
	ON_EN_CHANGE(IDC_EDIT18, OnEnChangeEdit18)
	ON_EN_CHANGE(IDC_EDIT20, OnEnChangeEdit20)
	ON_CBN_SELCHANGE(IDC_COMBO33, OnCbnSelchangeCombo33)
	ON_CBN_SELCHANGE(IDC_COMBO35, OnCbnSelchangeCombo35)
	ON_EN_CHANGE(IDC_EDIT19, OnEnChangeEdit19)
	ON_CBN_SELCHANGE(IDC_COMBO34, OnCbnSelchangeCombo34)
	ON_CBN_SELCHANGE(IDC_COMBO36, OnCbnSelchangeCombo36)
	ON_CBN_SELCHANGE(IDC_COMBO37, OnCbnSelchangeCombo37)
	ON_CBN_SELCHANGE(IDC_COMBO38, OnCbnSelchangeCombo38)
END_MESSAGE_MAP()

// CDlg_Renewables1 message handlers

BOOL CDlg_Renewables1::OnInitDialog()
{
	CDialog::OnInitDialog();
	
	//---------------------------------------------------
	// LABELS
	//---------------------------------------------------
	CFont *m_Font1 = new CFont;
	m_Font1->CreatePointFont(90, "Arial Bold");
	
	m_labelMicroHydro.SetFont(m_Font1); 
	m_labelMicroHydro.SetTextColor(BLUE);  

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

	m_labelMVHR.SetFont(m_Font1); 
	m_labelMVHR.SetTextColor(BLUE); 
	
	m_labelWWHRS.SetFont(m_Font1); 
	m_labelWWHRS.SetTextColor(BLUE); 

	m_labelFGHRS.SetFont(m_Font1); 
	m_labelFGHRS.SetTextColor(BLUE); 
	
	m_labelMVHRinputs.SetTextColor(RED);

	//---------------------------------------------------
	// DROP DOWN MENUS
	//---------------------------------------------------
	int nIndex = 0;
	unsigned int i = 0;
	m_comboCHPFuel.ResetContent();
	for(i = 0; i < SAPcostTable_New.size(); i++)
	{
		if ((nIndex=m_comboCHPFuel.FindStringExact(nIndex, SAPcostTable_New[i].fuelType)) != CB_ERR)
		{
			; // Do nothing
		}
		else
		{
			// Fill fuel drop down menu
			m_comboCHPFuel.AddString(SAPcostTable_New[i].fuelType);
		}
	}

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

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

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

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

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

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

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

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

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

	m_comboFGHRSpvPkOrientation.InsertString(0,"South");
	m_comboFGHRSpvPkOrientation.InsertString(1,"SE/SW");
	m_comboFGHRSpvPkOrientation.InsertString(2,"E/W");
	m_comboFGHRSpvPkOrientation.InsertString(3,"NE/NW");
	m_comboFGHRSpvPkOrientation.InsertString(4,"North");

	m_comboFGHRSpvTilt.InsertString(0,"Horizontal");
	m_comboFGHRSpvTilt.InsertString(1,"30 deg");
	m_comboFGHRSpvTilt.InsertString(2,"45 deg");
	m_comboFGHRSpvTilt.InsertString(3,"60 deg");
	m_comboFGHRSpvTilt.InsertString(4,"Vertical");

	m_comboFGHRSpvOvershading.InsertString(0,"Heavy > 80%");
	m_comboFGHRSpvOvershading.InsertString(1,"Significant > 60%-80%");
	m_comboFGHRSpvOvershading.InsertString(2,"Modest 20%-60%");
	m_comboFGHRSpvOvershading.InsertString(3,"None or Very Little < 20%");

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

	WWHRSDataRead();	
	FGHRSDataRead();
	
	//---------------------------------------------------
	// If user selects File > New select defaults
	//---------------------------------------------------
	if(file_new_selected ==true)
	{
		WWHRSDataOnFileNew();	
		FGHRSDataOnFileNew();	
		SetAllValuesToDefault();		
	}
    
	DisplayValuesForRenewables1Dlg();
	ShowHideControlsForRenewables1Dlg();

	return TRUE;
}

void CDlg_Renewables1::FGHRSDataOnFileNew()
{
	//------------------------------------------------------
	// Load combi makes
	//------------------------------------------------------
	unsigned int i = 0;
	int nIndex = 0;

	for(i = 0; i < FGHRS_combiData.size(); i++)
		{
			if ((nIndex=m_comboFGHRStype.FindStringExact(nIndex, FGHRS_combiData[i].FGHRSname)) != CB_ERR)
			{
				; // Do nothing
			}
			else
			{
				m_comboFGHRStype.AddString(FGHRS_combiData[i].FGHRSname);
			}
		}

		// Select first selection as default
		m_comboFGHRStype.SetCurSel(0);
		UpdateData(TRUE);

		// Select first selection as FGHRS
		FGHRStype = str_comboFGHRStype;
}

void CDlg_Renewables1::WWHRSDataOnFileNew()
{
	//------------------------------------------------------
	// Load make
	//------------------------------------------------------
	unsigned int i = 0;
	int nIndex = 0;

	for(i = 0; i < WWHRSData_1.size(); i++)
	{
		if ((nIndex=m_comboWWHRSType1.FindStringExact(nIndex, WWHRSData_1[i].make)) != CB_ERR)
		{
			; // Do nothing
		}
		else
		{
			m_comboWWHRSType1.AddString(WWHRSData_1[i].make);
		}	

		if ((nIndex=m_comboWWHRSType2.FindStringExact(nIndex, WWHRSData_1[i].make)) != CB_ERR)
		{
			; // Do nothing
		}
		else
		{
			m_comboWWHRSType2.AddString(WWHRSData_1[i].make);
		}
	}

	// Select first selection for make1 and make2
	m_comboWWHRSType1.SetCurSel(0);
	m_comboWWHRSType2.SetCurSel(0);

	UpdateData(TRUE);

	WWHRS1Make = str_comboWWHRSType1;
	WWHRS2Make = str_comboWWHRSType2;

	//------------------------------------------------------
	// Load Brands for make 1 and make 2
	//------------------------------------------------------
	for(i = 0; i < WWHRSData_1.size(); i++)
	{
		if(strcmp(WWHRSData_1[i].make, WWHRS1Make)==0)
		{
			m_WWHRStype1Model.AddString(WWHRSData_1[i].model);
		}	
		if(strcmp(WWHRSData_1[i].make, WWHRS2Make)==0)
		{
			m_WWHRStype2Model.AddString(WWHRSData_1[i].model);
		}	
	}

	// Select first selection for brand1 and brand2
	m_WWHRStype1Model.SetCurSel(0);
	m_WWHRStype2Model.SetCurSel(0);

	UpdateData(TRUE);

	WWHRS1Model  = str_WWHRStype1Model;
	WWHRS2Model  = str_WWHRStype2Model;

	//------------------------------------------------------
	// Load model for brand 1 and brand 2
	//------------------------------------------------------
	for(i = 0; i < WWHRSData_1.size(); i++)
	{
		if(strcmp(WWHRSData_1[i].model, WWHRS1Model)==0)
		{
			m_WWHRStype1ModelQualifier.AddString(WWHRSData_1[i].modelQualifier);
		}	
		if(strcmp(WWHRSData_1[i].model, WWHRS2Model)==0)
		{
			m_WWHRStype2ModelQualifier.AddString(WWHRSData_1[i].modelQualifier);
		}
	}

	m_WWHRStype1ModelQualifier.SetCurSel(0);
	m_WWHRStype2ModelQualifier.SetCurSel(0);
	UpdateData(TRUE);

	WWHRS1ModelQualifier = str_WWHRStype1ModelQualifier;
	WWHRS2ModelQualifier = str_WWHRStype2ModelQualifier;
}

void CDlg_Renewables1::FGHRSDataRead()
{
	//------------------------------------------------------
	// Load combi 
	//------------------------------------------------------
	unsigned int i = 0;
	int nIndex = 0;

	for(i = 0; i < FGHRS_combiData.size(); i++)
		{
			if ((nIndex=m_comboFGHRStype.FindStringExact(nIndex, FGHRS_combiData[i].FGHRSname)) != CB_ERR)
			{
				; // Do nothing
			}
			else
			{
				m_comboFGHRStype.AddString(FGHRS_combiData[i].FGHRSname);
			}
		}

		// Select last known selection
		m_comboFGHRStype.SelectString(0,FGHRStype);
}

void CDlg_Renewables1::WWHRSDataRead()
{
	unsigned int i = 0;
	int nIndex = 0;

	//-------------------------------------------------------------------------------------
	// Load make for WWHRS 1 and WWHRS2
	//-------------------------------------------------------------------------------------
	for(i = 0; i < WWHRSData_1.size(); i++)
	{
		if ((nIndex=m_comboWWHRSType1.FindStringExact(nIndex, WWHRSData_1[i].make)) != CB_ERR)
		{
			; // Do nothing
		}
		else
		{
			m_comboWWHRSType1.AddString(WWHRSData_1[i].make);
		}	

		if ((nIndex=m_comboWWHRSType2.FindStringExact(nIndex, WWHRSData_1[i].make)) != CB_ERR)
		{
			; // Do nothing
		}
		else
		{
			m_comboWWHRSType2.AddString(WWHRSData_1[i].make);
		}
	}

	// Select values for make 1 and make 2 
	m_comboWWHRSType1.SelectString(0,WWHRS1Make);
	m_comboWWHRSType2.SelectString(0,WWHRS2Make);

	//-------------------------------------------------------------------------------------
	// Delete items from drop-down menus for model and model qualifier
	//-------------------------------------------------------------------------------------
	m_WWHRStype1Model.ResetContent();
	m_WWHRStype1ModelQualifier.ResetContent();
	m_WWHRStype2Model.ResetContent();
	m_WWHRStype2ModelQualifier.ResetContent();

	//-------------------------------------------------------------------------------------
	//Load models for make 1 and make 2
	//-------------------------------------------------------------------------------------
	for(i = 0; i < WWHRSData_1.size(); i++)
	{
		if(strcmp(WWHRSData_1[i].make, WWHRS1Make)==0)
		{
			m_WWHRStype1Model.AddString(WWHRSData_1[i].model);
		}	
		if(strcmp(WWHRSData_1[i].make, WWHRS2Make)==0)
		{
			m_WWHRStype2Model.AddString(WWHRSData_1[i].model);
		}
	}

	// Select values for model 1 and model 2 
	m_WWHRStype1Model.SelectString(0,WWHRS1Model);
	m_WWHRStype2Model.SelectString(0,WWHRS2Model);

	//-------------------------------------------------------------------------------------
	//Load model qualifiers for model 1 and model 2
	//-------------------------------------------------------------------------------------
	for(i = 0; i < WWHRSData_1.size(); i++)
	{
		if(strcmp(WWHRSData_1[i].model, WWHRS1Model)==0)
		{
			m_WWHRStype1ModelQualifier.AddString(WWHRSData_1[i].modelQualifier);
		}
		if(strcmp(WWHRSData_1[i].model, WWHRS2Model)==0)
		{
			m_WWHRStype2ModelQualifier.AddString(WWHRSData_1[i].modelQualifier);
		}
	}

	// Select values for model 1 and model 2 
	m_WWHRStype1Model.SelectString(0,WWHRS1ModelQualifier);
	m_WWHRStype2Model.SelectString(0,WWHRS2ModelQualifier);

}
void CDlg_Renewables1::ShowHideControlsForRenewables1Dlg()
{
	if(strcmp(uHydroyn,"Yes") ==0)
	{
		m_edituHydroAnnualAvgHead.EnableWindow(TRUE);
		m_edituHydroAnnualAvgFlow.EnableWindow(TRUE);
		m_edituHydroEff.EnableWindow(TRUE);
	}
	else if(strcmp(uHydroyn,"No") ==0)
	{
		m_edituHydroAnnualAvgHead.EnableWindow(FALSE);
		m_edituHydroAnnualAvgFlow.EnableWindow(FALSE);
		m_edituHydroEff.EnableWindow(FALSE);
	}

	if(strcmp(uCHPyn,"Yes") ==0)
	{
		m_editCHPheatToPowerRatio.EnableWindow(TRUE);
		m_editCHPElectricEff.EnableWindow(TRUE);
		m_comboCHPFuel.EnableWindow(TRUE);
		m_editCHPHeatingEff.EnableWindow(TRUE);
		m_editCHPHeatingFraction.EnableWindow(TRUE);
	}
	else if(strcmp(uCHPyn,"No") ==0)
	{
		m_editCHPheatToPowerRatio.EnableWindow(FALSE);
		m_editCHPElectricEff.EnableWindow(FALSE);
		m_comboCHPFuel.EnableWindow(FALSE);
		m_editCHPHeatingEff.EnableWindow(FALSE);
		m_editCHPHeatingFraction.EnableWindow(FALSE);		
	}

	if(strcmp(MVHRyn,"Yes") ==0)
	{
		m_editMVHRThermalEff.EnableWindow(TRUE);
		m_labelMVHRinputs.ShowWindow(TRUE);
	}
	else
	{
		m_editMVHRThermalEff.EnableWindow(FALSE);
		m_labelMVHRinputs.ShowWindow(FALSE);
	}

	if(strcmp(FGHRSpresent ,"No")==0)
	{
		m_comboFGHRSstore.EnableWindow(FALSE);	
		m_editFGHRSstoreVolume.EnableWindow(FALSE);	
		m_editFGHRSusefulFracHtRec.EnableWindow(FALSE);	
		m_comboFGHRSfittedMain.EnableWindow(FALSE);	
		m_comboFGHRSfittedSec.EnableWindow(FALSE);	
		m_comboFGHRStype.EnableWindow(FALSE);	
		m_comboDetermineFGHRS.EnableWindow(FALSE);	
		m_editFGHRStotFracHeatRec.EnableWindow(FALSE);	
		m_editFGHRSelecPowerReq.EnableWindow(FALSE);	
		m_comboFGHRSpvPoweredHt.EnableWindow(FALSE);	
		m_editFGHRSpvPkPower.EnableWindow(FALSE);	
		m_comboFGHRSpvPkOrientation.EnableWindow(FALSE);	
		m_comboFGHRSpvTilt.EnableWindow(FALSE);	
		m_comboFGHRSpvOvershading.EnableWindow(FALSE);	
		m_editFGHRScableLoss.EnableWindow(FALSE);	
	}
	else
	{
		// Proceed only if main heating type is boiler, main fule is mains gas, LOG or Oil
		// and boiler  is condensing 
		if((strcmp(mainHtType,"Boiler") ==0) && 
			((strcmp(mainFuel,"Mains gas") ==0) || (strcmp(mainFuel,"LPG") ==0)|| (strcmp(mainFuel,"Oil") ==0)) &&
			((strcmp(boilerType,"Condensing") ==0) ||(strcmp(boilerType,"Condensing combi") ==0)))
		{
			m_comboFGHRSstore.EnableWindow(TRUE);	

			// If there is a FGHRS heat store, ask for volume of store else ask for useful fraction
			if(strcmp(FGHRSstore,"Yes") ==0)
			{				
				m_editFGHRSstoreVolume.EnableWindow(TRUE);
				m_editFGHRSusefulFracHtRec.EnableWindow(FALSE);

				// Only editable if there is a secondary heating system
				if(strcmp(isThereSecHeating,"Yes") ==0)
				{
					m_comboFGHRSfittedMain.EnableWindow(TRUE);
					m_comboFGHRSfittedSec.EnableWindow(TRUE);
				}
				else
				{
					m_comboFGHRSfittedMain.EnableWindow(FALSE);
					m_comboFGHRSfittedSec.EnableWindow(FALSE);
				}

				m_comboFGHRStype.EnableWindow(TRUE);
				m_comboDetermineFGHRS.EnableWindow(TRUE);	
				m_editFGHRStotFracHeatRec.EnableWindow(TRUE);
				m_editFGHRSelecPowerReq.EnableWindow(TRUE);	

				m_comboFGHRSpvPoweredHt.EnableWindow(TRUE);

				// If there is PV powered heating make editable the following
				if(strcmp(FGHRSpvPoweredHt,"Yes") ==0)
				{
					m_editFGHRSpvPkPower.EnableWindow(TRUE);
					m_comboFGHRSpvPkOrientation.EnableWindow(TRUE);
					m_comboFGHRSpvTilt.EnableWindow(TRUE);
					m_comboFGHRSpvOvershading.EnableWindow(TRUE);
					m_editFGHRScableLoss.EnableWindow(TRUE);
				}
				else
				{
					m_editFGHRSpvPkPower.EnableWindow(FALSE);
					m_comboFGHRSpvPkOrientation.EnableWindow(FALSE);
					m_comboFGHRSpvTilt.EnableWindow(FALSE);
					m_comboFGHRSpvOvershading.EnableWindow(FALSE);
					m_editFGHRScableLoss.EnableWindow(FALSE);
				}
			}
			else // If no store
			{
				m_editFGHRSstoreVolume.EnableWindow(FALSE);
				m_editFGHRSusefulFracHtRec.EnableWindow(TRUE);
				m_comboFGHRSfittedMain.EnableWindow(FALSE);
				m_comboFGHRSfittedSec.EnableWindow(FALSE);
				m_comboFGHRStype.EnableWindow(FALSE);
				m_comboDetermineFGHRS.EnableWindow(FALSE);	
				m_editFGHRStotFracHeatRec.EnableWindow(FALSE);
				m_editFGHRSelecPowerReq.EnableWindow(FALSE);
				m_editFGHRSpvPkPower.EnableWindow(FALSE);
				m_comboFGHRSpvPkOrientation.EnableWindow(FALSE);
				m_comboFGHRSpvTilt.EnableWindow(FALSE);
				m_comboFGHRSpvOvershading.EnableWindow(FALSE);
				m_editFGHRScableLoss.EnableWindow(FALSE);
			}	
		}
		else
		{
			MessageBox("This option is only available if main heating is form a boiler\nfuel type is mains gas, LPG or oil and main heating boiler \nis of condensing type.","Help",MB_OK);
			m_comboFGHRSpresent.SelectString(0,"No");
			m_comboFGHRSstore.EnableWindow(FALSE);	
			m_editFGHRSstoreVolume.EnableWindow(FALSE);	
			m_editFGHRSusefulFracHtRec.EnableWindow(FALSE);	
			m_comboFGHRSfittedMain.EnableWindow(FALSE);	
			m_comboFGHRSfittedSec.EnableWindow(FALSE);	
			m_comboFGHRStype.EnableWindow(FALSE);	
			m_comboDetermineFGHRS.EnableWindow(FALSE);
			m_editFGHRStotFracHeatRec.EnableWindow(FALSE);	
			m_editFGHRSelecPowerReq.EnableWindow(FALSE);	
			m_comboFGHRSpvPoweredHt.EnableWindow(FALSE);	
			m_editFGHRSpvPkPower.EnableWindow(FALSE);	
			m_comboFGHRSpvPkOrientation.EnableWindow(FALSE);	
			m_comboFGHRSpvTilt.EnableWindow(FALSE);	
			m_comboFGHRSpvOvershading.EnableWindow(FALSE);	
			m_editFGHRScableLoss.EnableWindow(FALSE);	
		}	
	}

	if(strcmp(WWHRSpresent,"Yes")==0)
	{
		m_editTotalNumOfRooms.EnableWindow(TRUE);
		m_comboWWHRSType1.EnableWindow(TRUE);
		m_editNumMixerShowersWithBath1.EnableWindow(TRUE);
		m_editNumMixerShowersWithoutBath1.EnableWindow(TRUE);
		m_WWHRStype1Model.EnableWindow(TRUE);
		m_WWHRStype1ModelQualifier.EnableWindow(TRUE);
		m_comboWWHRSType2.EnableWindow(TRUE);
		m_editNumMixerShowersWithBath2.EnableWindow(TRUE);
		m_editNumMixerShowersWithoutBath2.EnableWindow(TRUE);
		m_WWHRStype2Model.EnableWindow(TRUE);
		m_WWHRStype2ModelQualifier.EnableWindow(TRUE);
	}
	else
	{
		m_editTotalNumOfRooms.EnableWindow(FALSE);
		m_comboWWHRSType1.EnableWindow(FALSE);
		m_editNumMixerShowersWithBath1.EnableWindow(FALSE);
		m_editNumMixerShowersWithoutBath1.EnableWindow(FALSE);
		m_WWHRStype1Model.EnableWindow(FALSE);
		m_WWHRStype1ModelQualifier.EnableWindow(FALSE);
		m_comboWWHRSType2.EnableWindow(FALSE);
		m_editNumMixerShowersWithBath2.EnableWindow(FALSE);
		m_editNumMixerShowersWithoutBath2.EnableWindow(FALSE);
		m_WWHRStype2Model.EnableWindow(FALSE);
		m_WWHRStype2ModelQualifier.EnableWindow(FALSE);
	}

}

void CDlg_Renewables1::DisplayValuesForRenewables1Dlg()
{
	if(mechVentType == "Balanced (with heat recovery)")
	{
		MVHRyn = "Yes";
	}
	str_combouHydro.Format("%s",uHydroyn);
	str_combouCHPyn.Format("%s",uCHPyn);
	str_comboMVHR.Format("%s",MVHRyn);

	str_edituHydroAnnualAvgHead.Format("%.2f",uHydroAnnualAvgHead);
	str_edituHydroAnnualAvgFlow.Format("%.2f",uHydroAnnualAvgFlow);
	str_edituHydroEff.Format("%.2f",uHydroEff);

	str_editCHPheatToPowerRatio.Format("%.2f",uCHPheatToPowerRatio);
	str_editCHPElectricEff.Format("%.2f",uCHPElectricEff);
	str_comboCHPFuel.Format("%s",CHPFuel);
	str_editCHPHeatingEff.Format("%.2f",uCHPHeatingEff);
	str_editCHPHeatingFraction.Format("%.2f",uCHPHeatingFraction);

	str_editMVHRThermalEff.Format("%.2f",MVHRThermalEff);

	str_comboFGHRSpresent.Format("%s",FGHRSpresent);
	str_comboFGHRSstore.Format("%s",FGHRSstore);
	str_editFGHRSstoreVolume.Format("%.2f",FGHRSstoreVolume);
	str_editFGHRSusefulFracHtRec.Format("%.2f",FGHRSusefulFracHtRec_kf1);
	str_comboFGHRSfittedMain.Format("%s",FGHRSfittedMain);
	str_comboFGHRSfittedSec.Format("%s",FGHRSfittedSec);
	str_comboFGHRStype.Format("%s",FGHRStype);
	str_comboDetermineFGHRS.Format("%s",determineFGHRStype);
	str_editFGHRStotFracHeatRec.Format("%.2f",FGHRStotFracHeatRec_kf2);
	str_editFGHRSelecPowerReq.Format("%.2f",FGHRSauxelec);
	str_comboFGHRSpvPoweredHt.Format("%s",FGHRSpvPoweredHt);
	str_editFGHRSpvPkPower.Format("%.2f",FGHRSpvPkPower);
	str_comboFGHRSpvPkOrientation.Format("%s",FGHRSpvOrientation);
	str_comboFGHRSpvTilt.Format("%s",FGHRSpvTilt);
	str_comboFGHRSpvOvershading.Format("%s",FGHRSpvOvershading);
	str_editFGHRScableLoss.Format("%.2f",FGHRScableLoss);	

	str_comboWWHRSpresent.Format("%s",WWHRSpresent);
	str_comboWWHRSType1.Format("%s",WWHRS1Make);
	str_editTotalNumOfRooms.Format("%d",WWHRSnumOfRooms);
    str_editNumMixerShowersWithBath1.Format("%d",WWHRSnumMixerShowersWithBath1);
    str_editNumMixerShowersWithoutBath1.Format("%d",WWHRSnumMixerShowersWithoutBath1);
	str_WWHRStype1Model.Format("%s",WWHRS1Model);
	str_WWHRStype1ModelQualifier.Format("%s",WWHRS1ModelQualifier);

	str_comboWWHRSType2.Format("%s",WWHRS2Make);
    str_editNumMixerShowersWithBath2.Format("%d",WWHRSnumMixerShowersWithBath2);
    str_editNumMixerShowersWithoutBath2.Format("%d",WWHRSnumMixerShowersWithoutBath2);
	str_WWHRStype2ModelQualifier.Format("%s",WWHRS2Model);
	str_WWHRStype2ModelQualifier.Format("%s",WWHRS2ModelQualifier);

	UpdateData(FALSE);
}

void CDlg_Renewables1::ReadInputsFromRenewables1Dlg()
{
	UpdateData(TRUE);

	uHydroyn = str_combouHydro;
	uCHPyn   = str_combouCHPyn;
	MVHRyn   = str_comboMVHR;

	uHydroAnnualAvgHead = atof(str_edituHydroAnnualAvgHead);
	uHydroAnnualAvgFlow = atof(str_edituHydroAnnualAvgFlow);
	uHydroEff           = atof(str_edituHydroEff);

	uCHPheatToPowerRatio = atof(str_editCHPheatToPowerRatio);
	uCHPElectricEff      = atof(str_editCHPElectricEff);
	CHPFuel              = str_comboCHPFuel;
	uCHPHeatingEff       = atof(str_editCHPHeatingEff);
	uCHPHeatingFraction  = atof(str_editCHPHeatingFraction);

	MVHRThermalEff      = atof(str_editMVHRThermalEff);	

	FGHRSpresent         = str_comboFGHRSpresent;
	FGHRSstore			 = str_comboFGHRSstore;
	FGHRSstoreVolume     = atof(str_editFGHRSstoreVolume);
	FGHRSusefulFracHtRec_kf1 = atof(str_editFGHRSusefulFracHtRec);
	FGHRSfittedMain      = str_comboFGHRSfittedMain;
	FGHRSfittedSec       = str_comboFGHRSfittedSec;
	FGHRStype            = str_comboFGHRStype;
	determineFGHRStype   = str_comboDetermineFGHRS;
	FGHRStotFracHeatRec_kf2  = atof(str_editFGHRStotFracHeatRec);
	FGHRSauxelec         = atof(str_editFGHRSelecPowerReq);
	FGHRSpvPoweredHt     = str_comboFGHRSpvPoweredHt;
	FGHRSpvPkPower       = atof(str_editFGHRSpvPkPower);
	FGHRSpvOrientation = str_comboFGHRSpvPkOrientation;
	FGHRSpvTilt          = str_comboFGHRSpvTilt;
	FGHRSpvOvershading   = str_comboFGHRSpvOvershading;
	FGHRScableLoss       = atof(str_editFGHRScableLoss);

	WWHRSpresent    = str_comboWWHRSpresent;
	WWHRS1Make       = str_comboWWHRSType1;
	WWHRSnumOfRooms = atoi(str_editTotalNumOfRooms);
	WWHRSnumMixerShowersWithBath1    = atoi(str_editNumMixerShowersWithBath1);
	WWHRSnumMixerShowersWithoutBath1 = atoi(str_editNumMixerShowersWithoutBath1);
	WWHRS1Model = str_WWHRStype1Model;
	WWHRS1ModelQualifier = str_WWHRStype1ModelQualifier;

	WWHRS2Make       = str_comboWWHRSType2;
	WWHRSnumMixerShowersWithBath2   = atoi(str_editNumMixerShowersWithBath2);
	WWHRSnumMixerShowersWithoutBath2 = atoi(str_editNumMixerShowersWithoutBath2);
	WWHRS2Model = str_WWHRStype2Model;
	WWHRS2ModelQualifier = str_WWHRStype2ModelQualifier;

	//-------------------------------------------------------------------
	// These variables correspond to check btton logic in Results window
	//-------------------------------------------------------------------
	if(uHydroyn == "No")
		chkuHydro = 0;
	else
		chkuHydro = 1;

	if(uCHPyn == "No")
		chkuCHP = 0;
	else
		chkuCHP = 1;

	if(FGHRSpresent == "No")
		chkFGHRS = 0;
	else
		chkFGHRS = 1;

	if (WWHRSpresent == "No")
		chkWWHRS = 0;
	else
		chkWWHRS = 1;
	
	if(MVHRyn == "No")
	{
		mechVentType = "Not present (natural)";
		chkMVHR = 0;
	}
	else
	{
		mechVentType = "Balanced (with heat recovery)";
		chkMVHR = 1;
	}

	ShowHideControlsForRenewables1Dlg();
}
void CDlg_Renewables1::OnEnChangeEdit1()
{
	ReadInputsFromRenewables1Dlg();
						
	// Check limit
	isCheckRange_uHydroAnnualAvgHead    = true;	
}

void CDlg_Renewables1::OnEnChangeEdit4()
{
	ReadInputsFromRenewables1Dlg();
						
	// Check limit
	isCheckRange_uHydroAnnualAvgFlow    = true;	
}

void CDlg_Renewables1::OnEnChangeEdit5()
{
	ReadInputsFromRenewables1Dlg();
						
	// Check limit
	isCheckRange_uHydroEff    = true;	
}

void CDlg_Renewables1::OnEnChangeEdit6()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnEnChangeEdit7()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnEnChangeEdit8()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnEnChangeEdit9()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnEnChangeEdit11()
{
	ReadInputsFromRenewables1Dlg();
	
	// Check limit
	isCheckRange_uCHPheatToPowerRatio    = true;	
}

void CDlg_Renewables1::OnEnChangeEdit12()
{
	ReadInputsFromRenewables1Dlg();
	
	// Check limit
	isCheckRange_uCHPElectricEff   = true;	
}

void CDlg_Renewables1::OnCbnSelchangeCombo1()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnEnChangeEdit13()
{
	ReadInputsFromRenewables1Dlg();
	
	// Check limit
	isCheckRange_uCHPHeatingEff   = true;	
}

void CDlg_Renewables1::OnEnChangeEdit14()
{
	ReadInputsFromRenewables1Dlg();
	
	// Check limit
	isCheckRange_uCHPHeatingFraction  = true;	
}

void CDlg_Renewables1::OnEnChangeEdit15()
{
	ReadInputsFromRenewables1Dlg();
	
	// Check limit
	isCheckRange_MVHRThermalEff  = true;	
}

void CDlg_Renewables1::OnCbnSelchangeCombo2()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnCbnSelchangeCombo4()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnCbnSelchangeCombo11()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnCbnSelchangeCombo12()
{
	ReadInputsFromRenewables1Dlg();
}

BOOL CDlg_Renewables1::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_Renewables1::OnCbnSelchangeCombo5()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnEnChangeEdit2()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnEnChangeEdit3()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnCbnSelchangeCombo13()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnCbnSelchangeCombo29()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnCbnSelchangeCombo30()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnEnChangeEdiiPvpeakpower()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnCbnSelchangeComboPvcollectororient()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnCbnSelchangeCombo()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnCbnSelchangeComboPvovershading()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnEnChangeEdiiPvpeakpower2()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnCbnSelchangeCombo6()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnCbnSelchangeCombo31()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnCbnSelchangeCombo32()
{
	UpdateData(TRUE);
	unsigned int i = 0;
	CString temp;

	WWHRS1Make = str_comboWWHRSType1;	

	//----------------------------------------
	// Change model
	//----------------------------------------
	m_WWHRStype1Model.ResetContent();	

	//Load Brands for make 1 and make 2
	for(i = 0; i < WWHRSData_1.size(); i++)
	{
		if(strcmp(WWHRSData_1[i].make, WWHRS1Make)==0)
		{
			temp = WWHRSData_1[i].model;
			m_WWHRStype1Model.AddString(WWHRSData_1[i].model);
		}			
	}
	WWHRS1Model = str_WWHRStype1Model;
	m_WWHRStype1Model.SetCurSel(0);
	
	UpdateData(FALSE);

	//----------------------------------------
	// Change modelQualifier
	//----------------------------------------
	m_WWHRStype1ModelQualifier.ResetContent();
	// Load Model for model 1 and 2
	for(i = 0; i < WWHRSData_1.size(); i++)
	{
		if(strcmp(WWHRSData_1[i].model, temp)==0)
		{
			m_WWHRStype1ModelQualifier.AddString(WWHRSData_1[i].modelQualifier);
		}
	}
	WWHRS1ModelQualifier = str_WWHRStype1ModelQualifier;
	m_WWHRStype1ModelQualifier.SetCurSel(0);

	UpdateData(FALSE);

	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnEnChangeEdit16()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnEnChangeEdit17()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnEnChangeEdit18()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnEnChangeEdit20()
{
	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnCbnSelchangeCombo33()
{
	UpdateData(TRUE);
	unsigned int i = 0;
	CString temp;

	WWHRS2Make = str_comboWWHRSType2;	

	//----------------------------------------
	// Change model
	//----------------------------------------
	m_WWHRStype2Model.ResetContent();	

	//Load Brands for make 1 and make 2
	for(i = 0; i < WWHRSData_1.size(); i++)
	{
		if(strcmp(WWHRSData_1[i].make, WWHRS2Make)==0)
		{
			temp = WWHRSData_1[i].model;
			m_WWHRStype2Model.AddString(WWHRSData_1[i].model);
		}			
	}
	WWHRS2Model = str_WWHRStype2Model;
	m_WWHRStype2Model.SetCurSel(0);
	
	UpdateData(FALSE);

	//----------------------------------------
	// Change modelQualifier
	//----------------------------------------
	m_WWHRStype2ModelQualifier.ResetContent();
	// Load Model for model 1 and 2
	for(i = 0; i < WWHRSData_1.size(); i++)
	{
		if(strcmp(WWHRSData_1[i].model, temp)==0)
		{
			m_WWHRStype2ModelQualifier.AddString(WWHRSData_1[i].modelQualifier);
		}
	}
	WWHRS2ModelQualifier = str_WWHRStype2ModelQualifier;
	m_WWHRStype2ModelQualifier.SetCurSel(0);

	UpdateData(FALSE);

	ReadInputsFromRenewables1Dlg();
	
}

void CDlg_Renewables1::OnCbnSelchangeCombo35()
{
	UpdateData(TRUE);

	WWHRS2Model = str_WWHRStype2Model;

	unsigned int i = 0;
	//----------------------------------------
	// Change modelQualifier
	//----------------------------------------
	m_WWHRStype2ModelQualifier.ResetContent();


	for(i = 0; i < WWHRSData_1.size(); i++)
	{
		if(strcmp(WWHRSData_1[i].model, WWHRS2Model)==0)
		{
			m_WWHRStype2ModelQualifier.AddString(WWHRSData_1[i].modelQualifier);
		}
	}
	m_WWHRStype2ModelQualifier.SetCurSel(0);
	WWHRS2ModelQualifier = str_WWHRStype2ModelQualifier;	

	UpdateData(FALSE);

	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnEnChangeEdit19()
{
	ReadInputsFromRenewables1Dlg();
}
void CDlg_Renewables1::OnCbnSelchangeCombo34()
{
	UpdateData(TRUE);

	WWHRS1Model = str_WWHRStype1Model;

	unsigned int i = 0;
	//----------------------------------------
	// Change modelQualifier
	//----------------------------------------
	m_WWHRStype1ModelQualifier.ResetContent();


	for(i = 0; i < WWHRSData_1.size(); i++)
	{
		if(strcmp(WWHRSData_1[i].model, WWHRS1Model)==0)
		{
			m_WWHRStype1ModelQualifier.AddString(WWHRSData_1[i].modelQualifier);
		}
	}
	m_WWHRStype1ModelQualifier.SetCurSel(0);
	WWHRS1ModelQualifier = str_WWHRStype1ModelQualifier;	

	UpdateData(FALSE);

	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnCbnSelchangeCombo36()
{
	UpdateData(TRUE);

	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnCbnSelchangeCombo37()
{
	UpdateData(TRUE);

	ReadInputsFromRenewables1Dlg();
}

void CDlg_Renewables1::OnCbnSelchangeCombo38()
{
	ReadInputsFromRenewables1Dlg();
}
