var infoArr = new Array('abattement', 'klein_beschrijf');

$(document).ready(function(){
	
	// Set Shadowline on Body
	$('body').addClass('setBg');
	var heightTotal = $("#top").height() + $("#message").height() + $("#mainnav").height();
	var paddingTotal = parseInt($('#message').css('padding-top').replace('px', '')) + parseInt($('#message').css('padding-bottom').replace('px', '')) + parseInt($('.container').css('padding-top').replace('px', ''));
	
	var total = heightTotal + paddingTotal;
	
	$('body.setBg').css('background-position', '0 ' + String(total) + 'px');
	
	//$('#top').hide();
	
	if($('.rekenmodule').length > 0){
	
		$.each(infoArr, function(i){
			if($('#info_' + infoArr[i]).length > 0){
				$('#info_' + infoArr[i]).attr('title', $('#tooltip_' + infoArr[i]).html());
			}
		})
		
		
		$('a.info_link').qtip({
			position: {
				corner: {
					target: 'topRight',
					tooltip: 'bottomLeft'
				}
			},
	
			style: { 
				width: 350,
				padding: 8,
				background: '#fff',
				color: 'black',
				textAlign: 'left',
				border: {
					width: 5,
					radius: 5,
					color: '#5295C1'
				},
				tip: 'bottomLeft',
				name: 'dark' // Inherit the rest of the attributes from the preset dark style
			}
		});
	}
});


function addCommas(nStr) {
	nStr += '';
	x = nStr.split('.');
	x1 = x[0] == '' ? '0' : x[0];
	if(x.length > 1){
		if(x[1].length == 1) x[1] = String(x[1]) + '0';
		x2 = ',' + x[1];
	}else{
		x2 = ',00';
	}
	//x2 = x.length > 1 ? ',' + x[1] : ',00';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + '.' + '$2');
	}
	return x1 + x2;
}