/*
*
*	Layout adjustment functions
*
*/

$(document).ready(
	function(){
		
		// submenus
		if($.browser.msie){
			$('.main_submenu').each(
				function(){
					var maxw = 0;
					var name = $(this).attr('name');
					
					$(this).children('li').children('.submenu_opt').each(
						function(){
							if( $(this).width() > maxw ){ maxw = $(this).width(); }
						}
					);
					
					setWidths(this, maxw);
					
				}
			);
		}
		
		function setWidths(t, w){
			$(t).children('li').children('.submenu_opt').each(
				function(){ $(this).width(w); }
			);	
		}
		
		// only if a subpage
		var subpage = location.href.indexOf("home") ? false : true;
		if(subpage){
			var bh = $('body').height();
			var ch = $('#container').height() - $('#header').height() - $('#footer').height() - 16;
			var sh = $('.submenu').height();
			var mh = $('.main').height();
			
			if(bh > 768){
				$('.submenu').height( bh - $('#header').height() - $('#footer').height() );
			}
			if(mh > sh){
				$('.submenu').height( mh + 20 );
			}
		}
		
	}
);



