/**
 * Include script for javascript application layer.
 * 
 * @author R.J.T. de Vries <rdevries@thirdwave.nl>
 * @version 1.00, 06/16/2008
 * @access public
 * @package CMS
 */
 
//------------------------------------------------------------------------------
// PHASE I: INCLUDE ALL NECESSARY JAVASCRIPT FILES.
//------------------------------------------------------------------------------
document.write("<script src='/inc/jscripts/amschiphol.com/ddMenus.js'></script>");
document.write("<script src='/cms/jscripts/cms.event.js'></script>");
document.write("<script src='/cms/jscripts/cms.functions.js'></script>");

//------------------------------------------------------------------------------
// PHASE II: INITIALIZATION FUNCTION, CALLED ON DOCUMENT LOAD EVENT
//------------------------------------------------------------------------------

/**
 * Instance of ddMenus object.
 * @var object ddmenus
 * @access global
 */
var ddmenus;

/**
 * Instance of XMLHttp object, used for XML HTTP data communication.
 * @var object xmlhttp
 * @access global
 */
var xmlhttp = null;

/**
 * Instance of XMLProcessor object, used for XML data processing.
 * @var object xmlprocessor
 * @access global
 */
var xmlprocessor = null;

/**
 * Instance of Data object, used for saving form data.
 * @var object data
 * @access global
 */
var data = null;

/**
 * Initialize website. Called from <body> tag.
 *
 * Starts with calling the ddinit() function which initializes the dropdown
 * menus in the website. After that, the current document is checked for forms
 * in which special events need to be attached to form elements. (such as a
 * select element that needs an onchange event.) Finally, I.E. is instructed 
 * not to keep a background-image cache, as that keeps I.E. from flickering on
 * mouseover.
 * 
 * @return 	void
 * @access	public
 */
function init() {
	var selects,		// collection of select elements in current document.
			title,			// title element.
			i;					// iterator.

	ddmenus = new ddMenus;
	if ( !ddmenus.init() ) {
		alert('Dropdown menus kunnen niet worden geactiveerd');
	}
	
	selects = document.getElementsByTagName('select');
	for ( i = 0; i < selects.length; i++ ) {
		if ( selects[i].getAttribute('val') ) {
			selects[i].value = selects[i].getAttribute('val');
		}
	}
	
	if ( (title = document.getElementByAttribute('className', 'title', 'h1')) ) {
		addEvent(title, 'click', function() { document.location = '/home.html'; });
	}
	
} // init()

window.onload = init;

/* end of include script */
