/*************************************************************************/
/*  1. ½Ã ½º ÅÛ ¸í : °øÅë                                                */
/*  2. ÇÁ·Î±×·¥ ID : common.js                                           */
/*  3. ÇÁ·Î±×·¥ ¸í : Àü·«¹°ÀÚ JavaScript ÇÔ¼ö ¸ðÀ½                       */
/*  4. ÀÛ  ¼º   ÀÏ : 2004.10.25                                          */
/*  5. ÀÛ  ¼º   ÀÚ : ÇÑ½ÂÈÆ                                              */
/*  6. °³       ¿ä : ¾÷¹« ³»¿ë°ú °ü·ÃµÈ JavaScript ÇÔ¼ö¸¦ Á¤ÀÇÇÑ´Ù.      */
/*************************************************************************/
/* LAST DATE    Author   DESCRIPTION                                     */
/* -----------  -------  ----------------------------------------------- */
/* 2004.10.25   ÇÑ½ÂÈÆ   ÃÖÃÊ»ý¼º                                        */
/*************************************************************************/

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}


/**
 * onLoad ÇÔ¼ö°¡ ÇÊ¿ä½Ã ÀçÁ¤ÀÇÇØ¼­ »ç¿ëÇÒ °Í
 *
 *  include/header_perm.jsp¿¡ µî·ÏµÈ frame_init() ÇÔ¼öÀÓ... ¾øÀ» °æ¿ì´Â ÀÌ ÇÔ¼ö·Î..
 * °³º°´Ü¿¡¼­ »ç¿ë ½Ã´Â °¢ È­¸é¿¡¼­ ±¸ÇöÇÏ¿© onLoad ½Ã »ç¿ëÇÏ¸é µÊ
 *
 */
function frame_init(){

}


/**
 * È­¸éÀÇ Áß¾Ó¿¡ ÁÖ¾îÁø Å©±â·Î »õÃ¢À» ¶ç¿î´Ù.
 *
 * @param url    È­¸é¿¡ º¸¿©ÁÙ URL
 * @param width  »õÃ¢ÀÇ Æø
 * @param height »õÃ¢ÀÇ ³ôÀÌ
 */
var newWindow;
function searchWin(url, width, height) {
	var pX = (screen.Width  - width ) / 2; // »õ·Î Ã¢À» ¶ç¿ï À§Ä¡ X ÁÂÇ¥
	var pY = (screen.Height - height ) / 2; // »õ·Î Ã¢À» ¶ç¿ï À§Ä¡ Y ÁÂÇ¥
	var newWindow;
	var option = "toolbar=no,location=no,directories=no,scrollbars=yes,resizable=yes,titlebar=no,status=no,dependent=yes,alwaysRaised=yes"
			+ ",width="  + width   // »õÃ¢ÀÇ Æø
			+ ",height=" + height  // »õÃ¢ÀÇ ³ôÀÌ
			+ ",left="   + pX      // »õÃ¢ÀÇ ÁÂ»ó´Ü ³¡ÀÇ X ÁÂÇ¥
			+ ",top="    + pY;     // »õÃ¢ÀÇ ÁÂ»ó´Ü ³¡ÀÇ Y ÁÂÇ¥

	if ( newWindow != undefined ) newWindow.close();

	newWindow = window.open(url, "_popWin", option);
	newWindow.resizeTo(width, height);
	newWindow.focus();
}


function searchWin(url, width, height, Option) {
	var pX = (screen.Width  - width ) / 2; // »õ·Î Ã¢À» ¶ç¿ï À§Ä¡ X ÁÂÇ¥
	var pY = (screen.Height - height ) / 2; // »õ·Î Ã¢À» ¶ç¿ï À§Ä¡ Y ÁÂÇ¥
	var newWindow;
	var option = Option + ",width="  + width   // »õÃ¢ÀÇ Æø
					+ ",height=" + height  // »õÃ¢ÀÇ ³ôÀÌ
					+ ",left="   + pX      // »õÃ¢ÀÇ ÁÂ»ó´Ü ³¡ÀÇ X ÁÂÇ¥
					+ ",top="    + pY;     // »õÃ¢ÀÇ ÁÂ»ó´Ü ³¡ÀÇ Y ÁÂÇ¥

	if ( newWindow != undefined ) newWindow.close();

	newWindow = window.open(url, "_popWin", option);
	newWindow.resizeTo(width, height);
	newWindow.focus();
}

function XecureSearchWin(url, width, height, option) {
	var pX = (screen.Width  - width ) / 2; // »õ·Î Ã¢À» ¶ç¿ï À§Ä¡ X ÁÂÇ¥
	var pY = (screen.Height - height ) / 2; // »õ·Î Ã¢À» ¶ç¿ï À§Ä¡ Y ÁÂÇ¥
	var newWindow;
	var option = option + ",width="  + width   // »õÃ¢ÀÇ Æø
					+ ",height=" + height  // »õÃ¢ÀÇ ³ôÀÌ
					+ ",left="   + pX      // »õÃ¢ÀÇ ÁÂ»ó´Ü ³¡ÀÇ X ÁÂÇ¥
					+ ",top="    + pY;     // »õÃ¢ÀÇ ÁÂ»ó´Ü ³¡ÀÇ Y ÁÂÇ¥

	if ( newWindow != undefined ) newWindow.close();

	XecureNavigate(url, "_searchWin", option);

}



