
function attachEventHandlers()
{
    //set up the events for the page
    
    //set up for all image inputs with rollover class
    var images = document.getElementsByTagName("input");
    for( var i = 0; i < images.length; i++) {
    
     
        
        var regExp = new RegExp("(rollover\\s+)|(\\s+rollover)|(^rollover$)");
        
        
        if( ( images[i].getAttribute("type") == "image" ) && ( regExp.test( images[i].className ) ) ) {

            addEvent( images[i], 'mouseover', imageOn );
            addEvent( images[i], 'mouseout', imageOff );
        }
    }

}

//functions to control rollovers
function imageOn() {	
    this.src = this.src.replace('.gif', '_on.gif' );
}

function imageOff() {
    this.src = this.src.replace('_on.gif', '.gif' );
}


function addEvent( obj, type, fn )
{
	if (obj.addEventListener)
		obj.addEventListener( type, fn, false );
	else if (obj.attachEvent)
	{
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
	}
}

function removeEvent( obj, type, fn )
{
	if (obj.removeEventListener)
		obj.removeEventListener( type, fn, false );
	else if (obj.detachEvent)
	{
		obj.detachEvent( "on"+type, obj[type+fn] );
		obj[type+fn] = null;
		obj["e"+type+fn] = null;
	}
}

function addLoadEvent(func) 
{
    var oldonload = window.onload;
    
    if (typeof window.onload != 'function')
    {
        window.onload = func;
    }else{
        window.onload = function()
        {
            if (oldonload)
            {
                oldonload();
            }
            func();
        }
    }
}

addLoadEvent( attachEventHandlers );


