var tabMenu = function (options) {
    var o = {  // 缺省设置
        type: "click",  // 事件类型
        currentClass: "current",  // 切换的当前类
        tabListItem: null,  // 导航列表项 (如：tablist中的项)
        detailBoxItem: null,  // 切换目标列表项 (如：detailBox中的项)
        currentIndex: 0  // 初始化索引
    }
    for (var p in options) {  // 载入自定义设置
        o[p] = options[p];
    }
    if (!(length in o.tabListItem && length in o.detailBoxItem)) {
        return;
    }
    if (o.tabListItem.length < o.currentIndex + 1) {
        o.currentIndex = 0;
    }
    function skipToItem(idx) {  // 跳转函数

        o.tabListItem.removeClass(o.currentClass);
        o.detailBoxItem.hide();
        o.tabListItem.eq(idx).addClass(o.currentClass);
        o.detailBoxItem.eq(idx).show();
    }

    skipToItem(o.currentIndex, false);  // 初始化项目

    o.tabListItem.each(function (idx, element) {
        var ele = $(element);
        if (element.tagName.toLowerCase() != "a") {
            ele = $(element).find("a").eq(0);
        }
        ele[0].hideFocus = true;
        ele[o.type](function (event) {  // 添加事件
            skipToItem(idx);
            event.preventDefault();
        });
    });
};
$.fn.equalHeightByTarget = function (target) {
	var target = $(target);
	var tH = target.outerHeight();
	var ele = $(this);
	if (ele.outerHeight() < tH) {
		ele.css("height", tH - (ele.outerHeight() - ele.height()) + "px");
	}
};