/**
 * È­¸éÀÇ Áß¾Ó¿¡ xecure Àû¿ëµÈ Å©±â·Î »õÃ¢À» ¶ç¿î´Ù.
 *
 * @param url    È­¸é¿¡ º¸¿©ÁÙ URL
 * @param width  »õÃ¢ÀÇ Æø
 * @param height »õÃ¢ÀÇ ³ôÀÌ
 * @param option ¿øÇÏ´Â ¿É¼Ç
 * @param name   ¸®ÅÏ¹ÞÀ» input name(ÄÚµå)
 * @param name2  ¸®ÅÏ¹ÞÀ» input name2(ÄÚµå¸í2)
 */
function searchWinOption(url, width, height, option, name, name2) {
	var pX = (screen.Width  - width ) / 2; // »õ·Î Ã¢À» ¶ç¿ï À§Ä¡ X ÁÂÇ¥
	var pY = (screen.Height - height ) / 2; // »õ·Î Ã¢À» ¶ç¿ï À§Ä¡ Y ÁÂÇ¥
	var newWindow;
	url = url + "?parentInputName=" + name + "&parentInputName2=" + name2;
	option = option + ",width="  + width   // »õÃ¢ÀÇ Æø
					+ ",height=" + height  // »õÃ¢ÀÇ ³ôÀÌ
					+ ",left="   + pX      // »õÃ¢ÀÇ ÁÂ»ó´Ü ³¡ÀÇ X ÁÂÇ¥
					+ ",top="    + pY;     // »õÃ¢ÀÇ ÁÂ»ó´Ü ³¡ÀÇ Y ÁÂÇ¥


	if ( newWindow != undefined ) newWindow.close();


	XecureNavigate(url, "_searchWin", option);

}


/*
 * »ç¾÷ÀÚ µî·Ï¹øÈ£¸¦ °Ë»ç
 */
function js_HU_007(arg1) {
	var arr_chkvalue = new Array(0,1,3,7,1,3,7,1,3,5);
	var arr_epno     = new Array(0,0,0,0,0,0,0,0,0,0,0);

	if (!js_HU_042(arg1)) {
		return false;
	}
	else {
		var str_lot = js_HU_042(arg1);    //////  '-'¸¦ Æ÷ÇÔÇÑ »ç¾÷ÀÚµî·Ï¹øÈ£¸¦ ¹ÞÀ»¶§ '-'Ã¼Å© ///
	}

	var int_lno = str_lot.length;

	if (int_lno != 10) {
		return false;
	}
	else {
		var int_sum = 0;
		var Str_epno = "";
		var Str_epno = str_lot;

		for (var i = 1; i <= 10; i++) {
			arr_epno[i] = parseInt(str_lot.substr(i - 1, 1));
		}

		for (var j = 1; j <= 9; j++) {
			int_sum = parseInt(int_sum) + (arr_epno[j] * arr_chkvalue[j]);
		}

		int_sum = parseInt(int_sum) + Math.round(parseInt((arr_epno[9] * 5)/10));

		var int_liy = parseInt(int_sum) % 10;
		var int_epno = 0;

		if (int_liy == 0) {
			int_epno = 0;
		}
		else {
			int_epno = 10 - parseInt(int_liy);
		}

		if (int_epno == arr_epno[10]) {
			return str_lot.substr(0,3) + "-" + str_lot.substr(3,2) + "-" + str_lot.substr(5,5);
		}
		else {
			return false;
		}
	}
}



/*
 * »ç¾÷ÀÚµî·Ï¹øÈ£Áß - Ã¼Å©
 */
function js_HU_042(arg1) {
	var DashCo = 0;
	var StrNo = "";
	for (var i = 0; i < arg1.length; i++) {
		if (arg1.substr(i,1) == "-") {
		DashCo++;
		}
	}

	if (DashCo > 2) {
		return false;  /* -¸¦ µÎ¹øÀÌ»ó ÀÔ·ÂÇÑ °æ¿ì*/
	}

	if	(DashCo != 0) {
		if (arg1.substr(3, 1) != '-' || arg1.substr(6, 1) != '-') {
			return false;
		}
	}

	for (var i = 0; i < arg1.length; i++) {
		if (arg1.substr(i, 1) != "-") {
			StrNo = StrNo + arg1.substr(i, 1);
		}
	}

	return StrNo;
}



function onlyNumber() {
	var e1 = event.srcElement;
	var num ="0123456789";

	event.returnValue = true;

	for (var i=0;i<e1.value.length;i++) {
		if(-1 == num.indexOf(e1.value.charAt(i)))
			event.returnValue = false;
	}

	if (!event.returnValue)	e1.value="";
}



