//Luiheids-syndroom-functie
function $(id){
	return document.getElementById(id);
}
//Zo kunnen we het object Noemi aanspreken
var Noemi = new Noemi();
//beschrijving van het object Noemi
function Noemi(){
	//Deze ID wordt gebruikt om alles uniek te maken, kan veranderd worden indien er duplicated ID's zouden bestaan met andere scripts
	var UID = "noemi";
	//Hierin houden we het aantal Watt bij
	this.resultaat = 0;
	//hierin houden we bij als we in standaard zitten of niet
	this.standaard = false;
	//In de volgende variabelen houden we de text bij die wordt gebruikt in de applicatie
	var text0 = "";
	var text1 = "How much electricity do you use per month? <br>(Look at your electric bill from the past 6 months and find the average number of Kilowatt hour (KWH) per month). <br>OR USE THE TECHNICAL PLANNING AID BELOW.<br>";      
	var text2 = " KWH/Month<br>";
	var text3 = "Use a load EVALUATION WORKSHEET TO CALCULATE<br>";
	var text4 = " What percentage of your house/business power do you want to generate with Solar Power?<br>";
	var text5 = " (put in any number from 1% to 100%)<br>";
	var text6 = "How many peak sun hours do you get per day?<br>";
	var text7 = "(Typically between 6-10 hours in Africa)<br>";
	var text8 = " HOURS<br>";
	var text9 = "<br>Minimum system size<br>";
	var text10 = "kWp";
	//initialiseerd de applicatie 
this.ini = function(){ this.setHTML(this.getUitgebreideForm()); 
} 
this.getStandaardForm = function (){ 
return this.getHoofd() + this.getVraagA() + this.getAntwoord(); 
} 
this.getUitgebreideForm = function(){ return "a) " + this.getVraagA() + "<br />b) "+ this.getVraagB()+"<br />c) "+this.getVraagC()+ this.getAntwoord(); 
}

	this.getHoofd = function (){
		if(this.standaard == true){
			help = "";
		}else{
			help = " checked = 'checked' ";
		}
		return "<h3>" + text0 + "</h3><input id='"+UID+"formVorm' "+help+"type='checkbox' onChange='javascript:Noemi.updateForm();'/>" + text3 + "<br />";
	}
	this.getVraagA = function(){
		return text1 + "<br /><input id='"+UID+"vraagA' type='text' onChange='javascript:Noemi.updateResultaat();'/>" + text2;
	}
	this.getVraagB = function(){
		return text4 + "<br /><input id='"+UID+"vraagB' type='text' onChange='javascript:Noemi.updateResultaat();'/>" + text5;
	}
	this.getVraagC = function(){
		return text6 + text7 + "<br /><input id='"+UID+"vraagC' type='text' onChange='javascript:Noemi.updateResultaat();'/>" + text8;
	}
	this.getAntwoord = function(){
		return "<br /><fieldset><legend>" + text9 +"</legend><span id='"+UID+"resultaat'>" + this.resultaat+ "</span> "+ text10 + "</fieldset>";
	}
	this.setHTML = function(html){
		$(UID +"MainDiv").innerHTML = html;
	}
	this.updateForm = function(){
		if($(UID+"formVorm").checked == true){
			this.standaard = false;
			this.setHTML(this.getUitgebreideForm());
			
		}else{
			this.standaard = true;
			this.setHTML(this.getStandaardForm());
			
		}
	}
	this.updateResultaat = function(){
		if(this.standaard){	
			this.resultaat = $(UID+"vraagA").value/30;
			
		}else{
			this.resultaat = $(UID+"vraagA").value/30/$(UID+"vraagC").value*$(UID+"vraagB").value/100;
		}
		
		$(UID+"resultaat").innerHTML = this.resultaat;
	}
	this.mute = function(){}

}