$(document).ready(function(){
	$(".heaSearch , .login li").each(function(){
	var text = $(this).find("label").remove().text()
	$(this).find("input").addClass("a").val(text)
	.focus(function(){
		if (this.value == text){
			$(this).removeClass("a").val("")
		}
	})
	.blur(function(){
		if (this.value == ""){
			$(this).addClass("a").val(text)
		};
	})
	});
	
	var heightThis = $("#content").height();
	if(heightThis > 600){
	$(".nlbar").height(heightThis-200)
	}else{
	$(".nlbar").height(heightThis-50)
	}
	
		
	$.tabs('tabPage_1');
	$.tabs('tabPage_2');
	$.tabs('tabPage_3');
	$.tabs('tabPage_4');


	//折叠菜单开始
	$("#faqBox h6:first").addClass("on");
	$("#faqBox div:not(:first)").hide();
	$("#faqBox h6").click(function() {
	    $(this).next("div").slideToggle(1)
		.siblings("div:visible").slideUp(1);
	    $(this).toggleClass("on");
	    $(this).siblings("h6").removeClass("on");
	}); //折叠菜单

	//折叠菜单结束

});

$.tabs = function(containerId, start) {
    var ON_CLASS = 'on';
    var id = '#' + containerId;
    var i = (typeof start == "number") ? start - 1 : 0;
    $(id + '>div:eq(' + i + ')').css({display:"block"});
    $(id + '>ul>li:nth-child(' + (i+1) + ')').addClass(ON_CLASS);
    $(id + '>ul>li>a').click(function() {
        if (!$(this.parentNode).is('.' + ON_CLASS)) {
            var re = /([_\-\w]+$)/i;
            var target = $('#' + re.exec(this.href)[1]);
            if (target.size() > 0) {
                $(id + '>div:visible').css({display:"none"});
                target.css({display:"block"});
                $(id + '>ul>li').removeClass(ON_CLASS);
                $(this.parentNode).addClass(ON_CLASS);
            } else {
                alert('无效的选项卡');
            }
        }
        return false;
    });
};

function keyd(btnId, e) {
    if (e == 13) {
        $("#" + btnId).focus();
    }
}
