$(document).ready(function(){		

  var img1 = new Image();
  var img2 = new Image();
  var img3 = new Image();
  var img4 = new Image();
  var img5 = new Image();
  var img6 = new Image();
  img1.src = img_path+"/menu//button_a_01.gif";
  img2.src = img_path+"/menu//button_a_02.gif";
  img3.src = img_path+"/menu//button_a_03.gif";
  img4.src = img_path+"/menu//button_a_04.gif";
  img5.src = img_path+"/menu//button_a_05.gif";
  img6.src = img_path+"/menu//button_a_06.gif";   
     
  var menu_id = 0;
  
  if(m_id != '')
  {
	  $("#menu > ul > ."+m_id +'> ul >li:eq('+(s_id-1)+')').addClass('sub_menu');
	  menu_hover($("#menu > ul > ."+m_id));
  }
  
  $('#menu > ul > li').mouseover(function(){menu_hover(this); });

  $('#banner .search form .input').focus(function(){$(this).css('opacity',100)}).blur(function(){if($(this).attr('value') == '' ){$(this).css('opacity',0);}});
  
	
  $('.top').mouseover(function(){$('img',this).attr('src',img_path+'/b_top_a.gif');})
           .mouseout(function(){$('img',this).attr('src',img_path+'/b_top.gif');});

  $('#banner .search form .submit').mouseover(function(){$(this).css("background", "url("+img_path+"/b_go_over.gif) no-repeat");})
                                   .mouseout(function(){$(this).css("background", "url("+img_path+"/b_go_up.gif) no-repeat");})
								   .click(function(){$(this).css("background", "url("+img_path+"/b_go_down.gif) no-repeat"); });

  function menu_hover(element){
	var element_class = $(element).attr('class');
	if(element_class == 'sub_menu')return;
	var menu_focus = element_class.substr(1,1);

    if(menu_focus =='') return ;
	
	if( menu_focus != menu_id )
	{
 		$('#menu > ul > .m'+menu_id).css(   "background", "url("+img_path+"/menu//button_0"+menu_id+".gif) no-repeat");
    	$('#menu > ul > .m'+menu_focus).css("background", "url("+img_path+"/menu//button_a_0"+menu_focus+".gif) no-repeat");
		menu_id = menu_focus;
		
		
        if($('ul',element).html() != null) $('#menu > .sub').html( $('ul',element).html() );
		else                                $('#menu > .sub').html('<li>&nbsp;</li>');
		
		ul_width = 0;
		$.each( $('#menu > .sub > li') , function(i, n){		
		  $(n).width($(n).width()+10);
		  ul_width = ul_width + $(n).width()+20 ;
		}); 
		$('#menu > .sub').css('margin-left' , (940- ul_width)/2-20 );
	}

  };
    
})
