var CMenuAnimation = {
    
    _height: 337,
    
    init: function() {
        
        jQuery('#area_ul').show();
        jQuery('.flash .menu a').bind('mouseenter', function() {CMenuAnimation.hover(this)});
        jQuery('#area_ul li').each(function(i) {
            jQuery(this).attr('id', i + '_' + jQuery(this).attr('rel'));
        });
        
        if(jQuery.browser.msie && Math.round(jQuery.browser.version) == 7) {
            this._height = 340;
        }
        
    },
    
    hover: function(obj) {
        var menu_id = jQuery('div:first', obj).attr('id');
        var $li = jQuery('#area_ul li[rel=' + menu_id + ']');
        var i = $li.attr('id').replace('_' + menu_id, '');
        jQuery('#area_ul').css('margin-top', '-' + i * this._height + 'px');
        jQuery('.item', $li).css({'left': '', 'right': '', 'top': '', 'bottom': ''});
        var $first =  jQuery('.first', $li),
            $others =  $li.find('.item:not(.first)');
        
        if($first) {
            this.animate($first, 1000);
        }
        if($others.length) {
            $others.each(function() {
                CMenuAnimation.animate(this, 800, 400);
            });
            
        }
        
        $('.hunter_slogan').show();
        
    },
    
    animate: function(obj, an_time, delay) {
        delay = delay||0;
        var type = $(obj).attr('rel');
        var aObj = {};
        if(type == 'fadein') {
            jQuery(obj).hide();
            jQuery(obj).css('left', 0);
            jQuery(obj).delay(delay).fadeIn(an_time);
        } else {
            aObj[type] = 0;
            jQuery(obj).stop(true).delay(delay).animate(aObj,  an_time, 'easeOutQuint');
        }
        
    }
};

$(document).ready(function() {
  CMenuAnimation.init();
});



