/*------------------------------------------------------------
* Description：Special effects of the website, based on JQuery
* Author：Gavin
* E-mail: shengzhizhang@gmail.com
* Created On：2008-10-27
* Last modification On：2010-01-27 
------------------------------------------------------------*/

$(document).ready(function(){
						   
	// eliminate the dashed box of the links 
	$("a").bind("focus",function(){
    	if(this.blur){
        	this.blur();
        }
    });


	//sub navigation
	$("#subNav ul li").bind("mouseenter", function(){
		$(this).children("a").addClass("active").end()
		.children("ul").show().end()
		.parent().siblings().children("a").removeClass("active");
	}).bind("mouseleave", function(){
		$(this).children("a").removeClass("active").end()
		.children("ul").hide();
	});
	
	// Hilight sub navigation
	//$("#subNav .current").parents("ul").show();

    // Default buttons
    $('.defaultBtn').hover(
		// mouseover
		function(){ $(this).addClass('defaultBtnHover'); },
		
		// mouseout
		function(){ $(this).removeClass('defaultBtnHover'); }
	);
	
	// Adaptive width of the form labels
	var max = 0;  
	$("label").each(function(){  
		if ($(this).width() > max) max = $(this).width();  
	});  
	$("label").width(max);
	
	$("#mainTitle span a:last").addClass("current");

	// Zebra table
	//$(".zebra tr:even").addClass("even");

    // Member toolbar
	$("#toolbarHandler, .toolbar").bind("mouseover",function(){
			$("#toolsList").show();
		}).bind("mouseout",function(){
			$("#toolsList").hide();
		});

    //高亮首页
	var str=window.location.href;
	var r=/[^\/]+$/.exec(str);
	if(r==null || window.location.pathname.indexOf('index')!=-1){
	    $("#mainNav li:first a").addClass("current");
	};
	
});