/**
 * ¼ýÀÚÀÇ Á¤¼ö ÀÚ¸´¼ö¿Í ¼Ò¼ö ÀÚ¸´¼ö¸¦ °Ë»çÇÏ¿© °¢ ÀÚ¸´¼ö°¡
 * ÁÖ¾îÁø ÀÚ¸®¼ö ÀÌÇÏÀÎÁö °Ë»çÇÏ¿©, ÀÌ»óÀÌ ¾øÀ¸¸é true¸¦,
 * ÀÌ»óÀÌ ÀÖÀ¸¸é ÀûÀýÇÑ ¸Þ¼¼Áö¸¦ º¸¿© ÁÖ°í false¸¦ µ¹·ÁÁØ´Ù.
 * ¼Ò¼öºÎÀÇ °æ¿ì °ªÀÌ ³Ñ¾î¿ÀÁö ¾ÊÀ¸¸é(undefinedÀÌ¸é)
 * ¹«Á¶°Ç À¯È¿ÇÑ °ÍÀ¸·Î ÇÑ´Ù.
 *
 * @date  2004-01-15
 * @param  fieldName   Ç×¸ñÀÌ¸§. ¸Þ¼¼Áö¸¦ »Ñ¸± ¶§ »ç¿ëµÈ´Ù.
 * @param  obj         TextÇü ÀÔ·ÂÆû °´Ã¼
 * @param  intFigure   Á¤¼öºÎ À¯È¿ ÀÚ¸´¼ö
 * @param  floatFigure ¼Ò¼öºÎ À¯È¿ ÀÚ¸´¼ö
 */
function isValidNoFigureLE(fieldName, no, intFigure, floatFigure) {
	if ( ! checkNumber(no) ) {
		alert(no + "´Â À¯È¿ÇÑ ¼ýÀÚ°¡ ¾Æ´Õ´Ï´Ù.");
		return false;
	}

	var result = checkNoFigureLE(no, intFigure, floatFigure);

	var valid = true;

	if (result > 0 ) {
		valid = false;

		if ( result == 1 ) {
			alert(fieldName + "ÀÇ Á¤¼öºÎ ÀÚ¸´¼ö´Â " + intFigure + "ÀÚ¸® ÀÌÇÏÀÌ¾î¾ß ÇÕ´Ï´Ù.");
		}
		else if ( result == 2 ) {
			alert(fieldName + "ÀÇ ¼Ò¼öºÎ ÀÚ¸´¼ö´Â " + floatFigure + "ÀÚ¸® ÀÌÇÏÀÌ¾î¾ß ÇÕ´Ï´Ù.");
		}
		else if ( result == 3 ) {
			alert(fieldName + "ÀÇ Á¤¼öºÎ, ¼Ò¼öºÎ ÀÚ¸´¼ö´Â °¢°¢ " + intFigure + "ÀÚ¸®, " + floatFigure + "ÀÚ¸® ÀÌÇÏÀÌ¾î¾ß ÇÕ´Ï´Ù.");
		}
	}

	return valid;
}



/**
 * TextÇü ÀÔ·ÂÆû °ªÀÇ Á¤¼ö ÀÚ¸´¼ö¿Í ¼Ò¼ö ÀÚ¸´¼ö¸¦ °Ë»çÇÏ¿© °¢ ÀÚ¸´¼ö°¡
 * ÁÖ¾îÁø ÀÚ¸®¼ö ÀÌÇÏÀÎÁö °Ë»çÇÏ¿©, ÀÌ»óÀÌ ¾øÀ¸¸é true¸¦,
 * ÀÌ»óÀÌ ÀÖÀ¸¸é ÀûÀýÇÑ ¸Þ¼¼Áö¸¦ º¸¿© ÁÖ°í false¸¦ µ¹·ÁÁØ´Ù.
 * ¼Ò¼öºÎÀÇ °æ¿ì °ªÀÌ ³Ñ¾î¿ÀÁö ¾ÊÀ¸¸é(undefinedÀÌ¸é)
 * ¹«Á¶°Ç À¯È¿ÇÑ °ÍÀ¸·Î ÇÑ´Ù.
 *
 * @date  2004-01-15
 * @param  fieldName   Ç×¸ñÀÌ¸§. ¸Þ¼¼Áö¸¦ »Ñ¸± ¶§ »ç¿ëµÈ´Ù.
 * @param  obj         TextÇü ÀÔ·ÂÆû °´Ã¼
 * @param  intFigure   Á¤¼öºÎ À¯È¿ ÀÚ¸´¼ö
 * @param  floatFigure ¼Ò¼öºÎ À¯È¿ ÀÚ¸´¼ö
 */
function isValidNoFigureLEObj(fieldName, obj, intFigure, floatFigure) {
	obj.value = trim(obj.value) == "" ? "" : insertComma(refineNo(obj.value));

	return isValidNoFigureLE(fieldName, obj.value, intFigure, floatFigure);

}


