$(function() {
	//레프트 메뉴가 mnu_type=='olink' 일 때 새창 이미지 뜨도록....
	/*var imgVar = "/img/common/newwin.gif";
	$('.subleftUL > li > a[href^=http://]').css({background: 'url('+imgVar+') no-repeat right 50%;'});
	$('.subleftUL > li > a[href^=https://]').css({background: 'url('+imgVar+') no-repeat right 50%;'});
	$('.subleftUL > li > ul > li > a[href^=http://]').css({background: 'url('+imgVar+') no-repeat right 50%;'});
	$('.subleftUL > li > ul > li > a[href^=https://]').css({background: 'url('+imgVar+') no-repeat right 50%;'});*/

	//프린트 플러그인 컨트롤 부분
	//$('.link').click(function(){ $.jPrintArea('#cnt') });

	//var CountNum = 1;

	//왼쪽메뉴 펼침부분
	$('.subleftULLI3 > a').click(function(){
		//alert(CountNum);
		//if (CountNum < 2){
			if ($(this).next('.3rd').css("display") == "none") {
				$(this).next('.3rd').show("nomal");
				$('img:first',this).attr('src',$('img:first',this).attr('src').replace('_plus','_minus'));
				$(this).attr('title',$(this).attr('title').replace('펼치기','닫기'));
			}else{
				$(this).next('.3rd').hide("nomal");
				$('img:first',this).attr('src',$('img:first',this).attr('src').replace('_minus','_plus'));
				$(this).attr('title',$(this).attr('title').replace('닫기','펼치기'));
			}
		//}
	});

	$('.subleftULLI3 > a').keypress(function(){
		$(this).click();
	});

	//왼쪽메뉴 펼침부분
	$('.subleftULLI3 > a').keyup(function(){
		//CountNum = CountNum + 1;
		if ($(this).next('.3rd').css("display") == "none") {
			$(this).next('.3rd').show();
			$('img:first',this).attr('src',$('img:first',this).attr('src').replace('_plus','_minus'));
			$(this).attr('title',$(this).attr('title').replace('펼치기','닫기'));
		}
	});

	//왼쪽메뉴 펼침부분
	$('.subleftULLI3 > a').keypress(function(){
		$(this).click();
	});

	//왼쪽메뉴 전체보기 / 전체닫기
	$('#OpenAll').click(function(){
		var BtnName = $('#OpenCloseBtn').attr('src');
		if ((BtnName).indexOf("left_view") > -1){
			$('.subleftUL > li > ul').show("nomal");
			$('.subleftUL > li > a > img').each(function(index, value){
				var imgName = $(this).attr('src');
				if ((imgName).indexOf("_plus")){
					imgName = imgName.replace('_plus','_minus');
					$(this).attr('src',imgName);
				}
			});
			$('#OpenCloseBtn').attr('src',$('#OpenCloseBtn').attr('src').replace('_view','_close'));
			$('#OpenCloseBtn').attr('alt',"왼쪽메뉴 전체닫기 버튼");
		}else{
			$('.subleftUL > li > ul').hide("nomal");
			$('.subleftUL > li > a > img').each(function(index, value){
				var imgName = $(this).attr('src');
				if ((imgName).indexOf("_minus")){
					imgName = imgName.replace('_minus','_plus');
					$(this).attr('src',imgName);
				}
			});
			$('#OpenCloseBtn').attr('src',$('#OpenCloseBtn').attr('src').replace('_close','_view'));
			$('#OpenCloseBtn').attr('alt',"왼쪽메뉴 전체펼침 버튼");
		}
	});

	$('#OpenAll').keypress(function(){
		$(this).click();
	});

	//탑메뉴 텝 전환 (마우스 오버시)
	$('#top_menu > li > a').mouseover(function(){
		$('#top_menu > li > div').css({visibility:'hidden'});
		$('#top_menu > li > a > img').each(function(index, value){
			$(this).attr('src',$(this).attr('src').replace('_on','_off'));
		});
		$('img:first',this).attr('src',$('img:first',this).attr('src').replace('_off','_on'));
		$(this).next('.sub_menuDiv').css({visibility:'visible'});
	});

	//탑메뉴 텝 전환 (온 포커스시)
	$('#top_menu > li > a').focus(function(){
		$(this).mouseover();
		/*$('#top_menu > li > div').css({visibility:'hidden'});
		$('#top_menu > li > a > img').each(function(index, value){
			$(this).attr('src',$(this).attr('src').replace('_on','_off'));
		});
		$('img:first',this).attr('src',$('img:first',this).attr('src').replace('_off','_on'));
		$(this).next('.sub_menuDiv').css({visibility:'visible'});*/
	});

	$("#cal_view").draggable();
	$("#allMenu").draggable();
});

