

$(function() {

/*
下拉菜单函数

*/
function menuShow(mainSeletor, subSeletor, showMotion, hideMotion)
{
    var subSeletor = '$(this).find("' + subSeletor + '").';
    $(mainSeletor).hover(
        function()
        {
        eval(subSeletor + showMotion);
        },
        function()
        {
        eval(subSeletor + hideMotion);	
        }
    );
}
/*
tab函数
1, tab内容一定要放在div里

*/
function tabShow(container, mainSeletor, subSeletor, showClass, currentClass)
{
    $(mainSeletor).mouseover(
    function()
        {
        $(container).find('div').removeClass(showClass);
        
        $(mainSeletor).removeClass(currentClass);
        
        $(this).addClass(currentClass);
        
        $(eval(subSeletor)).addClass(showClass);
        }
    );
}	   
   
   
menuShow('#h-nav ul li.mainItem', 'ul:first', 'removeClass("hidden")', 'addClass("hidden")');
tabShow('#c-p1-right', '#c-p1-right .tab-list a', '"#" + this.id.replace("-link", "")', 'tab-show', 'current');	
tabShow('#c-p1-center', '#c-p1-center .tab-list a', '"#" + this.id.replace("-link", "")', 'tab-show', 'current');	
tabShow('#c-p2-l2', '#c-p2-l2 .tab-list a', '"#" + this.id.replace("-link", "")', 'tab-show', 'current');

var current = $('span.current ').text();
$('#sidebar').find('a:contains(' + current +')').addClass('current');

});

  


