/* width first level menu */
function setWidth(){
	$(".m").each(function(){
		$(this).css("width",$(this).width()+"px");
		$(".ma",this).css({"position":"absolute","z-index":"400","height":"24px"});
	});
}
/* body center */
function centerme(){
	a=$(window).width();
	if(a<1003){
		$(".ooo").width(215);
		$("#outer").css("margin-left",0);
	}
	else if(1003<a && a<1413){
		$(".ooo").width(215+((a-1003)/2));
		m=(a-1003)/2;
		$("#outer").css("margin-left",m+"px");
	}
	else {
		$(".ooo").width(420);
		m=215+(a-1413)/2-10;
		$("#outer").css("margin-left",m+"px");
	}
}
/* document ready */	
$(function() {
	/* first level menu */
	$("#m_b .m").mouseenter(
		function() {
			$("a:first",this).css({"color":"#AA272F"});
			
			sm=$(this).children().filter("div");
			if (sm.length==1) {
				sm.css("visibility","visible");
				$("a:first",this).css({"background":"#FFFFFF","padding":"0 8px","border":"2px solid #868887","border-bottom":"none","top":"-2px"});
			}
		}).mouseleave(
		function() {
			$("a:first",this).css({"color":"#606060","background":"none","padding":"0 10px","border":"none","top":"0"});
			
			sm=$(this).children().filter("div");
			if (sm.length==1) {
				sm.css("visibility","hidden");
				$("a:first",this).css({"background":"none","padding":"0 10px","border":"none","top":"0"});
			}
		}
  	);
	/* second level menu */
	$(".mma").hover(
		function() {
			$(this).css({"background":"#DFDFDF"});
		},
		function() {
			$(this).css({"background":"none"});
		}
  	);
	/* third level menu */
	$(".mmm").hover(
		function() {
			$(this).css({"background":"#DFDFDF url('/images/bullet2.jpg') no-repeat","background-position":"10px 10px"});
		},
		function() {
			$(this).css({"background":"transparent url('/images/bullet2.jpg') no-repeat","background-position":"10px 10px"});
		}
  	);
	/* boby center */
	$(window).resize(function(){
		centerme();
	}).load(function(){
		centerme();
	});
	setTimeout("setWidth()",1000);
	$(document).pngFix();
});
