


$(document).ready(function(){

//{데스크탑 클릭이벤트
		var height_val = 0; // 뎁스 height 중에 가장큰거 구함
		$(".depth_box").each(function(){
			if(height_val<$(this).height()) height_val = $(this).height();
		});

		$("#topMenu").removeAttr("style");
		$('body').removeAttr('style');
		$('.m_menu_wrap_bg').removeAttr('style');
		$('#topMenu li.menu_list a.depth_link').bind("mouseenter keyup", function(){
			$('#topMenu li.menu_list a').addClass("menu_on").not(this).removeClass("menu_on");
			$(".depth_box").show(0).css({"height":height_val});
			$(".depth_box_wra_box").show(0).css({"height":height_val});
			$(".depth_box_wra_box .default_layout").css({"height":height_val});
		});

		
		$("#topMenu").bind("mouseleave" , function(){
			$("#topMenu li.menu_list a").removeClass("menu_on");
			$(".depth_box").hide().removeAttr("style");
			$(".depth_box_wra_box").hide().removeAttr("style");
			$(".depth_box_wra_box .default_layout").removeAttr("style");
		});	
		
	//)데스크탑 클릭이벤트

				

	//}

	//{메뉴별 아이디 추가
	$(".menu_list").each(function(){
		var menu_list_id = $(this).index()
		$(this).attr("id", "topMenu"+menu_list_id);
	});
	//}



	//{상단
	$('.first_top_go').click(function(){
		$("html, body").animate({ scrollTop: 0 }, 200);
	});
	//}

	//메인출력관련
	$(".main_notice dt").first().addClass("fist_title on");
	$(".main_notice dd").first().addClass("first");
	$(".notice_list_ul_box").each(function(){
		var first_li = $(this).children()
		$(first_li).first().addClass("first_li");
	});




	$(".main_etc_notice h3").first().addClass("first_h3");
	$(".main_etc_notice div").first().addClass("on_check");



	//공지사항(탭메뉴 공통적용)
	$('dl.tep_list').each(function(){
		var btn_dt = $(this).children('dt')
		var btn_dd = $(this).children().siblings('dd')
		$(btn_dt).bind("mouseenter keyup" ,function(){
			var box = $(this).next('dd');
			$(this).addClass('on')
			$(btn_dt).not(this).removeClass('on');
			$(btn_dd).not(box).hide();
			$(box).show();
		});
	});
	//}



	
	//증명서발급
	$(".certificate_print").each(function(){
		$(this).on("click", function() {
			var option = "left=80, top=50, width=900, height=850, scrollbars=1";
			window.open(this.href, "certificate_print", option);
			return false;
		});
	});








	$('#favorite').on('click', function(e) {
		var bookmarkURL = window.location.href;
		var bookmarkTitle = document.title;
		var triggerDefault = false;

		if (window.sidebar && window.sidebar.addPanel) {
			// Firefox version < 23
			window.sidebar.addPanel(bookmarkTitle, bookmarkURL, '');
		} else if ((window.sidebar && (navigator.userAgent.toLowerCase().indexOf('firefox') > -1)) || (window.opera && window.print)) {
			// Firefox version >= 23 and Opera Hotlist
			var $this = $(this);
			$this.attr('href', bookmarkURL);
			$this.attr('title', bookmarkTitle);
			$this.attr('rel', 'sidebar');
			$this.off(e);
			triggerDefault = true;
		} else if (window.external && ('AddFavorite' in window.external)) {
			// IE Favorite
			window.external.AddFavorite(bookmarkURL, bookmarkTitle);
		} else {
			// WebKit - Safari/Chrome
			alert((navigator.userAgent.toLowerCase().indexOf('mac') != -1 ? 'Cmd' : 'Ctrl') + '+D 키를 눌러 즐겨찾기에 등록하실 수 있습니다.');
		}

		return triggerDefault;
	});

});


$(window).scroll(function() { $('.right_wing_banner_wrap').animate({top:$(window).scrollTop()+50+"px" },{queue: false, duration: 500});}); 
//{달력
	var date_val = new Date();
	var datepicker_json_enddate;
	var datepicker_json = {
		dateFormat: 'yy-mm-dd',
		monthNames: ['1월','2월','3월','4월','5월','6월','7월','8월','9월','10월','11월','12월'],
		monthNamesShort: ['1월','2월','3월','4월','5월','6월','7월','8월','9월','10월','11월','12월'],
		dayNames: ['일','월','화','수','목','금','토'],
		dayNamesShort: ['일','월','화','수','목','금','토'],
		dayNamesMin: ['일','월','화','수','목','금','토'],
		changeYear: true,
		changeMonth: true,
		yearRange:  "-100:+0"
	}

	var datepicker_load = function() {
		// : 강좌신청
		datepicker_json_enddate = jQuery.extend(true, {}, datepicker_json);
		datepicker_json_enddate.minDate = date_val;
		datepicker_json_enddate.yearRange = date_val.getFullYear()+":"+(date_val.getFullYear()+10);

		$(".sdate_calendar").datepicker(datepicker_json);

		$( ".datepicker_inp_enddate" ).datepicker(datepicker_json_enddate).keyup(function(e) {
			if(e.keyCode == 8 || e.keyCode == 46) {
				$.datepicker._clearDate(this);
			}
		});
	}

	$(function() {
		datepicker_load();
	});
//}



//{달력
	$(function() {
		$(".sdate_calendar_free").datepicker({
			dateFormat: 'yy-mm-dd',
			monthNames: ['1월','2월','3월','4월','5월','6월','7월','8월','9월','10월','11월','12월'],
			monthNamesShort: ['1월','2월','3월','4월','5월','6월','7월','8월','9월','10월','11월','12월'],
			dayNames: ['일','월','화','수','목','금','토'],
			dayNamesShort: ['일','월','화','수','목','금','토'],
			dayNamesMin: ['일','월','화','수','목','금','토'],
			changeYear: true,
			changeMonth: true,
			yearRange:  "-100:+0"
		})
	});


