
/*
	multiple onload functions
	
	The addLoadEvent function takes as an argument another function which should be executed once the page has loaded.
	Unlike assigning directly to window.onload, the function adds the event in such a way that any previously added onload functions will be executed first.
	
	usage:
	
	addLoadEvent(nameOfSomeFunctionToRunOnPageLoad);
	addLoadEvent(function());
	addLoadEvent(function(arg));
	addLoadEvent(function(arg) { code });
*/

function addLoadEvent(func)
{
	var oldonload = window.onload;
	
	// if window.onload has not already been assigned a function, the function passed to addLoadEvent is simply assigned to window.onload.
	// If window.onload has already been set, a brand new function is created which first calls the original onload handler, then calls the new handler afterwards.
	
	if(typeof window.onload != 'function')
	{
		window.onload = func;
	}
	else
	{
		window.onload = function()
		{
			if(oldonload)
			{
				oldonload();
			}
			
			func();
		}
	}
}


//add more functions if you want
addLoadEvent(w_buildMail);
addLoadEvent(w_preloadImages(	'gfx/button_hover.gif',
								'gfx/menu_item_hover.gif',
								'gfx/menu_logo_hover.gif',
								'gfx/menu_v_hover1.gif',
								'gfx/menu_v_hover2.gif',
								'gfx/menu_c_hover.gif',
								'gfx/compatibles/hw_bob_hover.gif',
								'gfx/compatibles/hw_h_hover.gif',
								'gfx/compatibles/hw_pob_hover.gif',
								'gfx/compatibles/hw_rd_hover.gif',
								'gfx/compatibles/hw_sb_hover.gif',
								'gfx/compatibles/hw_ss_hover.gif',
								'gfx/compatibles/sb_browser_hover.gif',
								'gfx/compatibles/sb_db_hover.gif',
								'gfx/compatibles/sb_lb_hover.gif',
								'gfx/compatibles/sb_sb_hover.gif')	);

