/*-------------初始化操作开始-------------*/
jQuery(function($) {
	//初始化tabpage
	if($("#tab")){
	  //找到tab_title和tab_page对象
	  var tab_title_arr = $("table[id='tab_title'] tr td")
	  var tab_page_arr = $("table[id='tab_page'] tr[id!='']")
	  
	  //给予样式，鼠标悬停-手
	  tab_title_arr.css("cursor","pointer");
	  
	  //给予点击事件
	  tab_title_arr.click(
		  function () {
			//背景-更换
			$("#tab_title").attr("background","../images/"+$(this).attr("id")+".gif");
			if($.browser.mozilla){ 
				//tab_page更换
				tab_page_arr.hide("slow");//首先隐藏所有tabpage
				//显示指定页
				$("#"+$(this).attr("id")+"_page").show("slow");
			}else{
				//tab_page更换
				tab_page_arr.hide();//首先隐藏所有tabpage
				//显示指定页
				$("#"+$(this).attr("id")+"_page").show();
			}
		  } 
	  )
	}
	
	//初始化top、back按钮
	if($(".top_button")){
	  var top_btn_obj = $(".top_button");
	  top_btn_obj.css("cursor","pointer");
	  top_btn_obj.click(function(){document.location='#'});
	}
	if($(".back_button")){
	  var back_btn_obj = $(".back_button");
	  back_btn_obj.css("cursor","pointer");
	  back_btn_obj.click(function(){history.back()});
	}
	//初始化左侧menu
	//  if($("#public_seminar_menu")){
	//	  //$("#public_seminar_menu").css("display","none");
	//	  $("#public seminar_menu").show("slow");
	//  }
	//  if($("#in-house_training_menu")){
	//	  //$("#in-house_training_menu").css("display","none");
	//	  $("#in-house training_menu").show("slow");
	//  }
	//初始化顶部menu
	if($("#top_menu")){
		//找对象
		var top_menu_arr = $("#top_menu img[id!='online_apply']");
		//设CSS
		top_menu_arr.css("cursor","pointer");
		//事件
		top_menu_arr.hover(
			function(){
				
				if($("body").attr("id")==$(this).attr("id")){
					$(this).attr("src","../images/"+$(this).attr("id")+"a.gif");
				}
				else
					$(this).attr("src","../images/"+$(this).attr("id")+"b.gif");
			},
			function(){
				if($("body").attr("id")!=$(this).attr("id")){
					$(this).attr("src","../images/"+$(this).attr("id")+"a.gif");
				}
//				if($("body").attr("id")==$(this).attr("id")){
//					$(this).attr("src","../images/"+$(this).attr("id")+"b.gif");
//				}
//				else
//					
			}
		)
	}
	//改变当前页的menu
	if($("body")){
		var body_id = $("body").attr("id");
		if($("#top_menu")){
			$("#top_menu img[id='"+body_id+"']").attr("src","../images/"+body_id+"b.gif")
		}
	}
	//初始化首页logo
//	if($("boody")){
//		var body_id = $("body").attr("id");
//		if (body_id == "menu_01" && $("#top_logo")){
//			$("#top_logo").attr("src","../images/top_index.jpg");
//		}
//		else{
//			$("#top_logo").attr("src","../images/top.jpg");
//		}
//	}
	//初始化下拉菜单
	$("#nav-one li").hover(
		function(){ $("ul", this).fadeIn("slow"); }, 
		function() { } 
	);
    if (document.all) {
		$("#nav-one li").hoverClass ("sfHover");
	}
}); 
/*-------------初始化操作结束-------------*/
$.fn.hoverClass = function(c) {
	return this.each(function(){
		$(this).hover( 
			function() { $(this).addClass(c);  },
			function() { $(this).removeClass(c); }
		);
	});
};
