
function equalHeight(group)
{
    tallest = 0;
    group.each(function()
    {
        thisHeight = $(this).height();
        if(thisHeight > tallest)
        {
            tallest = thisHeight;
        }
    });
    group.height(tallest);
}

$(document).ready(function()
{
//======================恢复各模块默认设置===============================
// Layout options feature
$('a#options').click(function (){
    if (($('.layout_options')).is(':hidden')) {
    $('#wrapper').fadeTo('fast', 0.33);
    $('.layout_options').fadeIn('normal');
    } else {
    $('#wrapper').fadeTo('fast', 1.0);
    $('.layout_options').fadeOut('normal');
    }
});

$('.cancel a').click(function() {
    $('#wrapper').fadeTo('fast', 1.0);
    $('.layout_options').fadeOut('normal');
});

$('a#reset').click(function() {
$('.cat-widget').each( function() {$.cookie($(this).attr('id'), null, { path: '/', expires: 100 }); $(this).show()});
$('.box_a').each( function() {$.cookie($(this).attr('id'), null, { path: '/', expires: 100 }); $(this).show()});
$('.widgets li').each (function() {$.cookie($(this).attr('id'), null, { path: '/', expires: 100 }); $(this).show()});
$('.layout_options').fadeOut('normal');
$('#wrapper').fadeTo('fast', 1.0);
});
//======================Done.....==========================================

// Drop Down Menu (2 Levels)
//$('#menu ul ul').hide(0.000000000000000000000000000000000000001);
//$('#menu ul li a').addClass('nav_parent');
//$('#menu ul ul a').removeClass('nav_parent');
//$('#menu ul ul a').addClass('nav_child');
//
//$('.nav_parent').bind('mouseenter', function() {
//    if (($(this).next().is('ul')) && ($(this).next().is(':visible'))) {
//    return false;
//    } else if (($(this).next().is('ul')) && ($(this).next().is(':hidden'))) {
//    $(this).next().show();
//    return false;
//    }
//});
//
//$('.nav_parent').parent().bind('mouseleave', function() {
//    $('#menu ul ul:visible').hide();
//});
// End of Menu


//======================下拉菜单 两级===============================
// Drop Down Menu (multi level)
$("#menu ul li").hover(function(){
$(this).find('ul:first').css({visibility: "visible",display: "none"}).slideDown(300);
},function(){
$(this).find('ul:first').css({visibility: "hidden"});
});
// End of Menu
//===================================================================


/* various widget actions */
$('.minimize').click(function() {
    $(this).parent('h3').next('.container').toggle();
});

$('.Sminimize').click(function() {
    $(this).parent('h2').next().toggle();
});

$('.Wminimize').click(function() {
    $(this).parent('h2').next().toggle();
});

$('.close').click(function() {
    $(this).parent('h3').parent('.cat-widget').fadeOut('slow');
    $.cookie($(this).parent('h3').parent('.cat-widget').attr('id'), 'closed', { path: '/', expires: 100 });
    return false;
});

$('.Sclose').click(function() {
    $(this).parent('h2').parent().fadeOut('slow');
    $.cookie($(this).parent('h2').parent('.box_a').attr('id'), 'closed', { path: '/', expires: 100 });
    return false;
});

$('.Wclose').click(function() {
    $(this).parent('h2').parent().fadeOut('slow');
    $.cookie($(this).parent('h2').parent('li').attr('id'), 'closed', { path: '/', expires: 100 });
    return false;
});

$('.cat-widget').each( function() {
    var cat_ID = $(this).attr('id');
    if ($.cookie(cat_ID) == 'closed') $(this).hide();
});

$('.box_a').each( function() {
    var box_ID = $(this).attr('id');
    if ($.cookie(box_ID) == 'closed') $(this).hide();
});

$('.widgets li').each (function() {
    var sidebar_ID = $(this).attr('id');
    if ($.cookie(sidebar_ID) == 'closed') $(this).hide();
});

/* control visible stories */
$('ul.more_stories').each(function(index) {
$(this).children('li').slice(3).hide();
});

$('.minus').click(function() {
$(this).parent().next('ul').children('li:visible:last').hide();
});

$('.plus').click(function() {
$(this).parent().next('ul').children('li:hidden:first').show();
});

/* clear form */
clearInput('#feedemail');

$('.videothumb').bind('mouseenter', function() {
$(this).children('.playit').children('a').fadeTo('fast', 0.50);
$(this).children('.playit').children('a').show();
return false;
});

$('.videothumb').bind('mouseleave', function() {
$(this).children('.playit').children('a').hide();
return false;
});

});