// flash
function Flash(Url, wd, ht, swfId, wm, vars) {// °æ·Î,°¡·Î,¼¼·Î,ID,Åõ¸í,º¯¼ö
	var TxtSwf = "" ;
	TxtSwf += "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0' width='"+ wd +"' height='"+ ht +"' id='"+ swfId +"'>" ;
	TxtSwf += "<param name='movie' value='"+ Url +"'>" ;
	TxtSwf += "<param name='wmode' value='"+ wm +"'>" ;
	TxtSwf += "<param name='FlashVars' value='MenuPath=/GTPS/flash/gnb/navigationXml01.xml'>" ;
	TxtSwf += "<param name='allowScriptAccess' value='always'>" ;
	TxtSwf += "<param name='allowFullScreen' value='true'>" ;
	TxtSwf += "<param name='swliveconnect' value='true'>" ;
	TxtSwf += "<param name='quality' value='high'>" ;
	TxtSwf += "<param name='menu' value='false'>" ;
	TxtSwf += "<embed src='"+ Url +"' width='"+ wd +"' height='"+ ht +"' wmode='"+ wm +"' name='"+ swfId +"' FlashVars='MenuPath=/GTPS/flash/gnb/navigationXml01.xml' allowScriptAccess='always' allowFullScreen='true'  quality='high' menu='false' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash'></embed>" ;
	TxtSwf += "</object>" ;
	document.write (TxtSwf);
}

$(document).ready(function(){
	//main tab
	$('#noticeDiv').hide();
	$('.mtab_news img').eq(0).click(function (){
		$('#noticeDiv').hide();
		$('.mtab_news img').eq(1).attr('src',$('.mtab_news img').eq(1).attr('src').replace('on','off'));
		$(this).attr('src',$(this).attr('src').replace('off','on'));
		$('#newsDiv').show();
	});
	$('.mtab_news img').eq(1).click(function (){
		$('#newsDiv').hide();
		$('.mtab_news img').eq(0).attr('src',$('.mtab_news img').eq(0).attr('src').replace('on','off'));
		$(this).attr('src',$(this).attr('src').replace('off','on'));
		$('#noticeDiv').show();
	});

	//lnb
	$('.grenlnb .dep02').hide();
	if ($('.grenlnb .dep01 > li:first-child > .dep02')){
		$('.grenlnb .dep01 > li:first-child > .dep02').show();
	}
	$('.grenlnb .dep01 a').click(function(){
		var lnbImg = $('.grenlnb .dep01 a > img');
		lnbImg.each(function(index){
			lnbImg.eq(index).attr('src',lnbImg.eq(index).attr('src').replace('on','off'));
		});
		$('.grenlnb .dep02 > li').removeClass('on');
		var lnb2dep = $('.grenlnb .dep02');
		lnb2dep.each(function(index){
			lnb2dep.eq(index).hide();
		});
		if ($(this).parent().parent().hasClass('dep02')){
			$(this).parent().parent().show()
			$(this).parent().parent().siblings('a').children().attr('src',$(this).parent().parent().siblings('a').children().attr('src').replace('off','on'));
		};
		$(this).children().attr('src',$(this).children().attr('src').replace('off','on'));
		$(this).parent().siblings().removeClass('on');
		$(this).parent().addClass('on');
		$(this).siblings().children('li').eq(0).addClass('on');
		if ($(this).siblings().hasClass('dep02')){			
			$(this).siblings().show();
			$(this).siblings().children().children().children().eq(0).attr('src',$(this).siblings().children().children().children().eq(0).attr('src').replace('off','on'));
		}
	});
	$('.grenlnb .dep01 img').hover(function(){
		if ($(this).parent().parent().hasClass('on') == false){$(this).attr('src',$(this).attr('src').replace('off','on'));}
	},function(){
		if ($(this).parent().parent().hasClass('on') == false){$(this).attr('src',$(this).attr('src').replace('on','off'));}
	});
});




