﻿jQuery(document).ready(function(){

	jQuery("#top_sub_nav , #top_nav > ul").css("display","none");

		var pingmu_w = document.body.clientWidth;
		var block_right = (pingmu_w - 980 )/2;

	jQuery("#head_bbs > em").bind("mouseover", function() {
		jQuery("#top_sub_nav").css("display","block");
		jQuery("#top_sub_nav").css("right",block_right + "px");
		jQuery("#head_auction , #head_shop").removeClass("hover");
		jQuery("#head_auction > ul , #head_shop > ul").css("display","none");
	});

	jQuery("#head_auction").bind("mouseover", function(){
		jQuery("#head_shop , #head_info").removeClass("hover");
		jQuery("#head_shop ul , #head_info ul").css("display","none");

		jQuery("#top_sub_nav").css("display","none");

		jQuery("#head_auction").addClass("hover");
		jQuery("#head_auction > ul").css("display","block");
	});

	jQuery("#head_info").bind("mouseover", function(){
		jQuery("#head_shop , #head_auction").removeClass("hover");
		jQuery("#head_shop ul , #head_auction ul").css("display","none");

		jQuery("#top_sub_nav").css("display","none");

		jQuery("#head_info").addClass("hover");
		jQuery("#head_info > ul").css("display","block");
	});

	jQuery("#head_shop").bind("mouseover", function(){
		jQuery("#head_auction , #head_info").removeClass("hover");
		jQuery("#head_auction ul , #head_info ul").css("display","none");

		jQuery("#top_sub_nav").css("display","none");

		jQuery("#head_shop").addClass("hover");
		jQuery("#head_shop > ul").css("display","block");
	});

	jQuery("#top_nav > li:not('#head_bbs , #head_auction , #head_shop , #head_info')").bind("mouseover", function(){
		jQuery("#top_sub_nav").css("display","none");
		jQuery("#head_auction , #head_shop , #head_info").removeClass("hover");
		jQuery("#head_auction > ul , #head_shop > ul , #head_info > ul").css("display","none");
	});

	jQuery("body").click(function(){
		jQuery("#top_sub_nav").css("display","none");
		jQuery("#head_auction , #head_shop , #head_info").removeClass("hover");
		jQuery("#head_auction > ul , #head_shop > ul , #head_info > ul").css("display","none");
	});
	
//bbs tr hover styles
	
	jQuery(".wrap .mainbox table tr").hover(
  function () {
    jQuery(this).addClass("hover");
  },
  function () {
    jQuery(this).removeClass("hover");
  });
	
});

//加入收藏js脚本

function AddFavorite(){
 if ( window.sidebar && "object" == typeof( window.sidebar ) && "function" == typeof( window.sidebar.addPanel ) ){
   //  firefox
   window.sidebar.addPanel( document.title, document.location.href, '' );
 }else if ( document.all && "object" == typeof( window.external ) ){
   //  ie
   window.external.addFavorite( document.location.href, document.title );
 }
}

function SetHome(obj,vrl)
{
  try
  {
      obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl);
  }
  catch(err){
      if(window.netscape) {
          try {
                  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); 
          } 
          catch (err) { 
                  alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将[signed.applets.codebase_principal_support]设置为'true'"); 
          }
          var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
          prefs.setCharPref('browser.startup.homepage',vrl);
       }
  }
}