/**
 * ÁÖ¾îÁø ¸Þ¼¼Áö·Î »èÁ¦¸¦ È®ÀÎÇÏ¿© "¿¹"¸¦ ¼±ÅÃÇÏ¸é
 * true¸¦ ¾Æ´Ï¸é false¸¦ µ¹·Á ÁØ´Ù.
 * ¸¸ÀÏ ³Ñ¾î¿Â ¸Þ¼¼Áö°¡ ¾ø´Ù¸é ±âº» ¸Þ¼¼Áö·Î
 * "»èÁ¦ÇÏ½Ã°Ú½À´Ï±î?"¸¦ »ç¿ëÇÑ´Ù.
 *
 * @param  msg  È®ÀÎÇÒ ¸Þ¼¼Áö ³»¿ë
 */
function confirmDelete(msg) {
	if ( msg == undefined || trim(msg) == "" ) {
		msg = "»èÁ¦ÇÏ½Ã°Ú½À´Ï±î?";
	}

	return (confirm(msg));
}

/**
* js override
**/
function submit(objForm){
	XecureSubmit(objForm);
}



/**
* Æû°´Ã¼ ³»ÀÇ text, textarea ÀÇ °´Ã¼µéÀ» Ã£¾Æ¼­ ÀüÃ¼ ¾ÕµÚ °ø¹é Á¦°ÅÇÔ
* @param  form°´Ã¼  È®ÀÎÇÒ ¸Þ¼¼Áö ³»¿ë
* by ceavian
* param : Æû °´Ã¼
*/

//ÁöÁ¤ form¿¡ ÇØ´çÇÏ´Â °´Ã¼ÀÇ text, textareaÀÇ ÀÔ·Â °ª ¸ðµÎ¸¦ °ø¹é Á¦°ÅÇÔ. ¼­¹ö CallÀ» ÅÂ¿ì±â Àü¿¡ È­¸é Validation ÀÛ¾÷ ¼öÇà ½Ã »ç¿ëÇÔ.
function deleteObjSpace(objForm){//°øÅë> ½ºÆäÀÌ½º ÀÔ·Â °ª Á¦°ÅÇÒ °Í...Á¦°Å ÈÄ Àç ÀÔ·Â
	for (i = 0; i < objForm.elements.length; i++){
		if( objForm.elements[i].type == "text" || objForm.elements[i].type == "textarea"  ){
			objForm.elements[i].value= trim(objForm.elements[i].value);
		}
	}
}


//ÆäÀÌÁö ÀÌµ¿ Call
function pageGo( pageNum ){
	var frm = document.frm_name;
	frm.thisPage.value= pageNum;
	//valid_flag = validation_select();
	//if( valid_flag ){
	submit(frm);
	//}
}

/*
* js_file(ÆÄÀÏ¸í, Æú´õ, ¾÷¹«±¸ºÐ°ª) *
* ¾÷¹«±¸ºÐ°ª 1:Æ÷Å», 2:ÆÇÁ¤, 3:Çã°¡ *
*/
function fileDownLoad(fileName,fileDir,gubun){
	location.href="/common/download.jsp?attPath="+fileDir+"&fn="+fileName+"&gubun="+gubun;

}


/*
* ¿À´Ã³¯Â¥°ª ¹ÝÈ¯ÇÔ¼ö
*/

function nowDate(seper) {
	var now = new Date();
	var yyyy = now.getFullYear().toString();
	var mm = (now.getMonth() + 1).toString();
	var dd = now.getDate().toString();
	return 	yyyy + seper + FullZero(mm,2) + seper + FullZero(dd,2);

}


/***********************************
11. function FullZero(str,full_length) : ÀÚ¸®¼ö¸¦ ¸ÂÃß¾î¼­ ¾Õ¿¡ 0À» Ã¤¿î´Ù.
// FullZero ("9", 2) e  09
// FullZero ("8", 3) e 009
******************************************/
function FullZero(str,full_length){
//-----------------------------------------------------
	if (str.length==0){
		return ;
	}
	full_str ='';
	for(i=1;i<=full_length-str.length;i++){
		full_str= full_str+"0";
	}
	full_str = full_str+str ;
	return full_str;
}


// XecureWeb ÀÓ½Ã·Î ÇÔ¼ö ¼³Á¤ (½ÇÁ¦¿î¿µ¿¡¼± »èÁ¦) ¿ÜºÎÁ¢¼ÓÀ» À§ÇÔ
/*
function XecureSubmit(obj)
{
	obj.submit();
	return true;
}


function XecureLink(obj)
{
	return true;
}

function XecureNavigate(url,tar)
{
	open(url,tar,"");
}

*/

