/**
 * Include script for javascript application layer.
 * 
 * @author R.J.T. de Vries <rdevries@thirdwave.nl>
 * @version 1.00, 01/18/2008
 * @access public
 */

//------------------------------------------------------------------------------
// PHASE I: INCLUDE ALL NECESSARY JAVASCRIPT FILES.
//------------------------------------------------------------------------------
document.write("<script src='/cms/jscripts/cms.event.js'></script>");
document.write("<script src='/cms/jscripts/cms.functions.js'></script>");
document.write("<script src='/cms/jscripts/cms.Timeout.js'></script>");
document.write("<script src='/inc/jscripts/ddMenus.js'></script>");
document.write("<script src='/inc/jscripts/Joblist.js'></script>");
document.write("<script src='/inc/jscripts/LogoSlider.js'></script>");

//------------------------------------------------------------------------------
// PHASE II: INITIALIZATION FUNCTION, CALLED ON DOCUMENT LOAD EVENT
//------------------------------------------------------------------------------

/**
 * Instance of ddMenus object.
 * @var object ddmenus
 * @access global
 */
var ddmenus;

/**
 * Joblist object.
 * @var object joblist
 * @access global
 */
var joblist = null;

/**
 * Instance of the LogoSlider object. The logoSlider takes care of the sliding
 * effect for browsing through the available logos on the homepage.
 * @var object logoSlider
 * @access global
 */
var logoSlider = null;

/**
 * Initialization function.
 *
 * @param		boolean		refresh		should the nav-list be refreshed? default to true.
 * @return 	void
 * @access	public
 */
function init() {
	var h1;

	ddmenus = new ddMenus;
	if ( !ddmenus.init() ) {
		alert('Dropdown menus kunnen niet worden geactiveerd');
	}
	
	// attach an onclick event to the first h1 on the page.
	h1 = document.getElementsByTagName('h1');
	if ( h1.length ) {
		h1 = h1[0];
		addEvent(h1, 'click', function(e) { document.location = '/'; });
		h1.style.cursor = 'pointer';
	}
	
	// initialize the logoSlider.
	logoSlider = new LogoSlider();
	logoSlider.init();
	
	joblist = new Joblist();
	joblist.init();
} // init()

//------------------------------------------------------------------------------
// PHASE III: Some site specific functions and setting of the onload handler.
//------------------------------------------------------------------------------

window.onload = init;