// =============================================================================================================================================================================
// File: 								add-event.js
// Functions listed:		addEventHandler
// Associated files:		gem-rels.js / photo-rels.js
//											popup.js
// =============================================================================================================================================================================

// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Function: 						addEventHandler
// Description: 				Allows an event-handler to be loaded without having to add javascript into the xhtml code.
//              				This keeps the xhtml separate from the javascript.
// Original Author(s): 	Idea taken and modified from tutorial by Ian Lloyd from website http://www.accessify.com/features/tutorials/the-perfect-popup/. 
//											Ian Lloyd's own website: http://lloydi.com/.
// Modifier:						Modified by Derek Norcott to standardise notation.
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

function addEventHandler(oElement, sEventType, sFunction, bUseCapture){
	
	if (oElement.addEventListener){
		oElement.addEventListener(sEventType, sFunction, bUseCapture);
		return true;
	}
	else if (oElement.attachEvent){
		var rbHasWorked = oElement.attachEvent('on' + sEventType, sFunction);
		return rbHasWorked;
	}
	else{
		oElement['on' + sEventType] = sFunction;
	}
}

