function returnObject(frmIndex,eleIndex,errMessage){
	if(errMessage!='')
		alert(errMessage);
	document.forms[frmIndex].elements[eleIndex].focus();
}

function submitFrm(frmIndex){
	document.forms[frmIndex].submit();
}

function chkKeydown()
{
	if(event.keyCode ==13)//enter
	{
		searchFrm();
	}    
}

function checkAll(frmIndex){
	var totalCount=document.forms[frmIndex].chkID.length;	
	if(totalCount>1){
		if(document.forms[frmIndex].chkID[0].checked){
			for(i=0;i<totalCount;i++){
				document.forms[frmIndex].chkID[i].checked=false;
			}
		}else{
			for(i=0;i<totalCount;i++){
				document.forms[frmIndex].chkID[i].checked=true;
			}
		}
	}else{
		if(document.forms[frmIndex].chkID.checked)
			document.forms[frmIndex].chkID.checked=false;
		else
			document.forms[frmIndex].chkID.checked=true;
	}
	return;
}

function checkAllS(frmIndex){
	var totalCount=document.forms[frmIndex].chkID.length;
	var nChkID;
	if(totalCount>1){
		if(document.forms[frmIndex].CACheckBox.checked){
			for(i=0;i<totalCount;i++){
				nChkID=document.forms[frmIndex].chkID[i];
				if(nChkID.disabled==true){
					nChkID.checked=false;
				}else{
					nChkID.checked=true;
				}
			}
		}else{
			for(i=0;i<totalCount;i++){
				nChkID=document.forms[frmIndex].chkID[i];
				nChkID.checked=false;
			}
		}
	}else{
		if(document.forms[frmIndex].CACheckBox.checked){
			nChkID=document.forms[frmIndex].chkID;
			if(nChkID.disabled==true){
				nChkID.checked=false;
			}else{
				nChkID.checked=true;
			}
		}else{
			document.forms[frmIndex].chkID.checked=false;
		}
	}
	return;
}

function movePage(mPage,sURL){
	//setValue();
	document.actFrm.action=sURL;
	document.actFrm.nowPage.value=mPage;
	document.actFrm.submit();
}

function chkMove(mPage,totalPage,sURL){
	if(mPage.value==''){
		alert("ÆäÀÌÁö ¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		mPage.focus();
		return;
	}
	if(mPage.value*1>totalPage*1){
		alert("ÀÌµ¿ÇÏ·Á´Â ÆäÀÌÁö ¹üÀ§¸¦ ³Ñ¾î¼¹½À´Ï´Ù");
		mPage.focus();
		return;
	}
	setValue();
	document.actFrm.action=sURL;
	document.actFrm.nowPage.value=mPage.value;
	document.actFrm.submit();
}

function openWin(oURL,wwidth,wheight){
	window.open(oURL,"openWindow","left=0,top=0,width="+wwidth+",height="+wheight+",scrollbars=yes,resizable=yes,menubar=no,status=no,toolbar=no,location=no");
}


function openWinS(oURL,wwidth,wheight){
	window.open(oURL,"openWindow","left=0,top=0,width="+wwidth+",height="+wheight+",scrollbars=no,resizable=yes,menubar=no,status=no,toolbar=no,location=no");
}

function dataClear(i){
	opener.document.actFrm.applyData1.value='';
	opener.document.actFrm.applyData2.value='';
	opener.document.actFrm.applyData3.value='';
	opener.document.actFrm.applyData4.value='';
	opener.document.actFrm.applyType[i].checked=true;
}


// for Publishing Tool
function OpenWin(URL,WinName,x,y,Menu,cSize,scroll) 
{
	var features;
	
	var nTop = (screen.height - y) / 2 - 30;
	var nLeft = (screen.width - x) / 2;
	
	if (Menu == 0 )
		features = "toolbar=no,width=" + x + ",height=" + y + ",top=" + nTop + ",left=" + nLeft + ",status=no,menubar=no";
	else
		features = "toolbar=no,width=" + (x + 18) + ",height=" + y + ",top=" + nTop + ",left=" + nLeft + ",status=no,menubar=yes";
	
	if (cSize == 0)
		features = features + ",resizable=no";
	else
		features = features + ",resizable=yes";
	
	if (scroll == 0 )
		features = features + ",scrollbars=no";
	else
		features = features + ",scrollbars=yes";
	
	//alert(features);
	
	TheWindow = window.open(URL, WinName, features);
}


//-----------------------------------------------------------------------------------------
// ´Þ·Â ÆË¾÷Ã¢ Ãâ·Â °ü·Ã ÇÔ¼ö
//-----------------------------------------------------------------------------------------
var ns = (document.layers)? true:false;
var ie = (document.all)? true:false;
var doc = (ie)? document.all : document;

function callCalendar(datetime,field){
		dateField = field;
		__showCalendarPanel(datetime,'::');
} 

function __showCalendarPanel(type, param, title, x, y)
{
		if(param == null){
			alert("Javascript:__showCalendarPanel: You must specify the parameter");
			return;
		}
		var separator = ":";
		var pa = param.split(separator);
		
		if(pa.length != 3)	//<= 1 || (pa[0].length <= 0 && pa[1].length <= 0)) 
		{
			alert("Javascript:__showCalendarPanel: You must specify INPUT objects name to be set to local datetime or GMT one");
			return;
		}

		var left = 100;
		var top = 200;
		if(x != null) left = x;
		if(y != null) top = y;
		
		var url = "/include/common/calendar.asp?type=" + type + "&objLocalDate=" + pa[0] + "&objGMTDate=" + pa[1] + "&initDateTime=" + pa[2] + ( title != null ? "&title=" + title : "");
		var width  = (ie) ? "230":"240";
		if( type == "date" )
			var height = (ie) ? "288":"293";
		else
			var height = (ie) ? "318":"323";
		var ws  = "left=" + left + ",top=" + top + ",menubar = no,width=" + width + ",height=" + height + ",resizable=no,scrollbars=no";
		window.open(url, "__newWin", ws);
}
function setDateTime(local, gmt, type){
	if(type=='date'){
		dateField.value = local.substring(0, 4)
						+ "-" + local.substring(4, 6)
						+ "-" + local.substring(6, 8);
	}
	else{
		dateField.value = local.substring(0, 4)
						+ "-" + local.substring(4, 6)
						+ "-" + local.substring(6, 8)
						+ " " + local.substring(8, 10)
						+ ":" + local.substring(10, 12);
	}

}
