 var hypRente = 4.7;
 var woonquote = 0;
/* Postbank 2008
 if (hypRente <= 4.5) {renteCol = 1;}
 if (hypRente > 4.5  && hypRente <= 5.0) {renteCol = 2;}
 if (hypRente > 5.0  && hypRente <= 5.5) {renteCol = 3;}
 if (hypRente > 5.5  && hypRente <= 6.0) {renteCol = 4;}
 if (hypRente > 6.0) {renteCol = 5;}
*/
 if (hypRente <= 5.0) {renteCol = 1;}
 if (hypRente > 5.0  && hypRente <= 5.5) {renteCol = 2;}
 if (hypRente > 5.5  && hypRente <= 6.0) {renteCol = 3;}
 if (hypRente > 6.0  && hypRente <= 6.5) {renteCol = 4;}
 if (hypRente > 6.5) {renteCol = 5;}

/*

													0 => Toetsinkomen
													1 => T/m 5,00%
													2 => 5,01% t/m 5,50%
													3 => 5,51% t/m 6,50%
													4 => 6,01% t/m 6,50%
													5 => 6,51% en hoger
*/


var woonquotes = new Array();
var i = -1;
/* WoonQuotes NHG 2010
 * BRON: http://www.nhg.nl/fileadmin/user_upload/Documenten/Voorwaarden_en_Normen_2010/Voorwaarden_en_Normen_2010.pdf
 */
