var Bereken = Class.create();

Bereken.prototype = {
	initialize: function(){ },

	eindkapitaal: function(){
		a = $('eindkapitaal_inleg').value;
		b = $('eindkapitaal_rente').value;
		c = $('eindkapitaal_looptijd').value;
		
		result = a /(1 - Math.pow(1+b/100, 1/12)) + (a - a / (1-Math.pow(1+b/100, 1/12))) * Math.pow(1+b/100, c) - a;
  	$('eindkapitaal_total').value = (Math.round(result*100) /100);
	},
	
	maandinleg: function(){
		a = $('maandinleg_eindkapitaal').value;
		b = $('maandinleg_rente').value;
		c = $('maandinleg_looptijd').value;
		
		result = a/(1/(1-Math.pow(1+b/100,1/12))+(1-1/(1-Math.pow(1+b/100,1/12)))* Math.pow(1+b/100,c)-1);
		$('maandinleg_total').value = (Math.round(result*100) /100);
	},
	
	melfidor: function(select, url){
		p = '';
		if(select){
			value = $(select).options[$(select).selectedIndex].value
		
			if(value == ''){
				alert('Maak eerst een keuze uit een dekking');
			} else {
				p = value;
			}
		} else {
			if(url){
				p = url
			}
		}

		if(p && p != ''){
			window.open('http://www.m11idor.nl/moos5300/' + p, 'window', 'width=800,height=600');
		}
	}
}