$(document).ready(function(){
$(".mainCategory dl").css("z-index", "3");
$("#mainCategory").homeDirectory();

$("#testtab").tab({
    tabId:"#tabtag",
    tabTag:"li",
    conId:"#tabcon",
    conTag:".tabcon",
    auto:true,
    act:"mouseover"
})

$(".fs,#option_3").hover(
  function () {
	$(".fb").removeClass("current");
    $(".fs").addClass("current");
	$("#option_2").hide();
	$("#option_3").show();
  },
  function () {
	$(".fs").removeClass("current");
    $(".fb").addClass("current");
	$("#option_3").hide();
	$("#option_2").show();
  }
);
	
	$('.forSupp1').bind('mouseover', function() {
		$(".forSupp1 > div").addClass("close");
		$(".forSupp1 > ul,.forSupp1 > a").show();
		$(".forSupp2 > a > img").attr("src","images/bg_51.gif");
		$(".forSupp2 > ul").hide();
		$(".forSupp2 > a").eq(1).hide();
		$(".forSupp2 > a").eq(2).hide();
	});
	
	$('.forSupp2').bind('mouseover', function() {
		$(".forSupp2 > a > img").attr("src","images/bg_51_02.gif");
		$(".forSupp2 > ul,.forSupp2 > a").show();
	  	$(".forSupp1 > div").removeClass("close");
		$(".forSupp1 > ul,.forSupp1 > a").hide();
	});
	var buff="";
	buff+="<div class='button close'>&nbsp;</div>";
	buff+="<img src='/images/goldSite.gif' border='0' width='65' height='13'/><span>海商网国际站</span>";
	buff+="<ul>";
	buff+="<li>打破传统B2B推广模式，采用全球领先的W.B.S推广技术和W.B.O推广理念</li>"
		+"<li>后台功能强大，操作便捷</li>"
		+"<li>\"一站\"到位，省时省力</li>"
		+"<li>宣传面最广，推广力度最大</li>"
		+"<li>建设品牌，做到可持续发展</li>"
		+"<li>性价比最高，服务最好</li>";
	buff+="</ul>";
	buff+="<a href='http://account."+HI_DOMAIN+"/user/exporter_apply.htm' rel='nofollow' target='_blank'>立即申请</a><a rel='nofollow' href='/exporter/index.html' target='_blank'>了解更多</a>";
	$("#forSupp1").html(buff);
	buff="<a href='/certified-supplier/index.html' style='padding:0;' target='_blank'>";
	buff+="<img src='/images/bg/bg_51.gif' width='164' height='40' border='0'/> </a>";
	buff+="<ul style='display:none;'>"
		+"<li>更符合国际采购标准</li>"
		+"<li>增加营运透明度，提升品牌信誉度</li>"
		+"<li>赢取高度的贸易信用，增加谈判筹码</li>"
		+"<li>展现综合实力，改善薄弱环节</li>"
		+"<li>在对手中脱颖而出，吸引国外买家眼球</li>";
	buff+="</ul>";
	buff+="<a href='http://account."+HI_DOMAIN+"/user/apply_cn.htm' target='_blank' style='display:none;' rel='nofollow'>立即申请</a><a rel='nofollow' href='/certified-supplier/profile-cn.html' target='_blank' style='display:none;'>了解更多</a>";
	$("#forSupp2").html(buff);
	$("#tabtag").find("li").mouseover(function(){
		if(parseInt($(this).html())==2){
			$("#showtitle").html("Featured Suppliers");
		} else {
			$("#showtitle").html("Spotlight Exhibits");
		}
	});
});

(function($){
	$.fn.homeDirectory=function(options){
		options=$.extend($.fn.homeDirectory.defaults,options);
		options.randid=$(this).attr("id");
		var headwidth;
		var container;
		$("#"+options.randid+" "+options.element).hover(function(){
			container=$(this);
			headwidth=container.width();
			container.find("dd").css("left",headwidth+options.offX).css("display","block");
			container.addClass('upperdd');
		},function(){
			container.removeClass('upperdd');
			container.find("dd").css("display","none");
		});
	}
	$.fn.homeDirectory.defaults={
		element:"dl",
		offX:-2
	}
})(jQuery);