/*
  ÀÛ¼ºÀÚ : ÀÌÀçÈ¯
  ¸Þ¼Òµå ±â´É :   ÆË¾÷À» È£ÃâÇÏ´Â ¸Þ¼Òµå
  f:¹ÝÈ¯ÇÒ FORMÀÌ¸§(this.formÀ¸·Î °íÁ¤)
  g:¹ÝÈ¯ÇÒ FORMÀÇ °´Ã¼¸í(:À» ±¸ºÐÀÚ·Î ÇØ¼­ ³ª¿­ ex) rtn1:rtn2:rtn3
  fname: È£ÃâÇÒ ÆË¾÷ ÆÄÀÏ¸í(XXXX.jsp)
*/
function windowOpen(f,g,fname,width,height)
{
	frmName = f.name;
    var windowName = "ID_" + Math.random().toString().substring(2,Math.random().toString().length);
	url = fname+"?frmName=" + frmName + "&rtn="+g;

	var option = "toolbar=no,location=no,directories=no,scrollbars=no,resizable=no,titlebar=no,status=no,dependent=yes,alwaysRaised=no"
			+ ",width="  + width   // »õÃ¢ÀÇ Æø
			+ ",height=" + height  // »õÃ¢ÀÇ ³ôÀÌ
			+ ",left="   + 250      // »õÃ¢ÀÇ ÁÂ»ó´Ü ³¡ÀÇ X ÁÂÇ¥
			+ ",top="    + 50;     // »õÃ¢ÀÇ ÁÂ»ó´Ü ³¡ÀÇ Y ÁÂÇ¥


	XecureNavigate(url, windowName ,option);
}

/*
  ÀÛ¼ºÀÚ : ÀÌÀçÈ¯
  ¸Þ¼Òµå ±â´É :   ÆË¾÷À» È£ÃâÇÏ´Â ¸Þ¼Òµå
  f:¹ÝÈ¯ÇÒ FORMÀÌ¸§(this.formÀ¸·Î °íÁ¤)
  g:¹ÝÈ¯ÇÒ FORMÀÇ °´Ã¼¸í(:À» ±¸ºÐÀÚ·Î ÇØ¼­ ³ª¿­ ex) rtn1:rtn2:rtn3
  fname: È£ÃâÇÒ ÆË¾÷ ÆÄÀÏ¸í(XXXX.jsp)
*/
function windowOpen2(f,g,fname,width,height)
{

	frmName = f.name;
    var windowName = "ID_" + Math.random().toString().substring(2,Math.random().toString().length);
	url = fname+"?frmName=" + frmName + "&rtn="+g;

	var option = "toolbar=no,location=no,directories=no,scrollbars=yes,resizable=no,titlebar=no,status=no,dependent=yes,alwaysRaised=no"
			+ ",width="  + width   // »õÃ¢ÀÇ Æø
			+ ",height=" + height  // »õÃ¢ÀÇ ³ôÀÌ
			+ ",left="   + 250      // »õÃ¢ÀÇ ÁÂ»ó´Ü ³¡ÀÇ X ÁÂÇ¥
			+ ",top="    + 50;     // »õÃ¢ÀÇ ÁÂ»ó´Ü ³¡ÀÇ Y ÁÂÇ¥

XecureNavigate(url, windowName ,option);
}



function windowOpen4(f,g,fname,params,width,height)
{

	frmName = f.name;
    var windowName = "ID_" + Math.random().toString().substring(2,Math.random().toString().length);
	url = fname+"?frmName=" + frmName + "&rtn="+g+params;

	var option = "toolbar=no,location=no,directories=no,scrollbars=no,resizable=no,titlebar=no,status=no,dependent=yes,alwaysRaised=no"
			+ ",width="  + width   // »õÃ¢ÀÇ Æø
			+ ",height=" + height  // »õÃ¢ÀÇ ³ôÀÌ
			+ ",left="   + 250      // »õÃ¢ÀÇ ÁÂ»ó´Ü ³¡ÀÇ X ÁÂÇ¥
			+ ",top="    + 50;     // »õÃ¢ÀÇ ÁÂ»ó´Ü ³¡ÀÇ Y ÁÂÇ¥

XecureNavigate(url, windowName ,option);
}

/*
  ÀÛ¼ºÀÚ : ÀÌÀçÈ¯
  ¸Þ¼Òµå ±â´É :   ÆË¾÷À» È£ÃâÇÏ´Â ¸Þ¼Òµå
  f:¹ÝÈ¯ÇÒ FORMÀÌ¸§(this.formÀ¸·Î °íÁ¤)
  g:¹ÝÈ¯ÇÒ FORMÀÇ °´Ã¼¸í(:À» ±¸ºÐÀÚ·Î ÇØ¼­ ³ª¿­ ex) rtn1:rtn2:rtn3
  fname: È£ÃâÇÒ ÆË¾÷ ÆÄÀÏ¸í(XXXX.jsp)
*/
function windowOpen3(f,g,fname,width,height)
{

	frmName = f;
    var windowName = "ID_" + Math.random().toString().substring(2,Math.random().toString().length);

	var option = "toolbar=no,location=no,directories=no,scrollbars=yes,resizable=no,titlebar=no,status=no,dependent=yes,alwaysRaised=no"
			+ ",width="  + width   // »õÃ¢ÀÇ Æø
			+ ",height=" + height  // »õÃ¢ÀÇ ³ôÀÌ
			+ ",left="   + 250      // »õÃ¢ÀÇ ÁÂ»ó´Ü ³¡ÀÇ X ÁÂÇ¥
			+ ",top="    + 50;     // »õÃ¢ÀÇ ÁÂ»ó´Ü ³¡ÀÇ Y ÁÂÇ¥

	XecureNavigate(fname, windowName ,option);
}
/*
  ÀÛ¼ºÀÚ : ÀÌÀçÈ¯
  ¸Þ¼Òµå ±â´É :   ÆË¾÷À» È£ÃâÇÏ´Â ¸Þ¼Òµå
  f:¹ÝÈ¯ÇÒ FORMÀÌ¸§(this.formÀ¸·Î °íÁ¤)
  g:¹ÝÈ¯ÇÒ FORMÀÇ °´Ã¼¸í(:À» ±¸ºÐÀÚ·Î ÇØ¼­ ³ª¿­ ex) rtn1:rtn2:rtn3
  fname: È£ÃâÇÒ ÆË¾÷ ÆÄÀÏ¸í(XXXX.jsp)
*/

