var onloadFunctions = new Array( );

/**
 * Onload functie gaat door onloadFunctions array om die functies uit te voeren.
 */
window.onload = function( )
{
	for(var myIndex = 0; myIndex < onloadFunctions.length; myIndex++ )
	{
		if(onloadFunctions[myIndex])
		{
			onloadFunctions[myIndex]( );
		}
	}
}

/*
 * Functie om een onloadfunctie toe te voegen aan de onloadFunctions array
 */
window.addOnloadFunction = function( func )
{
	onloadFunctions[onloadFunctions.length] = func;
}

function var_dump( theVar, depth, keyName )
{
	var result = "";
  	var tabs = "";
  	
  	if(typeof depth == 'undefined')
  	{
  		var depth = 0;
  	}
  	else
  	{
  		depth++;	
  	}
  	
  	for(var i = 0; i < depth; i++)
  	{
  		tabs += "\t";	
  	}
	
	switch (typeof(theVar))
	{
           case 'object':
			if(keyName)
			{
				result += "\n"+tabs+keyName+" : "+typeof(theVar);
			}
			else
			{
				result += "\n"+tabs+typeof(theVar);	
			}
			result += "\n"+tabs+"{";
			
			for( keyName in theVar )
			{
				result += var_dump( theVar[keyName], depth, keyName );
			}
			
			result += "\n"+tabs+"}";            	
           	break;
           default:
           
           	if(typeof(theVar) == 'string')
           	{
           		var type = " ("+typeof(theVar)+" "+theVar.length+")";
           	}
           	else
           	{
           		var type = "";	
           	}
           
           	if(keyName)	
           	{
           		result += "\n"+tabs+keyName+" : "+theVar+type;
           	}
           	else
           	{
           		result += "\n"+tabs+theVar+type;	
           	}
           	break;	
	}				
	
	return result;
}