    $(document).ready(function() {
		
	
        $('#slidelist').after('<div id="slidenav">').cycle({ 
            fx:     'scrollLeft', 
            speed:   600, 
            timeout: 5000, 
            pager:  '#slidenav', 
            prev:   '#prevslide', 
            next:   '#nextslide'
            });
	
		$.receiveMessage(function(e){
			var h = Number( e.data.replace( /.*if_height=(\d+)(?:&|$)/, '$1' ) );
						
			if ( !isNaN( h ) && h > 0 && h !== if_height ) {
				iframe.height( if_height = h );
			}
			}, "http://extranet.vkg.com" 
		);
      });



	// Functie voor het automatisch plaatsen en resizen van iframe
	var if_height;
	var iframe;
	
	function createiFrame(url, divid)
	{
		iframe = $( '<iframe src="' + url + '" width="660" height="100" scrolling="no" frameborder="0"><\/iframe>' );
		iframe.appendTo( "#" + divid );
	}
	
$(document).ready(function() {
	$(".numeriek, .integer").keydown(function(e) {
		//console.log(e.which);
		switch (e.which) {
			case 35: case 36: case 37: case 38: case 39: case 40: case 8: case 35: case 36: case 9: case 96: case 49: case 50:  case 51:  case 52:  case 53:  case 54:  case 55:  case 56:  case 57:  case 0: case 46: case 45: case 116: case 96: case 97: case 98: case 99: case 100: case 101: case 102: case 103: case 104: case 105: case 48:
				//left,right,tab,shift,etc.
				break;
			case 188: case 110: case 190: //komma, punt
				if ($(this).attr("class").indexOf("integer") > 0) {return false;}
				break;
			default:
				return false;
		}
	});
		
	$(".numeriek").keyup(function() {
		$(this).val($(this).val().replace(".",","));
	});
	
	$(".puntjes").focus(function() {
		$(this).val($(this).val().replace(".",""));
	});
	
	$(".puntjes").blur(function() {
		var decimals = false;
		if ($(this).hasClass("numeriek")) {decimals = true;}
		$(this).val(formatNumber(parseFloat($(this).val().replace(",",".")), decimals));
	});
	
	$(".puntjes").each(function(){
		var decimals = false;
		if ($(this).hasClass("numeriek")) {decimals = true;}
		$(this).val(formatNumber(parseFloat($(this).val().replace(",",".")), decimals));
	});
});

function formatNumber (theNumber, decimals) {
	var theDecimalDigits = Math.round((theNumber*100)-(Math.floor(theNumber)*100));
	theDecimalDigits= ""+ (theDecimalDigits + "0").substring(0,2);
	theNumber = ""+Math.floor(theNumber);
	var theOutput = "";
	for (x=0; x<theNumber.length; x++) {
		theOutput += theNumber.substring(x,x+1);
		if (isThousands(theNumber.length-x-1) && (theNumber.length-x-1 !=0)) {
			theOutput += ".";
		};
	};
	
	if (decimals) {theOutput += "," + theDecimalDigits;}
	return theOutput;
};

function isThousands(position) {
	if (Math.floor(position/3)*3==position) return true;
	return false;
};