function XecureSearchWin2(url, width, height, Option) {
	var newWindow;

	var option = "toolbar=no,location=no,directories=no,scrollbars=yes,resizable=yes,titlebar=no,status=no,dependent=yes,alwaysRaised=yes"
					+ ",width="  + width   // »õÃ¢ÀÇ Æø
					+ ",height=" + height  // »õÃ¢ÀÇ ³ôÀÌ
					+ ",left="   + 250      // »õÃ¢ÀÇ ÁÂ»ó´Ü ³¡ÀÇ X ÁÂÇ¥
					+ ",top="    + 50;     // »õÃ¢ÀÇ ÁÂ»ó´Ü ³¡ÀÇ Y ÁÂÇ¥

	if ( newWindow != undefined ) newWindow.close();

	XecureNavigate(url, "_searchWin", option);

}

/**/
function setComboBy(obj,code){
var comboValue = new Array();
var comboText = new Array();

	if(code == "10")
	{
		for(var i=0;i<31;i++)
		{
			comboValue[i] = i+1;
			comboText[i] = i+1 + " ÀÏ";
		}
	}
	else if (code == "20")
	{
		comboValue[0] = 1;
		comboText[0] = "¿ù¿äÀÏ";
		comboValue[1] = 2;
		comboText[1] = "È­¿äÀÏ";
		comboValue[2] = 3;
		comboText[2] = "¼ö¿äÀÏ";
		comboValue[3] = 4;
		comboText[3] = "¸ñ¿äÀÏ";
		comboValue[4] = 5;
		comboText[4] = "±Ý¿äÀÏ";
		comboValue[5] = 6;
		comboText[5] = "Åä¿äÀÏ";
		comboValue[6] = 7;
		comboText[6] = "ÀÏ¿äÀÏ";
	}
	else if(code == "30")
	{
		for(var i=0;i<24;i++)
		{
			comboValue[i] = i+1;
			comboText[i] = i+1 + " ½Ã";
		}
	}
	else if(code == "40")
	{
		for(var i=0;i<6;i++)
		{
			comboValue[i] = i*10;
			comboText[i] = i*10 + " ºÐ";
		}
	}

	for(i=obj.options.length-1;i>0;i--)
	{
		obj.options[i] = null;
	}

	for(i=0;i<comboValue.length;i++)
	{
		mystr = document.createElement("OPTION");
		mystr.value=comboValue[i];
		mystr.text=comboText[i];
		obj.add(mystr);
	}
}