woonquotes[i++] = new Array(    0, 28.5, 28.8, 29.1, 29.4, 29.7);
woonquotes[i++] = new Array(18500, 28.5, 28.8, 29.1, 29.4, 29.7);
woonquotes[i++] = new Array(19000, 29.1, 29.4, 29.7, 30.0, 30.3);
woonquotes[i++] = new Array(19500, 29.4, 29.9, 30.4, 30.9, 31.4);
woonquotes[i++] = new Array(20000, 29.7, 30.3, 30.9, 31.5, 32.1);
woonquotes[i++] = new Array(20500, 30.0, 30.7, 31.4, 32.1, 32.8);
woonquotes[i++] = new Array(21000, 30.3, 31.0, 31.7, 32.4, 33.1);
woonquotes[i++] = new Array(21500, 30.5, 31.2, 31.9, 32.6, 33.3);
woonquotes[i++] = new Array(22000, 30.6, 31.4, 32.2, 33.0, 33.8);
woonquotes[i++] = new Array(22500, 30.7, 31.5, 32.3, 33.1, 33.9);
woonquotes[i++] = new Array(23000, 30.8, 31.6, 32.4, 33.2, 34.0);
woonquotes[i++] = new Array(23500, 30.8, 31.7, 32.6, 33.5, 34.4);
woonquotes[i++] = new Array(41500, 30.9, 31.8, 32.7, 33.6, 34.5);
woonquotes[i++] = new Array(42500, 31.0, 31.9, 32.8, 33.7, 34.6);
woonquotes[i++] = new Array(43000, 31.1, 32.0, 32.9, 33.8, 34.7);
woonquotes[i++] = new Array(43500, 31.3, 32.2, 33.1, 34.1, 35.1);
woonquotes[i++] = new Array(44000, 31.4, 32.4, 33.4, 34.4, 35.4);
woonquotes[i++] = new Array(44500, 31.6, 32.6, 33.6, 34.6, 35.6);
woonquotes[i++] = new Array(45000, 31.7, 32.7, 33.7, 34.7, 35.7);
woonquotes[i++] = new Array(45500, 31.8, 32.8, 33.8, 34.8, 35.8);
woonquotes[i++] = new Array(46000, 32.0, 33.0, 34.0, 35.0, 36.0);
woonquotes[i++] = new Array(46500, 32.1, 33.1, 34.1, 35.1, 36.1);
woonquotes[i++] = new Array(47000, 32.2, 33.2, 34.2, 35.2, 36.2);
woonquotes[i++] = new Array(47500, 32.3, 33.3, 34.3, 35.3, 36.3);
woonquotes[i++] = new Array(48000, 32.4, 33.4, 34.4, 35.4, 36.4);
woonquotes[i++] = new Array(48500, 32.5, 33.5, 34.5, 35.5, 36.5);
woonquotes[i++] = new Array(49000, 32.6, 33.6, 34.6, 35.6, 36.6);
woonquotes[i++] = new Array(49500, 32.7, 33.7, 34.7, 35.7, 36.7);
woonquotes[i++] = new Array(50000, 32.8, 33.8, 34.8, 35.8, 36.8);
woonquotes[i++] = new Array(50500, 32.9, 33.9, 34.9, 35.9, 36.9);
woonquotes[i++] = new Array(51000, 33.0, 34.0, 35.0, 36.0, 37.0);
woonquotes[i++] = new Array(51500, 33.1, 34.1, 35.1, 36.1, 37.1);
woonquotes[i++] = new Array(52000, 33.2, 34.2, 35.2, 36.2, 37.2);
woonquotes[i++] = new Array(52500, 33.3, 34.3, 35.3, 36.3, 37.3);
woonquotes[i++] = new Array(53000, 33.4, 34.4, 35.4, 36.4, 37.4);
woonquotes[i++] = new Array(53500, 33.5, 34.5, 35.5, 36.5, 37.5);
woonquotes[i++] = new Array(54000, 33.6, 34.6, 35.6, 36.6, 37.6);
woonquotes[i++] = new Array(54500, 33.7, 34.7, 35.7, 36.7, 37.7);
woonquotes[i++] = new Array(55000, 33.8, 34.8, 35.8, 36.8, 37.8);
woonquotes[i++] = new Array(55500, 33.9, 35.0, 36.1, 37.2, 38.3);
woonquotes[i++] = new Array(56000, 34.0, 35.1, 36.2, 37.3, 38.4);
woonquotes[i++] = new Array(56500, 34.1, 35.2, 36.3, 37.4, 38.5);
woonquotes[i++] = new Array(57000, 34.2, 35.3, 36.4, 37.5, 38.6);
woonquotes[i++] = new Array(57500, 34.3, 35.4, 36.5, 37.6, 38.7);
woonquotes[i++] = new Array(58000, 34.4, 35.5, 36.6, 37.7, 38.8);
woonquotes[i++] = new Array(60000, 34.8, 35.9, 37.0, 38.1, 39.2);
woonquotes[i++] = new Array(62000, 35.2, 36.3, 37.4, 38.5, 39.6);
woonquotes[i++] = new Array(64000, 35.5, 36.6, 37.7, 38.8, 39.9);
woonquotes[i++] = new Array(66000, 35.9, 37.0, 38.1, 39.2, 40.3);
woonquotes[i++] = new Array(68000, 36.3, 37.4, 38.5, 39.6, 40.7);
woonquotes[i++] = new Array(70000, 36.7, 37.8, 38.9, 40.0, 41.1);
woonquotes[i++] = new Array(72000, 37.1, 38.2, 39.3, 40.4, 41.2);
woonquotes[i++] = new Array(74000, 37.4, 38.5, 39.6, 40.7, 41.5);
woonquotes[i++] = new Array(76000, 37.6, 38.7, 39.8, 40.9, 42.0);
woonquotes[i++] = new Array(78000, 37.7, 38.8, 39.9, 41.0, 42.1);
woonquotes[i++] = new Array(80000, 37.9, 39.1, 40.3, 41.5, 42.7);
woonquotes[i++] = new Array(84000, 37.9, 39.2, 40.5, 41.8, 43.1);

