function toggleAllmenu(){
	var flg = $("#allMenu").css("display");
	$('.allmenu').slideToggle(350);
	
	if (flg == "none")
	{
		click_event('/GNB/ÀüÃ¼¸Þ´º');
	}
}

$(document).ready(function(){
	$('.gnb_depth1').hover(function(){
		$('.hd_bar').stop().animate({'height':'24px'},180);
		$(this).siblings().children('div').stop().animate({'bottom':'-24px'},200);
		$(this).children('div').stop().animate({'bottom':'0px'},200);
	},function(){
		$('.hd_bar').stop().animate({'height':'10px'},250);
		$(this).children('div').stop().animate({'bottom':'-24px'},150);
		if ( $('.nav_gnb li').hasClass('curr') ) {
			$('.nav_gnb .curr').children('div').stop().animate({'bottom':'0px'},200);
			$('.hd_bar').stop().animate({'height':'24px'},200);
		};
	});
	$('.gnb_depth1').focusin(function(){
		$('.hd_bar').css({'height':'24px'});
		$(this).siblings().children('div').css({'bottom':'-24px'});
		$(this).children('div').css({'bottom':'0px'});
	});
	$('.gnb_depth1').focusout(function(){
		$('.hd_bar').css({'height':'10px'});
		$(this).children('div').css({'bottom':'-24px'});
		if ( $('.nav_gnb li').hasClass('curr') ) {
			$('.nav_gnb .curr').children('div').css({'bottom':'0px'});
			$('.hd_bar').css({'height':'24px'});
		};
	});
	$('.nav_gnb_sub .active').each(function(){
		$('.hd_bar').css('height','24px');
		$(this).parents('.nav_gnb_sub').css('bottom','0');
		$(this).parents('.gnb_depth1').addClass('curr');
	});
	$('.nav_gnb .curr,.nav_gnb .active').each(function(){
		if ($.browser.msie) {
			var thisPosition = parseInt($(this).children('a').css('background-position-y')) - 30 + 'px';
			$(this).children('a').css('background-position-y',thisPosition);
		} else {
			var bgPosition = $(this).children('a').css('backgroundPosition');
			var hoverBg = bgPosition.split(' ')[0] + ' ' + (parseInt(bgPosition.split(' ')[1]) - 30 + 'px');
			$(this).children('a').css('background-position',hoverBg);
		}
	});
	$(".nav_gnb li:not('.curr') a").hover(function(){
		if ( $(this).parents('li').attr('class') != 'active' ){
			if ($.browser.msie) {
				var thisPosition = parseInt($(this).css('background-position-y')) - 30 + 'px';
				$(this).css('background-position-y',thisPosition);
			} else {
				var bgPosition = $(this).css('backgroundPosition');
				var hoverBg = bgPosition.split(' ')[0] + ' ' + (parseInt(bgPosition.split(' ')[1]) - 30 + 'px');
				$(this).css('background-position',hoverBg);
			}
		}
	},function(){
		if ( $(this).parents('li').attr('class') != 'active' ){
			if ($.browser.msie) {
				var thisPosition = parseInt($(this).css('background-position-y')) + 30 + 'px';
				$(this).css('background-position-y',thisPosition);
			} else {
				var bgPosition = $(this).css('backgroundPosition');
				var hoverBg = bgPosition.split(' ')[0] + ' ' + (parseInt(bgPosition.split(' ')[1]) + 30 + 'px');
				$(this).css('background-position',hoverBg);
			}
		}
	});
	$('.btn_slt').click(function(){
		var optionList = $('.opt_srch');
		optionList.slideToggle(100);
	});
	$('.opt_srch').mouseleave(function(){
		$('.opt_srch').slideUp(100);
	});
	$('.lst_depth3 .curr').each(function(){
		$(this).parents('.lst_depth3').show();
		$(this).parents('.lst_depth2').show();
	});
	$('.lst_depth2 .curr').each(function(){
		$(this).parents('.lst_depth2').show();
		$(this).children('.lst_depth3').show();
	});
	$('.lst_depth1 .curr').each(function(){
		$(this).children('.lst_depth2').show();
	});
	/*$('.lst_depth1 li > a').each(function(){
		$(this).click(function(){
			$(this).next('.lst_depth2').slideToggle(100);
			if ( $(this).next('div').hasClass('lst_depth2') ) {
				var otherChild = $(this).parent('li').siblings().children('a')
				$(this).css({'font-weight':'bold','color':'#ee5e00'});
				otherChild.css({'font-weight':'normal','color':'#666'});
				otherChild.next('.lst_depth2').slideUp(100);
				var otherGrandchild = otherChild.next('.lst_depth2').children('ul').children('li').children('.lst_depth3');
				otherGrandchild.prev('a').css({'font-weight':'normal','color':'#666'});				
				otherGrandchild.hide();
			}
		});
		if ( $(this).next('.lst_depth2').css('display') == 'block'){
			$(this).css({'font-weight':'bold','color':'#ee5e00'});
		}
		
	});
	$('.lst_depth2 li > a').each(function(){
		if ( $(this).next('.lst_depth3').css('display') == 'block'){
			$(this).css({'color':'#ee5e00'});
		}
		if ( $(this).next('div').hasClass('lst_depth3') ) {
			$(this).parent('li').css('background-image','url(/img/common/bu_plus.gif)');
		}
		$(this).click(function(){
			$(this).next('.lst_depth3').slideToggle(100);
			if ( $(this).next('div').hasClass('lst_depth3') ) {
				var otherChild = $(this).parent('li').siblings().children('a')
				$(this).css('color','#ee5e00');
				otherChild.css('color','#666');
				otherChild.next('.lst_depth3').slideUp(100);
			}
		});
	});*/
	$('.allmenu .allmenu_ct:first').css({'border-left':'2px solid #f20017'});
	$('.allmenu .allmenu_ct:last').css({'border-right':'2px solid #f20017'});
	$('.category_section:first').css({'width':'118px'});
	$('.category_section:last').css({'width':'117px'});
	$('.category_section ul:last').css('border','0');
	$('.ch_score .point').each(function(){
		var rate = $(this).text();
		var ratingNum = parseInt(rate);
		$(this).text('');
		if(ratingNum == 5) {
			$(this).prepend("<div><img src='/img/channel/txt_1.gif'><img src='/img/channel/txt_0.gif'><img src='/img/channel/ico_point.gif'><img src='/img/channel/txt_0.gif'></div>");
		} else {
			$(this).prepend("<div><img src='/img/channel/txt_" + ratingNum*2 + ".gif'><img src='/img/channel/ico_point.gif'><img src='/img/channel/txt_0.gif'></div>");
		}		
		for (var i = 0; i < 5 - ratingNum; i++) {
			$(this).prepend("<span><img src='/img/channel/ico_star_off.gif' /></span>");
		}
		for (var i = 0; i < ratingNum; i++) {
			$(this).prepend("<span><img src='/img/channel/ico_star.gif' /></span>");
		}
	});
});