/*
	¹öÆ° Å¬¸¯½Ã ¾÷¹«ÄÚµå¿¡ ÀÇÇÑ ÀÌº¥Æ® Ã³¸® ÇÔ¼ö
    procCd ==> w:µî·Ï, m:¼öÁ¤, d:»èÁ¦, ws:µî·Ï½ÃÀúÀå, ms:¼öÁ¤½ÃÀúÀå, c:Ãë¼Ò, p:Ãâ·Â, s:°Ë»ö

	¹öÆ° Array (µî·Ï,¼öÁ¤,»èÁ¦,ÀÔ·ÂÀúÀå,¼öÁ¤ÀúÀå,Ãë¼Ò,ÀÎ¼â,°Ë»ö,¿¢¼¿)
*/
function btnControl(procCd){
	var status = new Array(9);

	if(procCd=="i") // µî·ÏÈ­¸éÀÌ ³ªÅ¸³ª°í µ¥ÀÌÅÍ°¡ ÃÊ±âÈ­µÊ. ÀúÀå,Ãë¼Ò ¹öÆ° ³ªÅ¸³².
	{
		status = new Array("none","none","none","","none","","none","","none");
		changeBtn(status);

		parent.parent.parent.parent.main.mainF.procCd.value="i";
		parent.parent.parent.parent.main.procNm.innerHTML="µî·Ï";
	}
	else if(procCd=="u") // ¼öÁ¤È­¸éÀÌ ³ªÅ¸³ª°í »èÁ¦, ÀúÀå, Ãë¼Ò ¹öÆ° ³ªÅ¸³².
	{
		status = new Array("none","none","","none","","","none","","none");
		changeBtn(status);

		parent.parent.parent.parent.main.mainF.procCd.value="u";
		parent.parent.parent.parent.main.procNm.innerHTML="¼öÁ¤";
	}
	else if(procCd=="ic") // µî·Ï½Ã ÃÊ±âÈ­ ¿©ºÎ¸¦ Áú¹®ÇÏ°í È®ÀÎ½Ã ÇØ´ç µ¥ÀÌÅÍÀÇ ÃÊ±âÈ­. 
	{
		if(confirm("µî·Ï¾÷¹«ÀÇ ÁøÇàÀ» Ãë¼ÒÇÏ½Ã°Ú½À´Ï±î?"))
		{
			status = new Array("none","","none","","none","none","none","","");
			changeBtn(status);
		}
	}
	else if(procCd=="uc") // ¼öÁ¤½Ã ÃÊ±âÈ­ ¿©ºÎ¸¦ Áú¹®ÇÏ°í È®ÀÎ½Ã ÇØ´ç µ¥ÀÌÅÍÀÇ ÃÊ±âÈ­. 
	{
		if(confirm("¼öÁ¤¾÷¹«ÀÇ ÁøÇàÀ» Ãë¼ÒÇÏ½Ã°Ú½À´Ï±î?"))
		{
			status = new Array("","","","none","","","none","","");
			changeBtn(status);
		}
	}
	else if(procCd=="s") // °¢ Á¶È¸È­¸éÀ» °Ë»ö Á¶°Ç¿¡ ÀÇÇØ µð½ºÇÃ·¹ÀÌÇÔ.
	{
		status = new Array("","none","none","none","none","none","none","","");
		changeBtn(status);

		parent.parent.parent.parent.main.mainF.procCd.value="s";
		parent.parent.parent.parent.main.procNm.innerHTML="°Ë»ö";
	}
	else if(procCd=="w") // °¢ Á¶È¸È­¸éÀ» °Ë»ö Á¶°Ç¿¡ ÀÇÇØ µð½ºÇÃ·¹ÀÌÇÔ.
	{
		status = new Array("","none","none","none","none","none","none","","none");
		changeBtn(status);

		parent.parent.parent.parent.main.mainF.procCd.value="w";
		parent.parent.parent.parent.main.procNm.innerHTML="´ë±â";
	}
}


/* ¹öÆ° ÄÁÆ®·Ñ */
function changeBtn(status){

	if(parent.document.all.btnWrite != undefined)
	{
		parent.document.all.btnWrite.style.display        = status[0];
	}

	if(parent.document.all.btnModifyBtn != undefined)
	{
		parent.document.all.btnModifyBtn.style.display    = status[1];
	}

	if(parent.document.all.btnDelete != undefined)
	{
		parent.document.all.btnDelete.style.display       = status[2];
	}

	if(parent.document.all.btnWriteSubmit != undefined)
	{
		parent.document.all.btnWriteSubmit.style.display  = status[3];
	}

	if(parent.document.all.btnModifySubmit != undefined)
	{
		parent.document.all.btnModifySubmit.style.display = status[4];
	}

	if(parent.document.all.btnCancle != undefined)
	{
		parent.document.all.btnCancle.style.display = status[5];
	}

	if(parent.document.all.btnPrint != undefined)
	{
		parent.document.all.btnPrint.style.display        = status[6];
	}

	if(parent.document.all.btnSearch != undefined)
	{
		parent.document.all.btnSearch.style.display       = status[7];
	}

	if(parent.document.all.btnExcel != undefined)
	{
		parent.document.all.btnExcel.style.display        = status[8];
	}
}


/* °Ë»ö °á°ú¼ö ¼¼ÆÃ */
function setRsSize(num){
		parent.parent.parent.parent.main.rsSize.innerHTML=num;
}

/* »óÅÂ¹Ù ÄÁÆ®·Ñ */
function barControl(code){
	if(code=="Y")
	{
		parent.parent.parent.parent.main.mainF.barImg.style.display = "";
	}
	else
	{
		parent.parent.parent.parent.main.mainF.barImg.style.display = "none";
	}
}


/* ¹®ÀÚ¿­ trim */
String.prototype.trim = function() {
	return this.replace(/(^\s*)|(\s*$)/gi, "");
}
		


/* HTML °´Ã¼ÀÇ Value Object ¼³Á¤ ÇÔ¼ö (¼Ò¹®ÀÚ¿ë)*/
function setVal(a) {
	a = a.replace(/\{|\}/g,'');
	var eleArr = a.split(",");
	for(var i = 0 ; i < eleArr.length ; i++) {
		var ele = eleArr[i].split("=");
		var tmp = eval("document.forms[0]."+(ele[0].trim()).toLowerCase());
		if(tmp != undefined) {
			if(tmp.type == 'text' || tmp.type == 'textarea' || tmp.type == 'select-one') {
				tmp.value = ele[1].replace(/<br>/g,'\n');
			} else if(tmp.type == 'radio' || tmp.type == 'checkbox' ) {
				// radio, checkbox single
				tmp.checked = true;
			} else {
				// radio, checkbox array
				for(var j = 0 ; j < tmp.length ; j++) {
					if(tmp[j].value == ele[1])
						tmp[j].checked = true;
				}
			}
		} 
	}
}

