jQuery("#hd .gnb.line").removeClass("line");

jQuery(function() {
    jQuery(".product > .best-item-list").mouseover(function() {
        jQuery(this).find(".infobox").show();
    });

    jQuery(".product > .best-item-list").mouseleave(function() {
        jQuery(this).find(".infobox").hide();
    });

    jQuery(".product > .best-item-list > .infobox").mouseover(function() {
        jQuery(this).show();
    });

    jQuery(".product > .best-item-list > .infobox").mouseleave(function() {
        jQuery(this).hide();
    });
});






(function($) {
    $.fn.rotateTabs = function(opts) {
        var options = $.extend({}, $.fn.rotateTabs.defaults, opts);
 
 
        var timer = null;
        var $tabs = $(this);
		var tab = options.tab_selector != null ? options.tab_selector + ' > li' : '> ul > li';
		var content = options.content_selector != null ? options.content_selector + ' > div' : '> div';
 
 
        return this.each(function() {

            if (options.click) {
                $(tab, $tabs).click(tabs_event);
            } else {
                $(tab, $tabs).click(function() { return false; });
	            $(tab, $tabs).mouseenter(tabs_event);
            }
 
 
            $tabs.mouseover(function() {
                window.clearTimeout(timer);
            });
            $tabs.mouseout(function() {
                tabs_init();
            });
 
 
            var start = options.start;
            if (options.random_start == true) {
                start = Math.floor(Math.random() * $(tab, $tabs).length);
            }
 
 
            $(tab, $tabs).eq(start).addClass('ui-tabs-selected').addClass('ui-state-active'); 
            $(content, $tabs).eq(start).removeClass('ui-tabs-hide').css('display', 'block'); 			

            tabs_init();
        });
 
 
        function tabs_init() {
            window.clearTimeout(timer);
 
            if (options.rotate == true) {
                timer = window.setInterval(function() {
                    var $obj = $(tab + '.ui-tabs-selected', $tabs);
                    var index = $obj.index();
                    $obj.removeClass('ui-tabs-selected').removeClass('ui-state-active');
 
 
                    if ($(tab, $tabs).length > index+1) index ++;
                    else index = 0;
 
 
                    $(tab, $tabs).eq(index).addClass('ui-tabs-selected').addClass('ui-state-active');
 
                    $(content, $tabs).addClass('ui-tabs-hide').css('display', 'none');
					if (options.fade == false) {
	                    $(content, $tabs).eq(index).removeClass('ui-tabs-hide').css('display', 'block');
					} else {
		                $(content, $tabs).eq(index).stop().removeClass('ui-tabs-hide').css({'display': 'block', 'opacity': '0'}).animate({'opacity': '1'}, {duration: options.speed, easing: 'linear', complete: function() {  } });
					}

                }, options.sec);
            }
        }
 
 
        function tabs_event() {
            window.clearTimeout(timer);
 
            var $obj = $(tab + '.ui-tabs-selected', $tabs);
            var old_index = $obj.index();
            $obj.removeClass('ui-tabs-selected').removeClass('ui-state-active');
 
 
            var index = $(this).index();
            $(tab, $tabs).eq(index).addClass('ui-tabs-selected').addClass('ui-state-active'); 
 
 
            $(content, $tabs).addClass('ui-tabs-hide').css('display', 'none');
			if (options.fade == false) {
				$(content, $tabs).eq(index).removeClass('ui-tabs-hide').css('display', 'block');
			} else {
				$(content, $tabs).eq(index).stop().removeClass('ui-tabs-hide').css({'display': 'block', 'opacity': '0'}).animate({'opacity': '1'}, {duration: options.speed, easing: 'linear', complete: function() {  } });
			}

            return false;
        }
    };
 
 
    $.fn.rotateTabs.defaults = {
        tab_selector: null,
        content_selector: null,
		fade: false,
        speed: 400,
        start: 0,
        random_start: false,
        click: false,
        rotate: true,
        sec: 3000
    };
 
 
})(jQuery);





// WEEKLY BEST ÅÇ
$(document).ready(function() {
	if ($('.tab_normal_row').length) {
		$('.tab_normal_row').rotateTabs({
			tab_selector: '.tab_normal_tab_nav',
			content_selector: '.tab_normal_tab_contents',
			click: false,
			rotate: true,
			sec: 3000
		});
	}
});




//»óÇ° ¸¶¿ì½º¿À¹ö½Ã

$(document).ready(function() {
	if ($('.hover_action').length) {

		$('.hover_action').mouseover(function() {
			if (!$(this).hasClass('no_image_hover')) {
				$(this).find('li.item').each(function() {
					if (!$(this).find('.prdImgWrap').length) {
						$(this).find('.prdImg').wrap('<div class="prdImgWrap" />');
						$(this).find('.prdImgWrap').append('<div class="prdImgBg" />');
						$(this).find('.prdImgWrap').append('<div class="prdImgButton" />');

						// »óÇ°¸í, ÆÇ¸Å°¡µµ ¼ÂÆÃ
						$(this).find('.prdImgButton').append($(this).find('.product_contents_info').html());


						// ¾Æ¹«°÷ÀÌ³ª Å¬¸¯ÇØµµ »ó¼¼È­¸éÀ¸·Î ÀÌµ¿Ã³¸®
						var href = $(this).find('p.name a').attr('href');
						$(this).find('.prdImgBg').bind('click', function() {
							document.location.href = href;
							return false;
						});
						$(this).find('.prdImgButton').bind('click', function() {
							document.location.href = href;
							return false;
						});

					}
				});
			}
		});


		$('.hover_action li.item .prdImgWrap').live('mouseenter', function() {
			var width = $(this).find('.prdImg').outerWidth();
			var height = $(this).find('.prdImg').outerHeight();
			$(this).find('.prdImgBg').css({'overflow': 'hidden', 'width': width + 'px', 'height': height + 'px'});
	
			$(this).find('.prdImgBg').css('opacity', '0').css('display', 'block'); 
			$(this).find('.prdImgBg').stop().animate({'opacity': '1'}, 'slow');

			$(this).find('.prdImgButton').css({'display': 'block', 'width': width + 'px', 'height': height + 'px'}); 
		});

		$('.hover_action li.item .prdImgWrap').live('mouseleave', function() { 
			$(this).find('.prdImgButton').css({'display': 'none'}); 
			$(this).find('.prdImgBg').stop().animate({'opacity': '0'}, 'slow');
		});

	}
});