/* WoonQuotes Postbank 2008
Inkomen vanaf € ==> Toetsrente t/m 4.5, 4.501 t/m 5.0, 5.001 t/m 5.5, 5.501 t/m 6.0);6.001, en hoger

woonquotes[i++] = new Array(     0, 23.9, 24.1, 24.3, 24.5, 24.7);
woonquotes[i++] = new Array( 17500, 24.9, 25.1, 25.3, 25.5, 25.7);
woonquotes[i++] = new Array( 18000, 25.9, 26.1, 26.3, 26.5, 26.7);
woonquotes[i++] = new Array( 18500, 26.8, 27.1, 27.4, 27.7, 28.0);
woonquotes[i++] = new Array( 19000, 27.3, 27.6, 27.9, 28.2, 28.5);
woonquotes[i++] = new Array( 19500, 27.6, 28.1, 28.6, 29.1, 29.6);
woonquotes[i++] = new Array( 20000, 27.9, 28.5, 29.1, 29.7, 30.3);
woonquotes[i++] = new Array( 20500, 28.0, 28.7, 29.4, 30.1, 30.8);
woonquotes[i++] = new Array( 21000, 28.1, 28.9, 29.7, 30.5, 31.3);
woonquotes[i++] = new Array( 22000, 28.1, 29.0, 29.9, 30.8, 31.7);
woonquotes[i++] = new Array( 24000, 28.2, 29.1, 30.0, 30.9, 31.8);
woonquotes[i++] = new Array( 25000, 28.3, 29.3, 30.3, 31.3, 32.3);
woonquotes[i++] = new Array( 25500, 28.4, 29.4, 30.4, 31.4, 32.4);
woonquotes[i++] = new Array( 26000, 28.6, 29.6, 30.6, 31.6, 32.6);
woonquotes[i++] = new Array( 26500, 28.8, 29.8, 30.8, 31.8, 32.8);
woonquotes[i++] = new Array( 27000, 28.9, 29.9, 30.9, 31.9, 32.9);
woonquotes[i++] = new Array( 27500, 29.0, 30.0, 31.0, 32.0, 33.0);
woonquotes[i++] = new Array( 28000, 29.2, 30.2, 31.2, 32.2, 33.2);
woonquotes[i++] = new Array( 28500, 29.3, 30.3, 31.3, 32.3, 33.3);
woonquotes[i++] = new Array( 29000, 29.4, 30.4, 31.4, 32.4, 33.4);
woonquotes[i++] = new Array( 29500, 29.6, 30.6, 31.6, 32.6, 33.6);
woonquotes[i++] = new Array( 30000, 29.7, 30.7, 31.7, 32.7, 33.7);
woonquotes[i++] = new Array( 30500, 29.8, 30.8, 31.8, 32.8, 33.8);
woonquotes[i++] = new Array( 31000, 29.9, 30.9, 31.9, 32.9, 33.9);
woonquotes[i++] = new Array( 40000, 30.0, 31.0, 32.0, 33.0, 34.0);
woonquotes[i++] = new Array( 41000, 30.1, 31.1, 32.1, 33.1, 34.1);
woonquotes[i++] = new Array( 42500, 30.2, 31.2, 32.2, 33.2, 34.2);
woonquotes[i++] = new Array( 43500, 30.2, 31.3, 32.4, 33.5, 34.6);
woonquotes[i++] = new Array( 44000, 30.3, 31.4, 32.5, 33.6, 34.7);
woonquotes[i++] = new Array( 44500, 30.5, 31.6, 32.7, 33.8, 34.9);
woonquotes[i++] = new Array( 45000, 30.6, 31.7, 32.8, 33.9, 35.0);
woonquotes[i++] = new Array( 45500, 30.7, 31.8, 32.9, 34.0, 35.1);
woonquotes[i++] = new Array( 46000, 30.8, 31.9, 33.0, 34.1, 35.2);
woonquotes[i++] = new Array( 46500, 30.9, 32.0, 33.1, 34.2, 35.3);
woonquotes[i++] = new Array( 47000, 31.0, 32.1, 33.2, 34.3, 35.4);
woonquotes[i++] = new Array( 47500, 31.1, 32.2, 33.3, 34.4, 35.5);
woonquotes[i++] = new Array( 48000, 31.2, 32.3, 33.4, 34.5, 35.6);
woonquotes[i++] = new Array( 48500, 31.3, 32.4, 33.5, 34.6, 35.7);
woonquotes[i++] = new Array( 49000, 31.4, 32.5, 33.6, 34.7, 35.8);
woonquotes[i++] = new Array( 49500, 31.5, 32.6, 33.7, 34.8, 35.9);
woonquotes[i++] = new Array( 50000, 31.6, 32.7, 33.8, 34.9, 36.0);
woonquotes[i++] = new Array( 50500, 31.7, 32.8, 33.9, 35.0, 36.1);
woonquotes[i++] = new Array( 51000, 31.8, 32.9, 34.0, 35.1, 36.2);
woonquotes[i++] = new Array( 51500, 31.9, 33.0, 34.1, 35.2, 36.3);
woonquotes[i++] = new Array( 52000, 32.0, 33.1, 34.2, 35.3, 36.4);
woonquotes[i++] = new Array( 52500, 32.1, 33.2, 34.3, 35.4, 36.5);
woonquotes[i++] = new Array( 53000, 32.2, 33.3, 34.4, 35.5, 36.6);
woonquotes[i++] = new Array( 53500, 32.3, 33.4, 34.5, 35.6, 36.7);
woonquotes[i++] = new Array( 54000, 32.4, 33.5, 34.6, 35.7, 36.8);
woonquotes[i++] = new Array( 54500, 32.5, 33.6, 34.7, 35.8, 36.9);
woonquotes[i++] = new Array( 55000, 32.6, 33.7, 34.8, 35.9, 37.0);
woonquotes[i++] = new Array( 55500, 32.7, 33.8, 34.9, 36.0, 37.1);
woonquotes[i++] = new Array( 56000, 32.9, 34.0, 35.1, 36.2, 37.3);
woonquotes[i++] = new Array( 56500, 33.0, 34.1, 35.2, 36.3, 37.4);
woonquotes[i++] = new Array( 57000, 33.1, 34.2, 35.3, 36.4, 37.5);
woonquotes[i++] = new Array( 59000, 33.7, 34.8, 35.9, 37.0, 38.1);
woonquotes[i++] = new Array( 61000, 34.1, 35.2, 36.3, 37.4, 38.5);
woonquotes[i++] = new Array( 63000, 34.6, 35.7, 36.8, 37.9, 39.0);
woonquotes[i++] = new Array( 65000, 35.0, 36.1, 37.2, 38.3, 39.4);
woonquotes[i++] = new Array( 67000, 35.4, 36.5, 37.6, 38.7, 39.8);
woonquotes[i++] = new Array( 69000, 35.7, 36.8, 37.9, 39.0, 40.1);
woonquotes[i++] = new Array( 71000, 36.0, 37.1, 38.2, 39.3, 40.4);
woonquotes[i++] = new Array( 73000, 36.2, 37.4, 38.6, 39.8, 41.0);
woonquotes[i++] = new Array( 75000, 36.3, 37.5, 38.7, 39.9, 41.1);
woonquotes[i++] = new Array( 77000, 36.4, 37.7, 39.0, 40.3, 41.6);
woonquotes[i++] = new Array( 79000, 36.5, 37.8, 39.1, 40.4, 41.7);
woonquotes[i++] = new Array( 81000, 36.5, 37.9, 39.3, 40.7, 42.1);
woonquotes[i++] = new Array( 83000, 36.6, 38.0, 39.4, 40.8, 42.2);
woonquotes[i++] = new Array( 91000, 36.7, 38.1, 39.5, 40.9, 42.3);
woonquotes[i++] = new Array(101000, 36.8, 38.2, 39.6, 41.0, 42.4);
*/