/* HTML °´Ã¼ÀÇ Value Object ¼³Á¤ ÇÔ¼ö (´ë¹®ÀÚ¿ë)*/
function setVal2(a) {
	a = a.replace(/\{|\}/g,'');
	var eleArr = a.split(",");
	for(var i = 0 ; i < eleArr.length ; i++) {
		var ele = eleArr[i].split("=");
		var tmp = eval("document.forms[0]."+(ele[0].trim()).toUpperCase());
		if(tmp != undefined) {
			if(tmp.type == 'text' || tmp.type == 'textarea' || tmp.type == 'select-one') {
				tmp.value = ele[1].replace(/<br>/g,'\n');
			} else if(tmp.type == 'radio' || tmp.type == 'checkbox' ) {
				// radio, checkbox single
				tmp.checked = true;
			} else {
				// radio, checkbox array
				for(var j = 0 ; j < tmp.length ; j++) {
					if(tmp[j].value == ele[1])
						tmp[j].checked = true;
				}
			}
		} 
	}
}

/* °Ë»öÃ¢ È£Ãâ ½ºÅ©¸³Æ® */
/* openSearchWin(°æ·Î,Æû³×ÀÓ,ÆË¾÷À¸·Î³Ñ°ÜÁÙ°ª (ex)'&id=guest&name=È«±æµ¿'),¿ÀºêÁ§Æ®ÀÌ¸§1,¿ÀºêÁ§Æ®ÀÌ¸§2,¿ÀºêÁ§Æ®ÀÌ¸§3,¿ÀºêÁ§Æ®ÀÌ¸§4,¿ÀºêÁ§Æ®ÀÌ¸§5~10)*/
function openSearchWin(url,fname,property,name1,name2,name3,name4,name5,name6,name7,name8,name9,name10){
	var width = 620;
	var height = 460;
	var pX = (screen.Width  - width ) / 2; // »õ·Î Ã¢À» ¶ç¿ï À§Ä¡ X ÁÂÇ¥
	var pY = (screen.Height - height ) / 2; // »õ·Î Ã¢À» ¶ç¿ï À§Ä¡ Y ÁÂÇ¥
	var newWindow;

	var option = "toolbar=no,location=no,directories=no,scrollbars=yes,resizable=yes,titlebar=no,status=no,dependent=yes,alwaysRaised=yes"
		       + ",width="  + width   // »õÃ¢ÀÇ Æø
			   + ",height=" + height  // »õÃ¢ÀÇ ³ôÀÌ
			   + ",left="   + pX      // »õÃ¢ÀÇ ÁÂ»ó´Ü ³¡ÀÇ X ÁÂÇ¥
			   + ",top="    + pY;     // »õÃ¢ÀÇ ÁÂ»ó´Ü ³¡ÀÇ Y ÁÂÇ¥

	url = url + "?openerForm=" + fname
		+ "&name1=" + name1+ "&name2=" + name2+ "&name3=" + name3+ "&name4=" + name4+ "&name5=" + name5
		+ "&name6=" + name6+ "&name7=" + name7+ "&name8=" + name8+ "&name9=" + name9+ "&name10=" + name10;

	url = url + property;

	if ( newWindow != undefined ) newWindow.close();

	window.open(url, "searchWin", option);
}

/* ÇÖÅ° ÁöÁ¤ ½ºÅ©¸³Æ® */
/*
function getKey(keyStroke) {

  if(event.keyCode == 26) {
    parent.parent.parent.parent.main.content.p_search();
  }

 alert(event.keyCode);
}
document.onkeypress = getKey;

*/
/*
window.onerror = ErrorSetting

var e_msg="";
var e_file="";
var e_line="";


function ErrorSetting(msg, file_loc, line_no) {
e_msg=msg;
e_file=file_loc;
e_line=line_no;
return true;
}
*/

/* ÀÌ¹ÌÁö ¸®»çÀÌÁî width , height ¸¦ ³ÑÁö ¾Ê°Ô ¼¶³×ÀÏ Á¶Àý */
function resizeImg(name,wt,ht){
w = eval("document."+name+".width");
h = eval("document."+name+".height");

maxWidth = wt;
maxHeight = ht;

if(w > maxWidth || h > maxHeight){
if(w > h){
nw = maxWidth;
nh = Math.round((h*nw)/w);
}else{
nh = maxHeight;
nw = Math.round((nh*w)/h);
}
}else{
nw = w;
nh = h;
}

eval("document."+name+".height="+nh);
eval("document."+name+".width="+nw);
}


