var Highlight = {
	buttons : new Array(),
	buttonToHighlight : null,
	buttonToHighlightRule : null,
	basepath : "",
	initWithPath : function(path) {
		Highlight.basepath = document.location.protocol + "//" + document.location.host + path;
		var aa = document.getElementsByTagName( "A" );
		var hls = new Object();
		
		hls[ "hl_60" ] = 1;
		hls[ "hl_75" ] = 1;
		hls[ "hl_90" ] = 1;
		hls[ "hl_105" ] = 1;
		hls[ "hl_120" ] = 1;
		hls[ "hl_135" ] = 1;
		hls[ "hl_150" ] = 1;
		hls[ "hl_165" ] = 1;
		hls[ "hl_180" ] = 1;
		
		for( var j = 0; j < aa.length; j ++ ) {
			var ll = aa[j];
			var cn;
			
			if( ll.className !== undefined ) {
				cn = ll.className;
			} else if( ll.getAttribute !== undefined ) {
				cn = ll.getAttribute( "class" );
			}
			
			if( hls[ cn ] == 1 ) {
                var h;
                if( ll.href !== undefined ) {
                    h = ll.href;
                } else if( ll.getAttribute ) {
                    h = ll.getAttribute( "href" );
                }
				
				if( Highlight.basepath.indexOf( h ) == 0 ) {
					Highlight.buttonToHighlight = ll;					
					Highlight.buttonToHighlightRule = findCssRule( "a." + cn + ":hover" );
					Highlight.pushCustomStyle();					
				}
				
				Highlight.buttons[ Highlight.buttons.length ] = ll;
				
//				var mo1 = new Function( "e", "Highlight.mouseOverButton(" + (Highlight.buttons.length - 1) + ")" );
//				var mo2 = new Function( "e", "Highlight.mouseOutButton(" + (Highlight.buttons.length - 1) + ")" );
				
//				setEventHandler( ll, "mouseover", mo1 );
//				setEventHandler( ll, "mouseout", mo2 );
			}
		}
	},
	pushCustomStyle : function() {
		if( (Highlight.buttonToHighlight == null) ||
			(Highlight.buttonToHighlightRule == null) ) return;
		// url(.......);
		var bgimage = Highlight.buttonToHighlightRule.style.backgroundImage;
		var mselpos = bgimage.indexOf( "msel" );
		var pbgimage = bgimage.substring( 0, mselpos ) + "X" + bgimage.substring( mselpos );
		Highlight.buttonToHighlight.style.background = pbgimage + " no-repeat";
	},
	popCustomStyle : function() {
		if( Highlight.buttonToHighlight == null ) return;
		Highlight.buttonToHighlight.style.background = "";
	},
	mouseOverButton : function(i) {
		var btn = Highlight.buttons[i];
		
		if( btn == Highlight.buttonToHighlight ) {
			Highlight.pushCustomStyle();
		} else {
			Highlight.popCustomStyle();
		}
	},
	mouseOutButton : function(i) {
		var btn = Highlight.buttons[i];
		
		if( btn == Highlight.buttonToHighlight ) {
		} else {
			Highlight.pushCustomStyle();
		}
	}
};

