var s = {
	
	start: function() {
		s.resizeCols();
		s.setupMenu();
	},
	
	resizeCols: function() {
		var content = $( 'content' );
		var sidebar = $( 'sidebar' );
		var contentHeight = content.getStyle( 'height' ).toInt();
		var sidebarHeight = sidebar.getStyle( 'height' ).toInt();
		
		var fontSize = $( 'wrapper' ).getStyle( 'font-size' ).toInt();
		var newHeight = sidebarHeight / fontSize;
		
		if( ( sidebarHeight + 30 ) > contentHeight ) {
			if( window.ie6 )
				$E( 'div.body', content ).setStyle( 'height', ( newHeight / 10 ) + 'em' );
			else
				$E( 'div.body', content ).setStyle( 'height', newHeight + 'em' );
		}
	},
	
	setupMenu: function() {
		var menuItems = $ES( '#menu_items div.category' );
		
		menuItems.each( function( item ) {
				
				item.addEvent( 'mouseenter', function () { this.addClass( 'menuhover' ); }.bind( item ) );
				item.addEvent( 'mouseleave', function () { this.removeClass( 'menuhover' ); }.bind( item ) );
				
		});
	}
	
}

window.addEvent( 'domready', s.start );

function debug( txt ) {
	//if( new String( window.location ).indexOf( 'debug' ) != -1 ) {
		if ( !$defined( window.debugWindow ) ) {
			window.debugWindow = new Element( 'div' ).setStyles( { 'position': 'absolute', 'top': '0px', 'left': '0px', 'width': '200px', 'padding': '5px', 'background': '#aaaaaa' } ).injectInside( document.body );
		}
		window.debugWindow.innerHTML = window.debugWindow.innerHTML + txt + "<br />";
	//}
}