function MaxHypotheek(BrutoJaarinkomen1OBJ, BrutoJaarinkomen2OBJ, EigenMiddelenCalcOBJ,calcresultMHOBJ) {
	var BrutoJaarinkomen1 = document.getElementById(BrutoJaarinkomen1OBJ).value;
	var BrutoJaarinkomen2 = document.getElementById(BrutoJaarinkomen2OBJ).value;
	var EigenMiddelenCalc = document.getElementById(EigenMiddelenCalcOBJ).value;
	
	document.getElementById('herh_BrutoJaarinkomen1').innerHTML = BrutoJaarinkomen1;
	document.getElementById('herh_BrutoJaarinkomen2').innerHTML = BrutoJaarinkomen2;
	document.getElementById('herh_EigenMiddelenCalc').innerHTML = EigenMiddelenCalc;
	
	jaarsalaris = parseFloat(BrutoJaarinkomen1) + parseFloat(BrutoJaarinkomen2);

	for(var i = -1; i < woonquotes.length; i ++) {
		if (jaarsalaris >= woonquotes[i][0]){
			woonquote =  woonquotes[i][renteCol];
		}
	}

	Interest = ((0.01 * hypRente) / 12);
	Groeigetal = Math.pow((1 + Interest), 12 * 30);
	Annuiteit = (0.01 * woonquote * jaarsalaris) / 12;
	Deelfactor = (Interest * Groeigetal) / (Groeigetal - 1);
	calcresult = Annuiteit / Deelfactor;
	
	 calcresult = calcresult + parseFloat(EigenMiddelenCalc);
	 
	if (calcresult < 0) {
		calcresult = 0;
	}
	document.getElementById(calcresultMHOBJ).innerHTML = calcresult.toFixed();
}