//<!--
/*
----------------------------------------------------------
Version:		0.1
Author:			RHH
Creation Date:	18/07/2002
----------------------------------------------------------
Description

See /registration/step1.php for a working example

----------------------------------------------------------
Version					Date					Changes	
----------------------------------------------------------
0.1						18.07.2002				Created
*/

	//legacy
    var isNav = (navigator.appName.indexOf("Netscape") !=-1);
    var isIE = (navigator.appName.indexOf("Microsoft") !=-1);

	function addhandlers(o)
	{
		o.onabort = handler;    
		o.onblur = handler;
        o.onchange = handler;   
		o.onclick = handler;
		o.ondblclick = handler;  
		o.onerror = handler;
        o.onfocus = handler;    
		o.onkeydown = handler;
		o.onkeypress = handler; 
		o.onkeyup = handler;
		o.onmousedown = handler;
		o.onmouseout = handler; 
		o.onmouseover = handler;
		o.onmouseup = handler;  
		o.onmove = handler;
		o.onreset = handler;    
		o.onresize = handler;
		o.onselect = handler;
		o.onselectstart = handler; // IE
		o.onsubmit = handler;
		o.onunload = handler;
		
		//firefox does not always fire unload events
		// use beforeunload instead / as well
		o.onbeforeunload = handler;
		/*
		//FIRST, TELL THE BROWSERS TO REACT TO THE EVENT
		if( document.captureEvents ) 
		{
		    //non IE
		    if( Event.KEYPRESS ) 
			{
		        //NS 4, NS 6+, Mozilla 0.9+
		        document.captureEvents( Event.KEYPRESS );
		    }
		}
		*/

	}
	
	addhandlers(window);
    addhandlers(document);

    for (var d = 0; d < document.links.length; d++)
            addhandlers(document.links[d]);

    for (var d = 0; d < document.images.length; d++)
            addhandlers(document.images[d]);

    for (var d = 0; d < document.forms.length; d++)
    {        
		addhandlers(document.forms[d]);

		for (var e = 0; e < document.forms[d].elements.length; e++)
			addhandlers(document.forms[d].elements[e]);
    }
	
	
	function cancelBubble(e)
	{
		if (e==null)
			return;
		e.cancelBubble = true;
		if (e.stopPropagation) e.stopPropagation();
	}
	
	//Cancel an event to stop the character reaching the input
	function CancelEvent(e)
	{
		try 
		{
			if (e.keyCode)
				e.keyCode=0;
		}
		catch(ex)
		{
			//firefox uses e.keyCode for some 'special' characters,
			// but will not allow e.keyCode to be set.
			//Attempting to do so will throw an exception.
		}
		if (e.returnValue)
			e.returnValue=false;
			
		if (e.preventDefault)
			e.preventDefault();
	}
	
	
	//Call to get the name of the control which started the event
	function GetCtrlName(e)
	{	
		if (e.srcElement && e.srcElement.name)
			return e.srcElement.name;
		else if (e.target)
		{
			//DOM
			var oNode = e.target;
			while (oNode)
			{
				if (oNode.name)
					return oNode.name;
				else if (oNode.getAttribute && oNode.getAttribute('name'))
					return oNode.getAttribute('name');
					
				oNode=oNode.parentNode;
			}
		}
		
		return undefined;
	}
	
//Call to get a refrence to the control which started the event
	function GetCtrlRef(e)
	{	
		if (e.srcElement)
			return e.srcElement;
		else if (e.target)
			return e.target;
		
		return undefined;
	}

	function TestEventHandler()
	{
		//Function must exist.
		//Test existence of this function to prove script is loaded if not inlined.
	}
	
// -->