/*****************************************************************************
 * 파일명 : main.js
 * 작성일 : 
 * 작성자 : 
 * 설   명 : main 기본기능  javascript 정의 파일
 * 
 * ===========================================================================
 * 변경이력:
 * DATE				AUTHOR		DESCRIPTION
 * ---------------------------------------------------------------------------
 * 
 *****************************************************************************/
mainSample.main = {} ;

mainSample.main.test = function() {
	return {
		// 화면 초기화
		initialize: function() {
			if($('newNoticeSeqNo').value != "0")
				mainSample.main.test.go_new_notice_popup($('newNoticeSeqNo').value);
		},
		go_new_notice_popup: function(seqNo) {
				var formObj = $("mainForm");
				$("clickNo").value = seqNo;
				if ( mainSample.main.test.getCookie( "pubNotice" ) != "done" ){	
					var url = jsl.APPLICATION_CONTEXT_ROOT + "/comm/notiPopupSelect.action";
					JslWindow.openwin(url, formObj, 'notiP', '750', '650', 'auto');
				}			
		},
		// 공지사항 상세조회
		go_select: function(seqNo, type) {
			$("clickNo").value = seqNo;
			if (type == 'notice') {
				var url = jsl.APPLICATION_CONTEXT_ROOT + "/comm/notiSelect.action";
			} else if (type == 'news') {
				var url = jsl.APPLICATION_CONTEXT_ROOT + "/comm/newsSelect.action";
				$('dataGbn').value = 1;
			} else {
				var url = jsl.APPLICATION_CONTEXT_ROOT + "/comm/introSelect.action";
			}
			$("mainForm").action = url;
			$("mainForm").submit();

		},
		// 시작일 달력	
		stdtImgClick: function() {
			//Calendar(mainForm.stdt);
		},
		getCookie: function(name) {
			var nameOfCookie = name + "=";
			var x = 0;
			while ( x <= document.cookie.length )
			{
			var y = (x+nameOfCookie.length);
			if ( document.cookie.substring( x, y ) == nameOfCookie ) {
			if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
			endOfCookie = document.cookie.length;
			return unescape( document.cookie.substring( y, endOfCookie ) );
			}
			x = document.cookie.indexOf( " ", x ) + 1;
			if ( x == 0 )
			break;
			}
			return "";

		}		
	}
}();

Event.observe(window, 'load', mainSample.main.test.initialize);

