/* Son of Suckerfish Dropdowns */

if ( ( typeof( sfHover ) ).toLowerCase() != 'undefined' ) {
	event_attach( 'onload' , function () { 
		sfHover( 'menubar', true );
	} );
}


function sfHover ( objID, noMat ) {
// object detection for IE < 7
	if (document.all && window.attachEvent && !(document.documentElement && typeof document.documentElement.style.maxHeight!="undefined")) {
		var sfEls = document.getElementById( objID ).getElementsByTagName( "LI" );
		for (var i=0; i<sfEls.length; i++) {
			if ( !noMat && ( window.createPopup )) { // IE 5.5 or 6
				sfEls[i].onmouseover = function() {
					this.className += ( this.className.length > 0 ? " " : "" ) + "sfhover";
					var ieUL = this.getElementsByTagName( "UL" )[0];
					if ( ieUL ) {
						var ieMat = document.createElement( "IFRAME" );
						ieMat.style.width = ieUL.offsetWidth + "px";
						ieMat.style.height = ieUL.offsetHeight + "px";
						ieUL.insertBefore( ieMat, ieUL.firstChild );
						ieMat.style.zIndex = "-1";
					}
				}
				sfEls[i].onmouseout = function() {
					this.className = this.className.replace( new RegExp( "( ?|^)sfhover\\b" ), "" );
					var ieUL = this.getElementsByTagName('ul')[0];
					if (ieUL) {
						ieUL.removeChild( ieUL.firstChild );
					}
				}
			} else {
				sfEls[i].onmouseover = function() {
					this.className += ( this.className.length > 0 ? " " : "" ) + "sfhover";
				}
				sfEls[i].onmouseout = function() {
					this.className = this.className.replace( new RegExp( "( ?|^)sfhover\\b" ), "" );
				}
			}
		}
	}
}

function event_attach( event , func ) {
	if ( window.attachEvent ) 	{
		window.attachEvent( event , func );
	} else {
		if ( ( typeof( func ) ).toLowerCase() != 'function' ) {
			return;
		}
		if ( ( typeof( document.event_handlers ) ).toLowerCase() == 'undefined' ) {
			document.event_handlers = new Array();
		}
		if ( ( typeof( document.event_handlers[ event ] ) ).toLowerCase() == 'undefined' ) {
			document.event_handlers[ event ] = new Array();
		}
		if ( ( typeof( eval( 'window.' + event ) ) ).toLowerCase() != 'function' ) {
			eval( 'window.' + event + ' = function () { if ( ( typeof( document.event_handlers[ \'' + event + '\' ] ) ).toLowerCase() != \'undefined\' ) { for ( i = document.event_handlers[ \'' + event + '\' ].length - 1 ; i >= 0  ; i-- ) { document.event_handlers[ \'' + event + '\' ][ i ](); } } } ' );
		}
		document.event_handlers[ event ][ document.event_handlers[ event ].length ] = func;
	}
}

