Mys.hrdList = function(config)
{
	Mys.hrdList.superclass.constructor.call(this, config);
};

Ext.extend(Mys.hrdList, Mys.KMAList, {
	boardType : 2,
	dir : "asc",
	order : "start_date",
	pager : new Mys.KMAPager,
	orderValue : "start_date",
	sortText : "교육",
	itemClass : Mys.hrdItem,
	basis : "apply_date",
	timePoint : "future",
	range : "all",
	maxRow : 20,			
						
	headerTemplate : (new Ext.Template([
		'<div class="{headerClassName}">',
			'<table width="100%" border="0" cellspacing="0" cellpadding="0" class="hrd-month-header">',
				'<tr>',
					'<td>',
						'<div class="edu_listBox">',
						'<form class="mys-search-form" onsubmit="return false;" name="form">',
							'<span><img src="/images/edu0219/edu_txt01.gif" alt="찾고자 하는 교육을 검색하세요." /></span>',
							'<ul>',
								'<li><img src="/images/edu0219/edu_txt02.gif" alt="교육분야" /></li>',
								'<li class="selectbox">',
									'<select name="board_id" class="mys-hrd-board-id">',
										'<option>선택하세요.</option>',
										'<option value="79">경영관리</option>',
										'<option value="80">실무/여성/현장</option>',
										'<option value="81">업무수행관리</option>',
										'<option value="82">조직개발/변화혁신</option>',
										'<option value="83">상호작용</option>',
										'<option value="84">HRD전문</option>',
										'<option value="85">글로벌</option>',
										'<option value="86">OA</option>',
										'<option value="87">재무회계/세무/물류</option>',
										'<option value="88">Wiley</option>',
										'<option value="89">감성</option>',
										'<option value="91">지부교육과정</option>',
									'</select>',
								'</li>',
								'<li class="edutit02"><img src="/images/edu0219/edu_txt03.gif" alt="과정명" /></li>',
								'<li class="edubox01"><input type="text" name="keyword" class="mys-hrd-keyword" value=""/></li>',
								'<li class="edutit03"><img src="/images/edu0219/edu_txt04.gif" alt="교육기간" /></li>',
								'<li class="edubox02"><input type="text" name="start_date" class="mys-hrd-start_date" value="" onmouseover=this.value=""; onclick="DP_use(document.form.start_date); return false;" readonly/> ~ </li>',
								'<li class="edubox02"><input type="text" name="end_date" class="mys-hrd-end_date" value="" onmouseover=this.value=""; onclick="DP_use(document.form.end_date); return false;"/></li>',
								'<li class="edufind"><button class="mys-hrd-search-btn" type="submit" style="width:78px; height:18px"><img src="/images/common/btn_search01.gif"></button></li>',
							'</ul>',
						'</div>',
						
						'<div class="t_subComm">',
							'<table summary="공개교육 리스트 입니다.">',
							'<caption>공개교육 리스트</caption>',
							'<colgroup>',				
							'<col width="30%" />',
							'<col width="13%" />',
							'<col width="13%" />',
							'<col width="7%" />',
							'</colgroup>',
							'<thead>',
								'<tr>',						
									'<th>과정명</th>',
									'<th>접수기간</th>',
									'<th>수강기간</th>',
									'<th class="first">수강신청</th>',
								'</tr>',
							'</thead>',
							'</table>',
						'</form>',
						'</div>',
					'</td>',
				'</tr>',
			'</table>',
		'</div>'
	])).compile(),

	setEvents : function(el)
	{
		Mys.hrdList.superclass.setEvents.call(this, el);

		if (!this.headerTemplate)
			return false;


		this.formHrd = this.headerEl.child(".mys-search-form");

		this.formHrd.on("submit", function(){
			this.keyword = this.headerEl.child(".mys-hrd-keyword").dom.getAttribute("value");

			window.location.hash = "#state=list&page=1&start_date=" + this.headerEl.child(".mys-hrd-start_date").dom.getAttribute("value") + "&end_date=" + this.headerEl.child(".mys-hrd-end_date").dom.getAttribute("value") + "&keyword=" + this.headerEl.child(".mys-hrd-keyword").dom.getAttribute("value") + "&board_id=" + this.headerEl.child(".mys-hrd-board-id").dom.getAttribute("value");
			return false;

		}, this);


	},
	/*
	previous : function()
	{
		this.setDate((this.date || new Date).add("mo", -1));
	},
	
	next : function()
	{
		this.setDate((this.date || new Date).add("mo", 1));
	},
	
	setDate : function(date)
	{
		this.convert(date);
		
		this.pager.first();
	},
	
	convert : function(date)
	{
		if(!date)
			return false;
		
		this.date = date;
		
		date.setDate(1);
		
		this.startDate = date.format("Y-m-d");
		this.endDate = date.add("mo", 1).add("d", -1).format("Y-m-d");
	},
	*/
	
	initDate : function(date)
	{
		if(!date)
			var date = new Date;
		
		date.setDate(1);
		
		return date;
	},
	onMove : function()
	{
		if(!this.headerTemplate)
			return ;
		
		var s = parseHash(window.location.hash);
		
		if(s.range)
			this.onRanged();
		else if(s.order)
			this.onSorted();
		
		this.onSetDate();
	},
	
	onSetDate : function()
	{
		if(this.startDate || this.endDate)
			this.date = this.initDate(Date.parseDate(this.startDate || this.endDate, "Y-m-d"));
		
		if(this.date)
			var date = this.date.clone();
		else
			var date = new Date;
		
		date.setDate(1);
	},

	
	showCalendar : function()
	{
    var url = 'http://oldhr.kma.or.kr/kma_hr/popup_calendar_edulist.asp?pyear=' + this.yearEl.dom.value + '&pmonth=' + this.monthEl.dom.value;
    
    var target = 'hrd_calendar';
    
    window.open( url, target,'width=900, height=600, scrollbars=yes,status=yes');
	}
});