﻿/* 오늘날짜 */
var _gToday = new Date();
  

/* 정의된 포맷으로 일자 리턴 */

/* 포맷된 일자를 포맷문자열을 제외하고 일자만 리턴 */

/* 기준일과 'Y'(년도), 'M'(월), 'W'(주), 'D'(일) 중 하나와 간격을 주면 계산된 일자를 리턴 */

/*  기준일과 'Y'(년도), 'M'(월), 'W'(주), 'D'(일) 중 하나를 주면 년초, 월초, 주초, 기준일을 문자열8자리로 리턴 */
 	
/* pToData - pFromDate 두 날짜간의 일자Term을 return */

// 달력 popup 호출    


function DateTerm(s_dt, e_dt)
{
    var intYear,intMonth,intDay;
    var sMonth, sDay;
    var intYear2,intMonth2,intDay2;
    var sMonth2, sDay2;
    
	intYear     = _gToday.getFullYear();
	intMonth    = parseInt(_gToday.getMonth(),10)+1;
	intDay      = _gToday.getDate();
	
	if( intMonth < 10 ) sMonth = "0"+intMonth;
	else sMonth = intMonth;
	
	if( intDay < 10 ) sDay = "0"+intDay;
	else sDay = intDay;
	
    document.getElementById(e_dt).value = intYear+"-"+sMonth+"-"+sDay;

    now=newDay=new Date(); // 현재시간 가져오기
    newDay.setDate(now.getDate()-30); // 현재 일자에서 날짜를 가져다 간격일수 만큼 더해서 새로운 일자에 넣음
    intYear2    =newDay.getYear(); // 새로운 일자에서 년도 가져오기
    intMonth2   =newDay.getMonth()+1; // 새로운 일자에서 월 가져오기 (+1)
    intDay2     =newDay.getDate();// 새로운 일자에서 날짜 가져오기
    
    
	if( intMonth2 < 10 ) sMonth2 = "0"+intMonth2;
	else sMonth2 = intMonth2;
	
	if( intDay2 < 10 ) sDay2 = "0"+intDay2;
	else sDay2 = intDay2;
	
	
    document.getElementById(s_dt).value = intYear2+"-"+sMonth2+"-"+sDay2;
    
    document.getElementById(e_dt).value = intYear+"-"+sMonth+"-"+sDay;
}



/* 다국어는 배열 지정으로 입력하여 가져오도록 
*/





//== 문자 ==========================================================//

/* 문자열 치환 */ 	
function ReplaceStr(pOriginal, pFind, pChange)
{
	return pstrOriginal.split(pstrFind).join(pstrChange);
}	

/* 공백제거 */ 	
function Trim(strings)
{
    var retString = "";
    var c;
    var i;
    for(i=0;i<strings.length;i++) {
        c = strings.charAt(i);
        if(c != ' '){
           retString += c;
        }
    }
    return(retString);
}

//== 숫자 ==========================================================//

/* 숫자 콤마 삽입*/
function number_format(numstr) {
  var numstr = String(numstr);
  var re0 = /(\d+)(\d{3})($|\..*)/;
  if (re0.test(numstr))
    return numstr.replace(
      re0,
      function(str,p1,p2,p3) { return number_format(p1) + "," + p2 + p3; }
    );
  else
    return numstr;
}

/* 숫자만 입력받기 */
function Num_Only(){
//    alert(event.keyCode);
    
  if((event.keyCode != 45 && event.keyCode < 48) || (event.keyCode>57)){
    event.returnValue=false;
  }
}

/* 숫자 확인 콤마제외한 숫자만 처리 */
function Num_Check(numstr){

    if ( numstr == "" ) {
        var num = 0;
    } else {        
        var num = numstr.replace(",", "").replace(",", "").replace(",", "").replace(",", "").replace(",", "").replace(",", "");
    }        

  if(isNaN(num)){
    return 0;
  } else {
    return num;
  } 
}

/* 소수점 이하 한자리 올림해서 구하는 함수(","입력부분 없음) */
function GetLeave(pa) {
    var    str =  new String(pa); 
    var pos = 0;
	pos = str.indexOf('.');
	if (pos != -1) {
		pre  =  str.substring(0, pos);
		post =  str.substring(pos+1, pos+2);
		half =  str.substring(pos+2, pos+3);
		if (parseInt(half) > 0 ) {
			if (post == "9") {
				post = "0";
				pre = parseInt(pre) + 1;
			}
			else  post = parseInt(post) + 1;
		}
		str = pre + '.' + post;
	}
	return str;
}

//== 연산 ==========================================================//
//== 윈도우 ========================================================//

/* 창닫기 */
function closeWin() {
    self.close();
}

/*
--------------------------------------------------------------------------------------
// 팝업 창 호출
// 0 Model,1 Modeless
2,3 popup
4, 전체화면+스크롤
5, 상태바+스크롤No
6, 전체창
7, 위치지정 Modal
8, 위치지정 Modalless
9,10,
11,scroll 있음, resizable가능
12,scroll 있음, resizable불가능
//--------------------------------------------------------------------------------------//
*/
function popupWindow(pStyle, pWidth, pHeight, pUrl, pLeft, pTop, pWinNm) {
	var intLeft = 0, intTop = 0;
	var strWinStyle;
	var today;
	var temp;
    var winObj

	if (pStyle == 0)
	{
		strWinStyle = "dialogWidth=" + pWidth + "px; dialogHeight=" + pHeight + "px; center:yes; status=yes; help:no; scroll:no ";
		winObj = window.showModalDialog(pUrl, window, strWinStyle);
	}
	else if (pStyle == 1)
	{
		strWinStyle = "dialogWidth=" + pWidth + "px; dialogHeight=" + pHeight + "px; center:yes; status=no; help:no; scroll:no ";
		winObj = window.showModelessDialog(pUrl, window, strWinStyle);
		winObj.focus();
	}
	else if (pStyle == 2)
	{
		intLeft = screen.width/2-pWidth/2;
		intTop = screen.height/2-pHeight/2;
		winObj =  window.open(pUrl, 'pop', 'menubar =0,resizable=1,scrollbars=1,status=no,titlebar=0,toolbar=no,width='+pWidth+',height='+pHeight+',left='+intLeft+',top='+intTop);
		winObj.focus();
	}
	else if (pStyle == 3) //excel
	{
		intLeft = 0;
		intTop = 0;
		winObj = window.open(pUrl, 'excel', 'menubar =1,resizable=0,scrollbars=0,status=no,titlebar=0,toolbar=no,width='+pWidth+',height='+pHeight+',left='+intLeft+',top='+intTop);
		winObj.focus();
	}
	else if (pStyle == 4) //전체화면이면서 스크롤 있음
	{
		intLeft = 0;
		intTop = 0;
		winObj = window.open(pUrl, 'window', 'status=yes,scrollbars=yes,width='+pWidth+',height='+pHeight+',left='+intLeft+',top='+intTop);
		winObj.focus();
	}
	else if (pStyle == 5) //상태바 있으면서 스크롤 없음
	{
		intLeft = 0;
		intTop = 0;
		winObj = window.open(pUrl, 'window', 'status=yes,scrollbars=no,width='+pWidth+',height='+pHeight+',left='+intLeft+',top='+intTop);
		winObj.focus();
	}
	else if (pStyle == 6) //전체창
	{
		today = new Date();
		intLeft = 0;
		intTop = 0;

		winObj = window.open(pUrl, today.getTime(), 'menubar=0, resizable=yes, titlebar=0, toolbar=no, status=yes, scrollbars=auto, width=1010,height=690,left='+intLeft+',top='+intTop);
        winObj.focus();
	}
	else if (pStyle == 7)	// 위치지정 Modal Dialog
	{
		strWinStyle = "dialogWidth=" + pWidth + "px; dialogHeight=" + pHeight + "px; status=no; help:no; scroll:no; dialogLeft:" + pLeft + "; dialogTop:" + pTop;
		winObj =  window.showModalDialog(pUrl, window, strWinStyle);
	}

	else if (pStyle == 8)	// 위치지정 Modalless Dialog
	{
		intLeft = screen.width/2-pWidth/2;
		intTop = (screen.height/2-pHeight/2) - 50;
		winObj =  window.open(pUrl, 'excel1', 'menubar=0,resizable=0,scrollbars=0,status=no,titlebar=0,toolbar=no,width='+pWidth+',height='+pHeight+',left='+intLeft+',top='+intTop);
	}
	else if (pStyle == 9) //전체창
	{
		today = new Date();
		intLeft = 0;
		intTop = 0;

		winObj = window.open(pUrl, today.getTime(), 'menubar=0, resizable=yes, titlebar=0, toolbar=no, status=yes, scrollbars=yes, width=window.screen.availWidth,height=window.screen.availHeight,left='+intLeft+',top='+intTop);
     	winObj.resizeTo(window.screen.availWidth, window.screen.availHeight);
        winObj.focus();
        
	}
	else if (pStyle == 10)
	{
		intLeft = screen.width/2-pWidth/2;
		intTop = screen.height/2-pHeight/2;
		winObj = window.open(pUrl, 'board_pop', 'menubar =0,resizable=yes,scrollbars=0,status=yes,titlebar=0,toolbar=no,width='+pWidth+',height='+pHeight+',left='+intLeft+',top='+intTop);
		winObj.focus();
	}
	else if (pStyle == 11)
	{	//scroll 있음, resizable가능
		intLeft = screen.width/2-pWidth/2;
		intTop = screen.height/2-pHeight/2;
		winObj = window.open(pUrl, pWinNm, 'menubar =0,resizable=yes,scrollbars=yes,status=yes,titlebar=0,toolbar=no,width='+pWidth+',height='+pHeight+',left='+intLeft+',top='+intTop);
		winObj.focus();
	}
	else if (pStyle == 12)
	{	//scroll 없음, resizable불가능
		intLeft = screen.width/2-pWidth/2;
		intTop = screen.height/2-pHeight/2;
		winObj = window.open(pUrl, pWinNm, 'menubar =0,resizable=no,scrollbars=no,status=yes,titlebar=0,toolbar=no,width='+pWidth+',height='+pHeight+',left='+intLeft+',top='+intTop);
		winObj.focus();
	}	
	
    return winObj;    	
}

//--------------------------------------------------------------------------------------
// Random Number를 생성하여 return
//--------------------------------------------------------------------------------------
function RandomGen(pLength) {
	var strTemp;
	
	strTemp = '000000' + String(parseInt(Math.random()*Math.pow(10, pLength)));
	return strTemp.substr(strTemp.length - pLength, pLength);
}



//엑셀변환
function ToExcel(pstrTitle, pstrSubTitle, pobjGrid)
{
	var strSearchData;
	var strSearchArr;
	var strExcelTitleType
	var strExcelSearchType
	var strExcelLastSearchType
	var i;
	
	//strSearchData = ReplaceStr(pstrSubTitle, "▤", "  ※");
	
	//strSearchData = ReplaceStr(strSearchData, "▦", "：");
	
	//strSearchArr = strSearchData.split("▩");
	
	pobjGrid.SetExcelTitle(0, '');
	
	strExcelTitleType		=	';font-size:24pt;font-color:black;font-bold;bgcolor:#ffffff;align:center;line-color:#dddddd;line-width:0.5pt;skiprow:1;'
	strExcelSearchType		=	';font-size:10pt;font-color:black;bgcolor:#ffffff;align:left;line-color:#dddddd;line-width:0.5pt;'
	strExcelLastSearchType	=	';font-size:10pt;font-color:black;bgcolor:#ffffff;align:left;line-color:#dddddd;line-width:0.5pt;skiprow:1;'
	
	pobjGrid.SetExcelTitle(1, 'value:'+pstrTitle+strExcelTitleType);
	
	for (i=0 ; i < strSearchArr.length - 1 ; i++)
	{
		pobjGrid.SetExcelTitle(1, 'value:'+strSearchArr[i]+strExcelSearchType);
	}
	
	pobjGrid.SetExcelTitle(1, 'value:'+strSearchArr[strSearchArr.length-1]+strExcelLastSearchType);
	
	pobjGrid.LineColor ='Black';
	
	pobjGrid.GridToExcel(pstrTitle, '', 1);
	
	pobjGrid.LineColor = '#C3C1BE';
}


function ExecuteExcelExport(objGrid, title, subtitle, writeDate)
{
	objGrid.SetExcelTitle(0, "");
	objGrid.SetExcelTitle(1, "value:"+title+"; font-face:±¼¸²u; font-size:30pt; font-color:black;font-bold; font-underline; bgcolor:white; align:center; line-color:red;line-width:2pt; skiprow:1;");
	objGrid.SetExcelTitle(1, "value:("+subtitle+"); font-face:±¼¸²u; font-size:18pt; font-color:black; bgcolor:#99ffff; align:center; line-color:blue; line-width:1pt; skiprow:1;");
	objGrid.SetExcelTitle(1, "value:"+writeDate+"; font-face:±¼¸²u; font-size:16pt; font-color:black;font-italic; bgcolor:#ff9999; align:right; line-color:red; line-width: 0.5pt; skiprow:2;");
	var lOption = 0;
		lOption += 24;
	
	objGrid.GridToExcel("", "", lOption);
}


//== Object  ==========================================================//

/* 해당 Form에 있는 Elements들의 값을 모두 Clear 해주는 함수*/
function clearFormElements(formObj) {

	var tEle;
	var tEleType;
	var len = formObj.elements.length;
	
    for (var i=0; i<len; i++) {
    	
    	tEle	= formObj.elements[i];
    	
    	if (tEle.disabled) { continue; }

    	if (tEle.type != null && tEle.type != '') {

    		tEleType	= tEle.type.toLowerCase();

    		if (tEleType == "checkbox" || tEleType == "radio" || tEleType == "select-one") { continue; }
    		if (tEleType == "hidden" &&  tEle.name == "sc.gridId") { continue; }
    		
    		tEle.value = '';
    		
    	}
	}
}

/* 해당 Object의 Style을 필수입력 type으로 변경해주는 함수*/
function chgStyleNeed(pObj) {
	var pObjType;
	
	if (pObj.type != null && pObj.type != '') {
 
		pObjType	= pObj.type.toLowerCase();

    	if (pObjType == "hidden" || pObjType == "radio") { return; }
 
		if (pObjType == "select-one") {
			pObj.setEnabled();
		}
		else {
	    	pObj.style.background= '#FFFAE7';
    		pObj.readOnly = false;
    		pObj.tabIndex = pIdx;
    	}
    }
}

/* 해당 Object의 Style을 일반입력 type으로 변경해주는 함수*/
function chgStyleEdit(pObj, pIdx) {
	var pObjType;
	
	if (pObj.type != null && pObj.type != '') {
 
		pObjType	= pObj.type.toLowerCase();

    	if (pObjType == "hidden" || pObjType == "radio") { return; }
 
		if (pObjType == "select-one") {
			pObj.setEnabled();
		}
		else {
	    	pObj.style.background= '#FFFFFF';
    		pObj.readOnly = false;
    		pObj.tabIndex = pIdx;
    	}
    }
}

/* 해당 Object의 Style을 ReadOnly type으로 변경해주는 함수*/
function chgStyleRead(pObj) {
	var pObjType;
	
	if (pObj.type != null && pObj.type != '') {
 
		pObjType	= pObj.type.toLowerCase();

    	if (pObjType == "hidden" || pObjType == "radio") { return; }
 
		if (pObjType == "select-one") {
			pObj.setDisabled();
		}
		else {
	    	pObj.style.background= '#F5F5F5';
    		pObj.readOnly = true;
    		pObj.tabIndex = '-1';
    	}
    }
}

/* 해당 image의 Style을 Enabled type으로 변경해주는 함수*/
function setEnabledImg(pObj) {	
		pObj.disabled = false;
		pObj.style.filter = "";						
		pObj.style.cursor = "hand";
}

/*  해당 image의 Style을 Disabled type으로 변경해주는 함수*/
function setDisabledImg(pObj) {	
		pObj.disabled = true;
		pObj.style.filter = "gray()";						
		pObj.style.cursor = "default";
}

/* object tag 처리 */
function __WS__(id) 
{ 
    document.write(id.text);
    id.id = ""; 
}

//- 그리드의 체크박스에 체크가 되어있는 갯수
function GridCountCheck(obj)
{
    //체크된 숫자 저장
    var count = 0;
    
    if(obj != null)
    {
        
    
        for(var i=1; i < obj.rows.length; i++) 
        {
            
	            
	            
            if(obj.rows[i].all[1].checked == true)
            {
                if(obj.rows[i].all[1].disabled == false)
                {
                    count ++;
                }
            } 
        }
    }
    
    return count;
}

//== 기타 ==========================================================//

/* 값이 Null일때 0 반환 */ 
function NullToZero(strings) {
    if (strings == '') {
    	return(0);
    }
    return(strings);
}

/* enter */
function EnterOnkeydown()
{
	if (event.keyCode == 13)
		event.keyCode = 9;
}

//Enter키를 tab 키로 변환하여, 다음 tabindex 값을 가지고 있는 객체로 포커스를 이동시킴
//객체 생성 구문에 이벤트 처리기를 같이 정의 했다면  아래와 같이 처리해야 submit 되지 않음.(2006.02.02)
// (javascript 구문에서는 이벤트 처리기 설정시에는 상관 없음.
//  if(!SetEnter()) return false;
//  
function SetEnter()
{
   var frm = document.forms[0];
   var field = event.srcElement;
   var tabIndex  = 999999999;//도달할 수 없는 값으로 초기화 
   var target;
   var searchOk = false; //관련 객체를 찾았는지 여부
	   
  
   //Enter키 이외는 값은 그냥 통과  	   
   if(event.keyCode != 13) 
   	   return true;	   
	   
   for(var i =0 ; i <frm.elements.length;i++)
   {
      if(field.tabIndex < frm.elements[i].tabIndex) 
      {
            if(tabIndex > frm.elements[i].tabIndex)//현재의 tabindex보다 큰 것들중에서 가장 작은 값을찾음. 
            {
               target =  frm.elements[i];
               tabIndex= frm.elements[i].tabIndex;
               searchOk = true;
            }   
      }//if 
   }//for
	   

   if(searchOk == true)//해당 객체를 찾은 경우만 그 객체로 focus 이동
     target.focus();		   
   return false;	//submit되는 것을 방지하기 위해서   		   
}//SetEnter()

     
function txtBoxFocus() //textbox가 선택되면, 등록내용 전체를 선택하게 함.
{
    var obj =event.srcElement;
    
    obj.select()
    
    return false;
}//txtBoxFocus




/* 달력컨트롤 활성
function SetCalEnable(objNm) 
{ 
    objBox = eval('form1.' + objNm + '_Box');

    objBox.readOnly = false;
    objBox.style.background = "#FFFFFF";           
    form1.elements[objNm + "_Ibt"].disabled = false;
    form1.elements[objNm + "_Ibt"].style.filter= "";
} */

/* 달력컨트롤 비활성
function SetCalDisable(objNm) 
{ 
    objBox = eval('form1.' + objNm + '_Box');

    objBox.readOnly = true;
    objBox.style.background = "#F5F5F5";           
    
    form1.elements[objNm + "_Ibt"].disabled = true;
    form1.elements[objNm + "_Ibt"].style.filter= "gray()";
} */


/*******************************************************************************

 FILE          : common.js
 DESCRIPTIONS  : 자바스크립트 공통 모듈
 REMARKS       : 공통적으로 쓰이는 자바스크립트 함수
 DATE          : 2004.12.15
 
 디자인팀에서 받은 COMMON.JS 파일

 *******************************************************************************/

// 스크롤 따라다니는 퀵메뉴
function initMoving(target, position, topLimit, btmLimit) {
    if (!target)
        return false;

    var obj = target;
    obj.initTop = position;
    obj.topLimit = topLimit;
    obj.bottomLimit = document.documentElement.scrollHeight - btmLimit;

    obj.style.position = "absolute";
    obj.top = obj.initTop;
    obj.left = obj.initLeft;

    if (typeof(window.pageYOffset) == "number") {
        obj.getTop = function() {
            return window.pageYOffset;
        }
    } else if (typeof(document.documentElement.scrollTop) == "number") {
        obj.getTop = function() {
            return document.documentElement.scrollTop;
        }
    } else {
        obj.getTop = function() {
            return 0;
        }
    }

    if (self.innerHeight) {
        obj.getHeight = function() {
            return self.innerHeight;
        }
    } else if(document.documentElement.clientHeight) {
        obj.getHeight = function() {
            return document.documentElement.clientHeight;
        }
    } else {
        obj.getHeight = function() {
            return 500;
        }
    }

    obj.move = setInterval(function() {
        if (obj.initTop > 0) {
            pos = obj.getTop() + obj.initTop;
        } else {
            pos = obj.getTop() + obj.getHeight() + obj.initTop;
            //pos = obj.getTop() + obj.getHeight() / 2 - 15;
        }

        if (pos > obj.bottomLimit)
            pos = obj.bottomLimit;
        if (pos < obj.topLimit)
            pos = obj.topLimit;

        interval = obj.top - pos;
        obj.top = obj.top - interval / 3;
        obj.style.top = obj.top + "px";
    }, 30)
}


//=============================================================================
// 함수명: MM_preloadImages
// 설  명: Mouse Over에 의한 이미지 전환
// 작업일: 
// 작업자: 
//=============================================================================
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];}}
}


//=============================================================================
// 함수명: MM_swapImgRestore
// 설  명: Mouse Over에 의한 이미지 전환
// 작업일: 
// 작업자: 
//=============================================================================
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;
}


//=============================================================================
// 함수명: MM_findObj
// 설  명: Mouse Over에 의한 이미지 전환
// 작업일: 
// 작업자: 
//=============================================================================
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;
}


//=============================================================================
// 함수명: MM_swapImage
// 설  명: Mouse Over에 의한 이미지 전환
// 작업일: 
// 작업자: 
//=============================================================================
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];}
}

//=============================================================================
// 함수명: MM_showHideLayers
// 설  명: Mouse Over에 의한 Layer 전환
// 작업일: 
// 작업자: 
//=============================================================================
//function MM_showHideLayers() { //v6.0
//alert("여기");
//  var i,p,v,obj,args=MM_showHideLayers.arguments;
//  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
//    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
//    obj.visibility=v; }
//}



//=============================================================================
// 함수명: CheckEmail
// 설  명: 이메일 주소 검사
// 작업일: 
// 작업자: 
//=============================================================================
function CheckEmail(strValue) 
{ 
//    if(strValue.length <= 0)
//	{
//	  return true;
//	}
    var splitted = strValue.match("^(.+)@(.+)$");
    if(splitted == null) return false;
    
    if(splitted[1] != null )
    {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null)
		return false;
    }
    
    if(splitted[2] != null)
    {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null) 
      {
	    var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    if(splitted[2].match(regexp_ip) == null) return false;
      }
      return true;
    }
	return false;
}

//=============================================================================
// 함수명: CheckPhone
// 설  명: 전화번호 검사
// 작업일: 
// 작업자: 
//============================================================================= 
function CheckPhone(strValue) 
{ 
    if(strValue.length <= 0)
	{
	  return true;
	}

    var splitted = strValue.match("^(.+)-(.+)-(.+)$");
    if(splitted == null) return false;

    if(splitted[1].length > 3) return false;
    
    if(splitted[2].length > 4) return false;

	var phoneEx1 = /^(\d+)(\-{1})(\d+)(\-{1})(\d{4,4})$/; 

	if (strValue.match(phoneEx1) == null) 	
		return false;
	else
		return true;
}
 
//=============================================================================
// 함수명: CheckBizNo
// 설  명: 사업자번호 검사
// 작업일: 
// 작업자: 
//============================================================================= 
function CheckBizNo(strValue) 
{   
	var bizNoEx1 = /^(\d{3,3})(\-{1})(\d{2,2})(\-{1})(\d{5,5})$/; 

	if (strValue.match(bizNoEx1) == null) 	
		return false;
	else
		return true;
}

//=============================================================================
// 함수명: isDate
// 설  명: 날짜 유효성
// 작업일: 
// 작업자: 
//=============================================================================
function isDate(yyyy,mm,dd)
{
   if (yyyy.length != 4)
      return false;
   else {   
      yyyy=parseInt(yyyy,10);
      mm=parseInt(mm,10);
      dd=parseInt(dd,10);
      d = new Date(yyyy,mm-1,dd);
      if (d=="NaN") return false;
      if (yyyy == d.getFullYear() &&
         mm == d.getMonth()+1 &&
         dd == d.getDate() ) return true;
      return false;
   }   
}


//=============================================================================
// 함수명: isDate_yyyy_m_d
// 설  명: yyyy-mm-dd 형태 유효성
// 작업일: 
// 작업자: 
//=============================================================================
function isDate_yyyy_m_d(s)// yyyy-mm-dd 형태
{
   s=s.replace(/\s/g,""); // 공백제거
   if (s.match(/\d+\-\d+\-\d+/g)!=s) 
      return false; // 1111-11-11 포맷이 아님
   var d = s.split(/\-/g);
   return isDate(d[0],d[1],d[2]);
}


//=============================================================================
// 함수명: checkDate
// 설  명: yyyy-mm-dd 형태 날짜 유효성
// 작업일: 
// 작업자: 
//=============================================================================
function checkDate(s)
{
   var isD

   isD=isDate_yyyy_m_d(s);

   if (isD) 
      return true;
   else
      return false;
}


//=============================================================================
// 함수명: correctDate
// 설  명: yyyy-mm-dd 형태 날짜
// 작업일: 
// 작업자: 
//=============================================================================
function correctDate(s)// yyyy-mm-dd 형태
{
   s=s.replace(/\s/g,""); // 공백제거
   var d = s.split(/\-/g);
   if (d[1].length == 1)
      d[1] = "0" + d[1];
   if (d[2].length == 1)
      d[2] = "0" + d[2];  
   return d[0] + "-"  + d[1] + "-" + d[2];
}
 

//=============================================================================
// 함수명: validateForm
// 설  명: 컨트롤의 유효성을 검사 validateData()를 호출하여 검사한다.
// 작업일: 
// 작업자: 
//=============================================================================
function validateForm(arrObjDesc) 
{ 

	for(var i=0; i < arrObjDesc.length; i++) 
	{
		for(var j=0; j < arrObjDesc[i].length ;j++) 
		{
			var objForm = document.all[arrObjDesc[i][j][0]];
			
			if(validateData(objForm, arrObjDesc[i][j][1], arrObjDesc[i][j][2]) == false) 
			{
			    if( objForm.type != "hidden" && objForm.style.display != "none")
			    {
				    objForm.focus();
				}
				event.returnValue = false;
				return false;				 
			}
		} 
	}
	return true;
}


//=============================================================================
// 함수명: Popup 
// 설  명: PopUp 창 호출
// 작업일: 
// 작업자: 
//=============================================================================

function PopUp(intStyle, intWidth, intHeight, strWinNm, strUrl) {
   var intLeft = 0, intTop = 0;
   var winstyle;            

   //중앙정렬 (스크롤바 무, 상태표시줄 무)
   if (intStyle == 0) {      
      intLeft = screen.width/2-intWidth/2;
      intTop = screen.height/2-intHeight/2;
      
      return window.open(strUrl, strWinNm, 'menubar =0,resizable=0,scrollbars=0,status=no,titlebar=0,toolbar=no,width='+intWidth+',height='+intHeight+',left='+intLeft+',top='+intTop);      
   }    
   //showModelessDialog
   else if (intStyle == 1) {
      winstyle = "dialogWidth=" + intWidth + "px; dialogHeight=" + intHeight + "px; center:yes; status=no; help:no; ";      
      return window.showModelessDialog(strUrl, window, winstyle); 
   }
   //showModalDialog
   else if (intStyle == 2) {
      winstyle = "dialogWidth=" + intWidth + "px; dialogHeight=" + intHeight + "px; center:yes; status=no; help:no; ";      
      return window.showModalDialog(strUrl, window, winstyle); 
   }
   //excel
   else if (intStyle == 3) {      
      intLeft = screen.width/2-intWidth/2;
      intTop = screen.height/2-intHeight/2;
      
      return window.open(strUrl, strWinNm, 'menubar =1,resizable=1,scrollbars=0,status=no,titlebar=0,toolbar=no,width='+intWidth+',height='+intHeight+',left='+intLeft+',top='+intTop);      
   }
   //중앙정렬 (스크롤바 유, 상태표시줄 무)
   else if (intStyle == 4) {      
      intLeft = screen.width/2-intWidth/2;
      intTop = screen.height/2-intHeight/2;
      
      return window.open(strUrl, strWinNm, 'menubar =0,resizable=0,scrollbars=1,status=no,titlebar=0,toolbar=no,width='+intWidth+',height='+intHeight+',left='+intLeft+',top='+intTop);      
   }
   //좌측상단정렬 (스크롤바 무, 상태표시줄 무)
   else if (intStyle == 5) {      
      
      return window.open(strUrl, '12', 'menubar =0,resizable=0,scrollbars=0,status=no,titlebar=0,toolbar=no,width='+intWidth+',height='+intHeight+',left='+intLeft+',top='+intTop);      
   }   
   //테스트용 (스크롤바 유, 상태표시줄 유)   
   else if (intStyle == 99) {      
      intLeft = screen.width/2-intWidth/2;
      intTop = screen.height/2-intHeight/2;
      
      return window.open(strUrl, strWinNm, 'menubar =0,resizable=0,scrollbars=1,status=yes,titlebar=0,toolbar=no,width='+intWidth+',height='+intHeight+',left='+intLeft+',top='+intTop);      
   }      
   
}

//=============================================================================
// 함수명: 달력 Popup 
// 설  명: 달력 PopUp 창 호출
// 작업일: 
// 작업자: 
//=============================================================================

//일단 기존에 달력 팝업을 주석처리 함 -- 윤석호
/*
function PopUpCalendar(intSeq) {

	var strUrl;
	var temp;
	strUrl = "../COMMON/COMMON_CALENDAR_POP.asp?P_SEQ=" + intSeq ;								
	temp = PopUp(1, 212, 268,'PopUpCalendar', strUrl);
	temp.focus();			
   
}
*/

//=============================================================================
// 함수명: 우편번호 Popup 
// 설  명: 우편번호 PopUp 창 호출
// 작업일: 
// 작업자: 
//=============================================================================

function PopUpZipCd(intSeq) {

	var strUrl;
	var temp;
	strUrl = "../COMMON/COMMON_ZIP_CD_POP.aspx?P_SEQ=" + intSeq ;								
	temp = PopUp(0, 400, 425,'PopUpZipCd', strUrl);
	temp.focus();			
   
}

//--------------------------------------------------------------------------------------//
// Description  : a function for MS IE ActiveX Rollup Patch                             //
// Parameter    : id                                                                                    //
// Example  :                                                                                            //
// Etc      :                                                                                                //
//--------------------------------------------------------------------------------------//
function __WS__(id)
{
 document.write(id.text); id.id="";
}

//=============================================================================
// 함수명: 달력 Popup 
// 설  명: 달력 PopUp
// 작업일: 2008-04-29
// 작업자: 윤석호
//=============================================================================
var pop_top;			//전역 변수. 달력 팝업의 시작 위치를 정한다.
var pop_left;			//전역 변수. 달력 팝업의 시작 위치를 정한다.
var oPopup = null;		//전역 변수. 달력이 들어갈 팝업의 객체
var str_g_reFunctionName	//전역 변수. 달력을 선택한 후 다음에 실행할 함수의 이름을 가진다.


var cal_img_url = "/aspGroupWare/ImageSite" + "/COMMON/"		//달력에 사용하는 이미지의 경로

//호출 형태는 객체1, 객체2, '', "text"
function fn_Calendar_D(obj1, obj2, pstrReFunction, pstrObjText) {
	if ( oPopup == null)
		oPopup = window.createPopup();

	//returnFlag = pstrReturnFlag;
	//returnColid = pstrReturnColid;
	
	str_g_reFunctionName = pstrReFunction;
	var now = "";
	if(obj1.type == "text"){
		now = obj1.value.split("-");
		pop_top = document.body.clientTop + fn_GetObjectTop(obj1) - document.body.scrollTop;
		pop_left = document.body.clientLeft + fn_GetObjectLeft(obj1) -  document.body.scrollLeft;
		//objType = "0";
	}
			
	var now2 = "";
	if(obj2.type == "text"){					
		now2 = obj2.value.split("-");
		//objType = "0";		
	}

	var int_now1_y = "";
	var int_now1_m = "";
	var int_now1_d = "";
	var int_now2_y = "";
	var int_now2_m = "";
	var int_now2_d = "";				

	if (now.length == 3) {
		int_now1_y = now[0];
		int_now1_m = now[1];
		int_now1_d = now[2];
	}else
	{
		now = new Date();
		int_now1_y = now.getFullYear();
		int_now1_m = now.getMonth()+1;
		int_now1_d = now.getDate();
	}
	
	if (now2.length == 3) {
		int_now2_y = now2[0];
		int_now2_m = now2[1];
		int_now2_d = now2[2];
	}else
	{
		now2 = new Date();
		int_now2_y = now2.getFullYear();
		int_now2_m = now2.getMonth()+1;
		int_now2_d = now2.getDate();
	}

	fn_cal_main(int_now1_y, int_now1_m, int_now1_d, int_now2_y, int_now2_m, int_now2_d, obj1.id, obj2.id);	
	
}


//=============================================================================
// 함수명: 달력 Popup 
// 설  명: 달력 Popup 기본 모양을 만드는 함수
// 작업일: 2008-04-29
// 작업자: 윤석호
//=============================================================================

function fn_cal_main(sYear, sMonth, sDay, sYear2, sMonth2, sDay2, str_id1, str_id2)
{
	var Cal_HTML = "";
	Cal_HTML += "<html>";
	Cal_HTML +=		"<head>";
	Cal_HTML +=		"</head>";
	Cal_HTML +=		"<body>";
	Cal_HTML +=			"<table border=1 cellspacing=0 cellpadding=0>";
	Cal_HTML +=				"<tr>";
	Cal_HTML +=					"<td valign='top'>";
	Cal_HTML +=						"<div id='div_" + str_id1 + "'>";
	Cal_HTML +=						"</div>";	
	Cal_HTML +=					"</td>";

	//두번째 input이 없으면 화면에 출력하지 않는다.
	if (str_id2 != null && str_id2 != "")
	{
		Cal_HTML +=					"<td valign='top'>";
		Cal_HTML +=						"<div id='div_" + str_id2 + "'>";	
		Cal_HTML +=						"</div>";
		Cal_HTML +=					"</td>";
	}

	Cal_HTML +=				"</tr>";
	Cal_HTML +=			"</table>";
	Cal_HTML +=		"</body>";
	Cal_HTML += "</html>";

	var oPopBody = oPopup.document.body;
	//oPopBody.style.backgroundColor = "lightyellow";
	//oPopBody.style.border = "solid black 1px";

	oPopBody.innerHTML = Cal_HTML;
	
	var int_calWidth = 158;

	Show_Recal(sYear, sMonth, sDay, str_id1, '1');

	if (str_id2 != null && str_id2 != "")	
	{
		Show_Recal(sYear2, sMonth2, sDay2, str_id2, '2');
		
		int_calWidth = 316;
	}

	//var calHeight = oPopBody.document.all.Cal_Table.offsetHeight;
	var calHeight = oPopBody.document.getElementById("Cal_Table_" + str_id1).offsetHeight;		
	
	/*
	//행이 6개 행인지, 5개인지 구분
	if (intLoopWeek == 6)	calHeight = 214;
	else	calHeight = 189;
	*/
	
	calHeight = 198;

	/*
	if(objType != "2"){
		//oPopup.show(pop_left, (pop_top + target.offsetHeight - 1), 158, calHeight, document.body);
		oPopup.show(pop_left, (pop_top + document.getElementById(str_id1).offsetHeight - 1), 336, calHeight, document.body);
	}else {
		//oPopup.show(pop_left, pop_top, 158, calHeight, document.body);
		oPopup.show(pop_left, pop_top, 336, calHeight, document.body);
	}
	*/

	oPopup.show(pop_left, (pop_top + document.getElementById(str_id1).offsetHeight - 1), int_calWidth, calHeight, document.body);	
	
}

//=============================================================================
// 함수명: 달력 Popup 
// 설  명: 달력 Popup 객체에 달력모양을 만들어서 넣는다.
// 작업일: 2008-04-29
// 작업자: 윤석호
//=============================================================================

function Show_Recal(sYear, sMonth, sDay, str_id, seq)
{
	var Months_day = new Array(0,31,28,31,30,31,30,31,31,30,31,30,31)
	var Month_Val = new Array("01","02","03","04","05","06","07","08","09","10","11","12");
	var intThisYear = new Number(), intThisMonth = new Number(), intThisDay = new Number();
	var intTargetYear = new Number(), intTargetMonth = new Number(), intTargetDay = new Number();
			
	datToday = new Date();													// 현재 날자 설정
	
	var obj = document.getElementById(str_id);	

	try
	{
		if ( obj.value != "" )
		{
			intTargetYear = obj.value.substr(0, 4);
			intTargetMonth = obj.value.substr(5, 2);
			intTargetDay = obj.value.substr(8, 2);
		} else {
			intTargetYear = datToday.getFullYear();
			intTargetMonth = parseInt(datToday.getMonth(),10)+1;
			intTargetDay = datToday.getDate();
		}

		intTargetYear = parseInt(intTargetYear,10);
		intTargetMonth = parseInt(intTargetMonth,10);
		intTargetDay = parseInt(intTargetDay,10);
		
	} catch (ex) {
		intTargetYear = 0;
		intTargetMonth = 0;
		intTargetDay = 0;
	}

	intThisYear = parseInt(sYear,10);
	intThisMonth = parseInt(sMonth,10);
	intThisDay = parseInt(sDay,10);

	if (intThisYear == 0) intThisYear = datToday.getFullYear();				// 값이 없을 경우
	if (intThisMonth == 0) intThisMonth = parseInt(datToday.getMonth(),10)+1;	// 월 값은 실제값 보다 -1 한 값이 돼돌려 진다.
	if (intThisDay == 0) intThisDay = datToday.getDate();

	switch(intThisMonth) {
		case 1:
				intPrevYear = intThisYear -1;
				intPrevMonth = 12;
				intNextYear = intThisYear;
				intNextMonth = 2;
				break;
		case 12:
				intPrevYear = intThisYear;
				intPrevMonth = 11;
				intNextYear = intThisYear + 1;
				intNextMonth = 1;
				break;
		default:
				intPrevYear = intThisYear;
				intPrevMonth = parseInt(intThisMonth,10) - 1;
				intNextYear = intThisYear;
				intNextMonth = parseInt(intThisMonth,10) + 1;
				break;
	}
	intPPyear = intThisYear-1
	intNNyear = intThisYear+1

	NowThisYear = datToday.getFullYear();									// 현재 년
	NowThisMonth = datToday.getMonth()+1;									// 현재 월
	NowThisDay = datToday.getDate();											// 현재 일

	datFirstDay = new Date(intThisYear, intThisMonth-1, 1);			// 현재 달의 1일로 날자 객체 생성(월은 0부터 11까지의 정수(1월부터 12월))
	intFirstWeekday = datFirstDay.getDay();									// 현재 달 1일의 요일을 구함 (0:일요일, 1:월요일)
	//intSecondWeekday = intFirstWeekday;
	intThirdWeekday = intFirstWeekday;

	datThisDay = new Date(intThisYear, intThisMonth, intThisDay);	// 넘어온 값의 날자 생성
	//intThisWeekday = datThisDay.getDay();										// 넘어온 날자의 주 요일

	intPrintDay = 1;																// 달의 시작 일자
	secondPrintDay = 1;
	thirdPrintDay = 1;

	Stop_Flag = 0

	if ((intThisYear % 4)==0) {												// 4년마다 1번이면 (사로나누어 떨어지면)
		if ((intThisYear % 100) == 0) {
			if ((intThisYear % 400) == 0) {
				Months_day[2] = 29;
			}
		} else {
			Months_day[2] = 29;
		}
	}
	intLastDay = Months_day[intThisMonth];						// 마지막 일자 구함
	
	var imgClose;
	if (seq =='2')
	    imgClose = "<a onClick=parent.fn_Calendar_hide(this,'" + str_id + "'); style='cursor:hand;'><img src='/aspGroupWare/ImageSite/COMMON/bt_comment_x.gif'></a>";
	else 
	    imgClose = "";

	Cal_HTML = "";
	Cal_HTML += "<table border=0 cellspacing=0 cellpadding=0 bgcolor='#000000'>";
	Cal_HTML += "	<tr>";
	Cal_HTML += "		<td bgcolor='#FFFFFF' valign='top'>";
	Cal_HTML += "			<form name='calendar_" + str_id + "'>";
	Cal_HTML += "			<table id=Cal_Table_" + str_id + " border=0 bgcolor='#FFFFFF' cellpadding=0 cellspacing=1 style='font-family : Tahoma, dotum; font-size : 11px; color : #666666;' onmouseover='parent.fn_doOver(window.event.srcElement)' onmouseout='parent.fn_doOut(window.event.srcElement)'>";
	Cal_HTML += "			  <tr height='25' align=center bgcolor='#F5F5F0'>";
	Cal_HTML += "			    <td colspan=7 align=right>";
	Cal_HTML += "			      <table border=0 cellspacing=0 cellpadding=0>";
	Cal_HTML += "			      	<tr>";
	Cal_HTML += "						<td>";
	Cal_HTML += "			      			<a style='cursor:hand;' OnClick='parent.Show_Recal("+ parseInt(intPrevYear - 10) + ","+parseInt(intPrevMonth + 1)+","+intThisDay+", \"" + str_id +"\");'><img src='" + cal_img_url + "icon_prevmonth.gif' width=14 height=14 align=absmiddle border=0></a>";
	Cal_HTML += "			      		</td>";
	Cal_HTML += "			      		<td>";
	Cal_HTML += "						      <select name='selYear_" + str_id + "' style='font-family : Tahoma; font-size : 11px; color : #666666;' OnChange='parent.Show_Recal(calendar_" + str_id + ".selYear_" + str_id + ".value, calendar_" + str_id + ".selMonth_" + str_id + ".value, "+intThisDay+", \"" + str_id +"\")';>";
	for (var optYear=(intThisYear-5); optYear<(intThisYear+5); optYear++) {
		Cal_HTML += "<option value='"+optYear+"' ";
		if (optYear == intThisYear) Cal_HTML += " selected>\n";
		else Cal_HTML += ">\n";
		Cal_HTML += optYear+"</option>\n";
	}
	Cal_HTML += "						      </select>";
	Cal_HTML += "						    </td>";
	Cal_HTML += "						<td>";
	Cal_HTML += "			      			<a style='cursor:hand;' OnClick='parent.Show_Recal("+parseInt(intPrevYear + 10) +","+ parseInt(intPrevMonth + 1)+","+intThisDay+", \"" + str_id +"\");'><img src='" + cal_img_url + "icon_nextmonth.gif' width=14 height=14 align=absmiddle border=0></a>";
	Cal_HTML += "			      		</td>";
	Cal_HTML += "						    <td width=5></td>";
	Cal_HTML += "						    <td>";
	Cal_HTML += "			      			<a style='cursor:hand;' OnClick='parent.Show_Recal("+intPrevYear+","+intPrevMonth+","+intThisDay+", \"" + str_id +"\");'><img src='" + cal_img_url + "icon_prevmonth.gif' width=14 height=14 align=absmiddle border=0></a>";
	Cal_HTML += "			      		</td>";
	Cal_HTML += "			      		<td style='padding:0 2 0 2;'>";
	Cal_HTML += "						      <select name='selMonth_" + str_id + "' style='font-family : Tahoma; font-size : 11px; color : #666666;' OnChange='parent.Show_Recal(calendar_" + str_id + ".selYear_" + str_id + ".value, calendar_" + str_id + ".selMonth_" + str_id + ".value, "+intThisDay+", \"" + str_id +"\")';>";
	for (var i=1; i<13; i++) {
		Cal_HTML += "<option value='"+Month_Val[i-1]+"' ";
		if (intThisMonth == parseInt(Month_Val[i-1],10)) Cal_HTML += " selected>\n";
		else Cal_HTML += ">\n";
		Cal_HTML += Month_Val[i-1]+"</option>\n";
	}
	Cal_HTML += "						      </select>";
	Cal_HTML += "						    </td>";
	Cal_HTML += "						    <td>";
	Cal_HTML += "			      			<a style='cursor:hand;' OnClick='parent.Show_Recal("+intNextYear+","+intNextMonth+","+intThisDay+", \"" + str_id +"\");'><img src='" + cal_img_url + "icon_nextmonth.gif' width=14 height=14 align=absmiddle border=0></a>";
	Cal_HTML += "			      		</td>";
	Cal_HTML += "			      	</tr>";
	Cal_HTML += "			      </table>";
	Cal_HTML += "			  	</td>";
	Cal_HTML += "			  </tr>";
	Cal_HTML += "			  <tr align=center bgcolor='#EAEAE4' height='19'>";
	Cal_HTML += "			    <td width=21 style='padding-top:1; font-family : Tahoma; font-size : 12px; color : #D5518F; background-color : #FFE5F1'>일</td>";
	Cal_HTML += "			    <td width=21 style='padding-top:1; font-family : Tahoma; font-size : 12px; color : #000000; background-color : #EAEAE4'>월</td>";
	Cal_HTML += "			    <td width=21 style='padding-top:1; font-family : Tahoma; font-size : 12px; color : #000000; background-color : #EAEAE4'>화</td>";
	Cal_HTML += "			    <td width=21 style='padding-top:1; font-family : Tahoma; font-size : 12px; color : #000000; background-color : #EAEAE4'>수</td>";
	Cal_HTML += "			    <td width=21 style='padding-top:1; font-family : Tahoma; font-size : 12px; color : #000000; background-color : #EAEAE4'>목</td>";
	Cal_HTML += "			    <td width=21 style='padding-top:1; font-family : Tahoma; font-size : 12px; color : #000000; background-color : #EAEAE4'>금</td>";
	Cal_HTML += "			    <td width=21 style='padding-top:1; font-family : Tahoma; font-size : 12px; color : #2086EF; background-color : #CFE7FF'>토</td>";
	Cal_HTML += "			  </tr>";

	for (intLoopWeek=1; intLoopWeek < 7; intLoopWeek++) {	// 주단위 루프 시작, 최대 6주
		Cal_HTML += "<tr height='17' align=center bgcolor='white' title='aaa'>"
		for (intLoopDay=1; intLoopDay <= 7; intLoopDay++) {	// 요일단위 루프 시작, 일요일 부터
			if (intThirdWeekday > 0) {											// 첫주 시작일이 1보다 크면
				Cal_HTML += "<td>";
				intThirdWeekday--;
			} else {
				if (thirdPrintDay > intLastDay) {								// 입력 날짝 월말보다 크다면
					Cal_HTML += "<td>";
				} else {																// 입력날짜가 현재월에 해당 되면
					Cal_HTML += "<td onClick=parent.fn_Calendar_Click(this,'" + str_id + "'); title="+intThisYear+"-"+fn_day2(intThisMonth).toString()+"-"+fn_day2(thirdPrintDay).toString()+" style=\"cursor:Hand;";

					if (intThisYear == intTargetYear && intThisMonth == intTargetMonth && thirdPrintDay == intTargetDay) {
						Cal_HTML += "border:1px solid #79C5E2;background-color:#D2EBF5;";
					} else {
						Cal_HTML += "border:1px solid #FFFFFF;";
					}

					switch(intLoopDay) {
						case 1:															// 일요일이면 빨간 색으로
							Cal_HTML += "color:#D5518F;"
							break;
						case 7:
							Cal_HTML += "color:#2086EF;"
							break;
						default:
							Cal_HTML += ""
							break;
					}
					Cal_HTML += "\">"+thirdPrintDay;
				}
				thirdPrintDay++;

				if (thirdPrintDay > intLastDay) {								// 만약 날짜 값이 월말 값보다 크면 루프문 탈출
					Stop_Flag = 1;
				}
			}
			Cal_HTML += "</td>";
		}
		Cal_HTML += "</tr>";
		if (Stop_Flag==1) break;
	}

	Cal_HTML += "			  <tr height='19' align=center>";
	Cal_HTML += "			    <td colspan=7 title="+NowThisYear+"-"+fn_day2(NowThisMonth).toString()+"-"+fn_day2(NowThisDay).toString()+" >";
	Cal_HTML += "			    	<table border='0' cellpadding='0' cellspacing='0' width='100%'><tr><td style='padding-top:1;color:#000000;cursor:hand;border:1px solid #FFFFFF;font-size:8pt'  onclick='parent.fn_Calendar_Today(this, \"" + str_id + "\");'>&nbsp;Today : "+NowThisYear+"-"+fn_day2(NowThisMonth).toString()+"-"+fn_day2(NowThisDay).toString()+"</td><td>"+imgClose+"</td></tr></table>";
	Cal_HTML += "			    </td>";
	Cal_HTML += "			  </tr>";
	Cal_HTML += "			</table>";
	Cal_HTML += "			</form></td>";		
	Cal_HTML += "		</tr>";
	Cal_HTML += "</table>";	
	
	oPopup.document.getElementById("div_" + str_id).innerHTML = Cal_HTML;	
}

function fn_Calendar_hide(e, str_id)
{
		oPopup.hide();	
}

//달력 Popup에서 사용
//선택한 날짜를 해당하는 객체에 값으로 반환한다.
function fn_Calendar_Click(e, str_id) {	
	var cal_Day = e.title;
	
	var obj = document.getElementById(str_id);

	if (cal_Day.length > 6) {
		obj.value = cal_Day.replace("/","-");

		//e.style.backgroundColor = "#D2EBF5";
		//alert(e.parentElement);
		//parentNode
		//e.cellIndex 
		//alert(e.parentNode.parentNode.rowIndex);
		//alert(e.parentNode);
	}
	
	//만일 창의 폭이 316보다 작으면 달력이 하나이므로 날짜 선택 후 창을 자동으로 닫는다.
	if (oPopup.document.body.offsetWidth < 316)
	{
		oPopup.hide();				
	}
	
	if (str_g_reFunctionName != "")
	{
		eval(str_g_reFunctionName);
	}
}

//달력 Popup에서 사용
//달력 Popup에서 오늘 날짜를 선택하는 해당 값을 호출한 객체의 값으로 준다.
function fn_Calendar_Today(e, str_id) {
	var cal_Day = e.title;

	var obj = document.getElementById(str_id);
	
	if (cal_Day.length > 6) {
		obj.value = cal_Day		

		var now = obj.value.split("-");

		if (now.length == 3) {
			Show_Recal(now[0],now[1],now[2], str_id);
		} else {
			now = new Date();
			Show_Recal(now.getFullYear(), now.getMonth()+1, now.getDate(), str_id);
		}

		//oPopup.hide();
	}
}

//달력 Popup에서 사용
function fn_day2(d) {	// 2자리 숫자료 변경
	var str = new String();

	if (parseInt(d) < 10) {
		str = "0" + parseInt(d);
	} else {
		str = "" + parseInt(d);
	}
	return str;
}

//달력 Popup에서 사용
function fn_doOver(el) {
	var cal_Day = el.title;

	if (cal_Day.length > 6) {
		if ( el.style.backgroundColor.toUpperCase() == "#D2EBF5" )
		{
			el.style.borderColor = "#79C5E2";
			el.style.backgroundColor = "#D2EBF5";
		} else {
			el.style.borderColor = "#E279AD";
			el.style.backgroundColor = "#F4DDEB";
		}
	}
}

//달력 Popup에서 사용
function fn_doOut(el) {
	var bgcolor
	var cal_Day = el.title;

	if (cal_Day.length > 6) {
		if ( el.style.backgroundColor.toUpperCase() == "#D2EBF5" )
		{
			el.style.borderColor = "#79C5E2";
			el.style.backgroundColor = "#D2EBF5";
		} else {
			el.style.borderColor = "#FFFFFF";
			el.style.backgroundColor = "#FFFFFF";
		}
	}
}

//달력 Popup를 사용하는 객체의 위치를 계산
function fn_GetObjectTop(obj)
{
    if( obj != null)
    {
	    if (obj.offsetParent == document.body)
		    return obj.offsetTop;
	    else
		    return obj.offsetTop + fn_GetObjectTop(obj.offsetParent);
	}
	else
	{
	    return document.body.scrollTop;
	}
}

function fn_GetObjectLeft(obj)
{
    if( obj != null)
    {
	    if (obj.offsetParent == document.body)
		    return obj.offsetLeft;
	    else
		    return obj.offsetLeft + fn_GetObjectLeft(obj.offsetParent);
	}
	else
	{
	    return document.body.scrollLeft;
	}
}

//--------------------------------------------------------------------------------------// 
/* 미리보기 (인쇄)
printHtml : div ID 
('div ID', 6, -1 ): 인쇄바로하기
('div ID', 6 ): 대화상자표시(인쇄하기)
('div ID', 7 ): 인쇄미리보기
('div ID', 8 ): 페이지 설정
psDisplayNone : 인쇄시 나오지 않게 할 컨트롤 ID (,)콤마 구분
(ex)  window.ieExecWB('divAppTop',7);
(ex)  window.ieExecWB('',7); //현재 페이지 미리보기
*/

function ieExecWB( printHtml, intOLEcmd, intOLEparam , prDisplayNone)
{
    var displayCtrl = prDisplayNone.split(',');
    var nfor, nlen = displayCtrl.length;
    //현재 페이지
    var bodyHtml = document.body.innerHTML;
    
    
    
    for(nfor = 0; nfor< nlen ; nfor++)
    {
        //alert(document.all[displayCtrl[nfor]]);
        //document.getElementById(displayCtrl[nfor]).display = "none";
        if( document.all[displayCtrl[nfor]] != null )
            document.all[displayCtrl[nfor]].style.display = "none";
    }
    
    // 웹 브라우저 컨트롤 생성
    var WebBrowser = '<object ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>';
    
    if ( printHtml != '')//DIV ID가 있을 경우innerHTML 출력, 없을경우 현 페이지 출력
    {
        document.body.innerHTML  = document.getElementById(printHtml).innerHTML;
    }

    // 웹 페이지에 객체 삽입
    document.body.insertAdjacentHTML('beforeEnd',WebBrowser);
     
    // if intOLEparam이 정의되어 있지 않으면 디폴트 값 설정
    if ( ( ! intOLEparam ) || ( intOLEparam < -1 )  || (intOLEparam > 1 ) )
            intOLEparam = 1;
     
    // ExexWB 메쏘드 실행
    WebBrowser1.ExecWB( intOLEcmd, intOLEparam );
 
    // 객체 해제
    WebBrowser1.outerHTML = "";
    
    if ( printHtml != '')//DIV ID가 있을 경우현 페이지로 돌리기.
    {
        document.body.innerHTML = bodyHtml;
    }
}

//--------------------------------------------------------------------------------------// 
/* 미리보기 (인쇄)
printFrame : frame 내의 페이지 인쇄.
('frame ID', 6, -1 ): 인쇄바로하기
('frame ID', 6 ): 대화상자표시(인쇄하기)
('frame ID', 7 ): 인쇄미리보기
('frame ID', 8 ): 페이지 설정
psDisplayNone : 인쇄시 나오지 않게 할 컨트롤 ID (,)콤마 구분

(ex)  window.ieExecWB_Frm('frame ID',7,0 'ctrlID1,ctrlID2' );
*/
function ieExecWB_Frm( printFrame, intOLEcmd, intOLEparam , psDisplayNone)
{
    var displayCtrl = psDisplayNone.split(',');
    var nfor, nlen = displayCtrl.length;
    //현재 페이지
    var bodyHtml = document.body.innerHTML;
    
    // 웹 브라우저 컨트롤 생성
    var WebBrowser = '<object ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>';
    
    for(nfor = 0; nfor< nlen ; nfor++)
    {
        if( document.frames(printFrame).document.getElementById(displayCtrl[nfor]) != null )
            document.frames(printFrame).document.getElementById(displayCtrl[nfor]).style.display = "none";
    }
    
    // 웹 페이지에 객체 삽입
    document.body.insertAdjacentHTML('beforeEnd',WebBrowser);
     
    // if intOLEparam이 정의되어 있지 않으면 디폴트 값 설정
    if ( ( ! intOLEparam ) || ( intOLEparam < -1 )  || (intOLEparam > 1 ) )
            intOLEparam = 1;
     
    // ExexWB 메쏘드 실행
    WebBrowser1.document.all[printFrame].ExecWB( intOLEcmd, intOLEparam );
    
     // 객체 해제
    WebBrowser1.outerHTML = "";
    document.body.innerHTML = bodyHtml;
}


//Input ReadOnly 풀기
function InputAllReadOnlyF()
{
    oINPUT = document.getElementsByTagName("INPUT");
    for( var i =0; i < oINPUT.length; i++)
    {
        if(oINPUT[i].type == "text") {
        oINPUT[i].readOnly = false;
        oINPUT[i].className="readonly";            
        }
    }
}
//Input ReadOnly 
function InputAllReadOnlyT()
{
    oINPUT = document.getElementsByTagName("INPUT");
    for( var i =0; i < oINPUT.length; i++)
    {
        if(oINPUT[i].type == "text") {
        oINPUT[i].readOnly = true;
        oINPUT[i].className="readonly";            
        }
    }
}   

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////    PrintingPark (2008.09.01~)                                                                                                                                       
////    베네콥추가 
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//-- 보안인증페이지의 헤더바꾸기
function Movepage(pageName,certifyYN)
{
    var pageName=pageName;
    var url = HeaderUrl(certifyYN)
    //alert(url);
    //alert(pageName);   
    document.location.href = url + pageName;
} 

//-- 부모페이지호출 
function ParentMovepage(pageName,certifyYN)
{
    var pageName=pageName;
    var url = HeaderUrl(certifyYN)
  
    parent.document.location.href = url + pageName;
} 
  
//-- OPENER페이지호출
function OpenerMovepage(pageName,certifyYN)
{
    var pageName=pageName;
    var url = HeaderUrl(certifyYN)

    opener.document.location.href = url + pageName;
}  
  
//-- OPENER,PARENT페이지 호출 
function OpenerParentMovePage(pageName,certifyYN)
{
    var pageName=pageName;
    var url = HeaderUrl(certifyYN)

    opener.parent.document.location.href = url + pageName;
} 

//-- post방식으로 페이지이동시 
function PostMovepage(pageName,certifyYN)
{
    alert("post방식으로 페이지이동시");

    var pageName=pageName;
    var url=HeaderUrl(certifyYN);

    document.forms[0].method = "post";
    document.forms[0].action = url + pageName;
    document.forms[0].submit();
}   
     
//-- 헤더가져오기.
function HeaderUrl(certifyYN)
{
//    var url;
//    if(certifyYN=="Y")
//    { 
//        url="https://192.168.5.102:8085/";
//    }
//    else if(certifyYN=="N")
//    {      
//        url="http://192.168.5.102:8085/";
//    }        
      
    return "";   
}   

//-- 이메일체인지
function EmailChange(obj1, obj2)
{

    if(document.getElementById(obj1).value == "No")
    { 
        //obj2.value = "";
        document.getElementById(obj2).readOnly = false;
        //document.getElementById(obj2).focus();
        document.getElementById(obj2).style.backgroundColor = "#f8f9fb";
        
    }
    else
    {
        document.getElementById(obj2).value = document.getElementById(obj1).value;
        document.getElementById(obj2).readOnly = true;
        document.getElementById(obj2).style.backgroundColor = "#E6E9F8";

    }
    
}  

//-- 결제권한여부 드롭다운리스트 change할경우
function PayChange(obj1, obj2, obj3)
{
    //obj1 : ddlPayYn
    //obj2 : txtPayTeam
    //obj3 :hdPayTeamNo
    if(document.getElementById(obj1).value == "2")
    { 

        document.getElementById(obj2).style.backgroundColor = "#f8f9fb";
        
    }
    else
    {
        document.getElementById(obj2).style.backgroundColor = "#E6E9F8";
        document.getElementById(obj3).value = "";
        document.getElementById(obj2).value = "";

    }
}
               

//-- 전화번호체인지
function PhoneChange(obj1, obj2, obj3)
{
    //전화번호 dropdownlis가 선택(No)일경우 전화번호 중간, 뒷자리의 텍스트박스를 readonly시킨다.
    if(document.getElementById(obj1).value == "No")
    { 
        //obj2.value = "";
        document.getElementById(obj2).readOnly = true;
        document.getElementById(obj2).value = "";
        document.getElementById(obj2).style.backgroundColor = "#E6E9F8";
        
        
        document.getElementById(obj3).readOnly = true;
        document.getElementById(obj3).value = "";
        document.getElementById(obj3).style.backgroundColor = "#E6E9F8";
                
    }            
    else   
    {
        document.getElementById(obj2).readOnly = false;
        document.getElementById(obj3).readOnly = false;
        
        document.getElementById(obj2).focus();
        document.getElementById(obj2).style.backgroundColor = "#f8f9fb";
        document.getElementById(obj3).style.backgroundColor = "#f8f9fb";

    }
    
}   


//-- 필드가 비어있는지 체크
function BlankCheck(iLen)
{
    if(iLen == 0)
    {    
        return false;
    }
    
    return true;
}      

//-- 기준값(길이) 사이에 문자수가 정확한지 체크 (영문 + 숫자일경우 사용)
function LenAreaCheck(sValue, iStart, iEnd, sMsg)
{
    if((sValue.length<iStart || sValue.length>iEnd)&& iStart==iEnd )
     {
        alert(sMsg+" "+iStart+"자 이어야합니다.");   
         return false;   
     } 
    if((sValue.length < iStart || sValue.length > iEnd)&& iStart!=iEnd )
    {
        alert(sMsg + " " + iStart + "자 이상 " + iEnd + "자 이하이어야 합니다.");
        return false;
    }  
    return true;      
} 

//-- 텍스트값 체크
function TextCheck(sDivision, sValue, iStartByte, iEndByte, sName1, sName2)
{
    /*
    ex)TextCheck('B', document.getElementById("<%=txtCo_nm_kor.ClientID%>").value, 0, 100, "회사명을 ", "회사명은 ")
    
    sDivision = "A" 인경우 비었는지만 체크
    sDivision = "B" 인경우 비었는지 체크, iEndByte(BYTE) 체크.
    sDivision = "C" 인경우 iEndByte(BYTE) 체크.
    sDivision = "D" 인경우 iStartByte(BYTE) ~ iEndByte(BYTE) 사이값인지 체크.
    sDivision = "E" 인경우 비었는지 체크, iStartByte(BYTE) ~ iEndByte(BYTE) 사이값인지 체크.
    
    */
    
    
    var blankBol = BlankCheck(Trim(sValue)); //비어있는체크. 비어있으면 false, 비어있지않으면 true
    //var countByte = BytesCheck(Trim(sValue)); //바이트체크
    var countByte = Trim(sValue).length;
    
    switch(sDivision)
	{
		case "A":
		    if(blankBol == false)
		    {
		        alert(sName1 + " 입력하세요.");
		        return false;
		    }
			break;
		case "B":
		    if(blankBol == false)
		    {
		        alert(sName1 + " 입력하세요.");
		        return false;
		    }
		    
		    if(countByte > iEndByte)
		    {
		        alert(sName2 + " " + iEndByte + "자를 초과할수없습니다.\r\n(현재 " + countByte + "자)");
		        return false;
		    }
			break;
		case "C":
		    if(countByte > iEndByte)
		    {
		        alert(sName2 + " " + iEndByte + "자를 초과할수없습니다.\r\n(현재 " + countByte + "자)");
		        return false;
		    }
		    break;
	    case "D":
		    if(countByte < iStartByte || countByte > iEndByte )
		    {
		        alert(sName1 + " 정확히 입력하세요.");
		        return false;
		    }
		    break;
		case "E":
		
		    if(blankBol == false)
		    {
		        alert(sName1 + " 입력하세요.");
		        return false;
		    }
		    
		    if(countByte < iStartByte || countByte > iEndByte )
		    {
		        //alert(countByte);
		        alert(sName2 + " " + iStartByte + "자 이상 " + iEndByte + "자 이하여야합니다.");
		        return false;
		    }

			break;
		
	}
	
	return true;
    
}


//-- 바이트수체크
function BytesCheck(sValue)
{
    var tcount = 0;

    var tmpStr = new String(sValue);
    var temp = tmpStr.length;

    var onechar;
    for ( k=0; k<temp; k++ )
    {
        onechar = tmpStr.charAt(k);
        if (escape(onechar).length > 4)
        {
            tcount += 2;
        }
        else
        {
            tcount += 1;
        }
    }

    return tcount;
}

//-- 그리드 마우스오버
function MClick(grid, rnk)
{
    var gd = document.getElementById(grid);
    if(gd != null)
    {
        for(var i=1; i < gd.rows.length; i++) 
        {
            if(rnk == i)
            {
                gd.rows[i].style.fontWeight = "bold";
            }
            else
            {
                gd.rows[i].style.fontWeight = "";
            }
            
        }
        
    }
    
    //obj.style.color = "red";
    
    //obj.style.fontWeight = "bold"
    
    //alert(obj.style.fontWeight);
}

function MOver(obj)
{
    obj.style.backgroundColor = '#f3f6fb';
}

function MOverHand(obj)
{
    obj.style.backgroundColor = '#f3f6fb';
    obj.style.cursor = 'hand' 
}

function MHand(obj)
{
    obj.style.cursor = 'hand' 
}

//-- 그리드 마우스아웃
function MOut(obj)
{
    obj.style.backgroundColor = '#ffffff';
}

//-- 폼 이동
function moveForm(str,nextOb,len) 
{
	if(str.length == len ) nextOb.focus();
}

//-- 파일포맷 체크 (gif, jpg, jpeg)
function FileFormatValidate(txtFile, format)
{
    //var IMG_FORMAT = "\\.(gif|jpg|jpeg)$";
    var IMG_FORMAT = format;
        if((new RegExp(IMG_FORMAT, "i")).test(txtFile)) 
        {
        
            return true;
        
        }
        else
        {
            //alert("gif, jpg 등 이미지 파일만 첨부하실 수 있습니다.");
            return false;
        }
}

//-- 파일포맷 체크 (pdf)
//function FileFormatValidatePDF(txtFile)
//{
//    var IMG_FORMAT = "\\.(pdf)$";
//        if((new RegExp(IMG_FORMAT, "i")).test(txtFile)) 
//        {
//        
//            return true;
//        
//        }
//        else
//        {
//            return false;
//        }
//}

//-- 그리드 헤더 전체선택/ 전체삭제.
function grvCheckAll(obj) 
{
    //alert (obj);

//    //obj --> 그리드명 clientid입력
//    var datagrid=document.getElementById(obj);
//     
//    if(datagrid != null)
//    {
//    
//        for(var i=1; i < datagrid.rows.length; i++) 
//        {
//	        if (datagrid.rows[0].all[1].type == "checkbox" && datagrid.rows[0].all[1].checked == true) 
//	        {
//		        datagrid.rows[i].all[1].checked = true; 
//	        } 
//	        else
//		    {	
//    		    datagrid.rows[i].all[1].checked = false; 
//	        }	 
//        }
//    }
    
    if(obj != null)
    {
        for(var i=1; i < obj.rows.length; i++) 
        {
	        if (obj.rows[0].all[1].type == "checkbox" && obj.rows[0].all[1].checked == true) 
	        {
		        obj.rows[i].all[1].checked = true; 
	        } 
	        else
		    {	
    		    obj.rows[i].all[1].checked = false; 
	        }	 
        }
    }
}
                
//-- 팝업1   
function NewWindow(mypage,myname,w,h,scroll,resize)
{ 
    LeftPosition=(screen.width-w)/2;
    TopPosition= (screen.height-h)/2;
    settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable='+resize;

    var childWindow = window.open(mypage,myname,settings);
    childWindow.focus();
}                     
	                        
//-- 팝업2
function NewWindow2(mypage,myname,w,h,scroll,resize)
{ 
    LeftPosition=(screen.width-(2*w))/2;
    TopPosition= (screen.height-h)/2;
    settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable='+resize;
    		       
    window.open(mypage,myname,settings).focus();
} 
	
//-- 주민번호유효성체크
function JuminCheck(RegisterNumber)
{
    //alert(RegisterNumber);   
    var str=RegisterNumber;
    var formulaNo = "234567892345"; 
    var total = 0; 
    var chk=false;
    for(i=0 ; i < 12; i++)
    { 
        temp = str.charAt(i)*formulaNo.charAt(i); 
        total += temp; 
    } 
    
    total = 11 - (total%11); 
    // alert(total);  
    if(total == 10) 
        total = 0; 
    else if(total == 11)    
        total = 1; 
        
    if(total != str.charAt(12))
    { 
        chk=false;   
    }
    else
    {
        chk=true;      
    }
    //  alert(chk);       
    return chk;      
}

//-- 스크롤포지션 지정 
function ScrollInit()
{
    document.documentElement.scrollTop = 0;

}  
        
        
//-- 사업자등록번호 체크 로직.
function checkBuisinessNo(saup1,saup2,saup3)
{
    var checkID = new Array(1, 3, 7, 1, 3, 7, 1, 3, 5, 1);
    var bizID = ""+ saup1 + saup2 + saup3;
    var i, Sum=0, c2, remander;

    for (i=0; i<=7; i++) Sum += checkID[i] * bizID.charAt(i);

    c2 = "0" + (checkID[8] * bizID.charAt(8));
    c2 = c2.substring(c2.length - 2, c2.length);

    Sum += Math.floor(c2.charAt(0)) + Math.floor(c2.charAt(1));

    remander = (10 - (Sum % 10)) % 10 ;

    if (Math.floor(bizID.charAt(9)) != remander)
    {
        alert ("정확한 사업자 등록번호를 입력하세요");
        return false;
    }
}


function NameCardCall(str)
{
    var addr="http://1.244.118.126:8080/namecard.jsp?"+str;
    NewWindow(addr,"wyswyg", "1210","700","no","yes");
}

function NameCardCall2(str)
{
    //var addr="http://118.129.171.156:8080/namecard.jsp?"+str;
    var addr="http://1.244.118.126:8080/namecard.jsp?"+str;
    
    LeftPosition=(screen.width-1210)/2;
    TopPosition= (screen.height-700)/2;
    settings = 'height=700,width=1210,top='+TopPosition+',left='+LeftPosition+',scrollbars=no,resizable=yes';

    var childWindow = window.open(addr,"wyswyg",settings);
    
    if (childWindow == null)
    {
        alert("팝업이 차단되었습니다.\n\n팝업 차단을 항상 허용으로 해주십시오.");
    }
    else
    {
        childWindow.focus();
    }
}

function PPRollick(str)
{
    //var addr="http://118.129.171.156:8080/namecard.jsp?"+str;
    var addr="/Html/PPRollick/PPRollick.aspx?"+str;
    
    LeftPosition=(screen.width-1180)/2;
    TopPosition= (screen.height-760)/2;
    settings = 'height=760,width=1180,top='+TopPosition+',left='+LeftPosition+',scrollbars=no,resizable=yes';

    var childWindow = window.open(addr,"wyswyg",settings);
    
    if (childWindow == null)
    {
        alert("팝업이 차단되었습니다.\n\n팝업 차단을 항상 허용으로 해주십시오.");
    }
    else
    {
        childWindow.focus();
    }
}
  
function ePPLink(param)
{
//    var addr=HeaderUrl('N') + "LoginPage.aspx" + param;
//    NewWindow(addr,"eprinting", "977","610","yes","no");
}
                  
                  
                  
//그리드의 체크된 건수를 반환
function GridCheckCount(obj)
{
    //체크된 숫자 저장
    var count = 0;
    
    var datagrid=obj;
    if(datagrid != null)
    {
        
    
        for(var i=1; i < datagrid.rows.length; i++) 
        {
            if(datagrid.rows[i].all[1].checked == true)
            {
                count ++;
            } 
        }
    }
    
    return count;

}


//----- base64 ---------------------------------------------------------------------------------------
function encode64(input) {
   var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
   var output = "";
   var chr1, chr2, chr3;
   var enc1, enc2, enc3, enc4;
   var i = 0;

   do {
      chr1 = input.charCodeAt(i++);
      chr2 = input.charCodeAt(i++);
      chr3 = input.charCodeAt(i++);

      enc1 = chr1 >> 2;
      enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
      enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
      enc4 = chr3 & 63;

      if (isNaN(chr2)) {
         enc3 = enc4 = 64;
      } else if (isNaN(chr3)) {
         enc4 = 64;
      }

      output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + 
         keyStr.charAt(enc3) + keyStr.charAt(enc4);
   } while (i < input.length);
   
   return output;
}


function decode64(input) {
   var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
   var output = "";
   var chr1, chr2, chr3;
   var enc1, enc2, enc3, enc4;
   var i = 0;

   // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
   input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

   do {
      enc1 = keyStr.indexOf(input.charAt(i++));
      enc2 = keyStr.indexOf(input.charAt(i++));
      enc3 = keyStr.indexOf(input.charAt(i++));
      enc4 = keyStr.indexOf(input.charAt(i++));

      chr1 = (enc1 << 2) | (enc2 >> 4);
      chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
      chr3 = ((enc3 & 3) << 6) | enc4;

      output = output + String.fromCharCode(chr1);

      if (enc3 != 64) {
         output = output + String.fromCharCode(chr2);
      }
      if (enc4 != 64) {
         output = output + String.fromCharCode(chr3);
      }
   } while (i < input.length);

   return output;
}

function encode64Han(str) {
  return encode64(escape(str))
}
function decode64Han(str) {
  return unescape(decode64(str))
}

// 반올림 함수
function round(val,precision) 
{ 
    val = val * Math.pow(10,precision); 
    val = Math.round(val); 
    return val/Math.pow(10,precision); 
}

// 통화단위 표현 함수
function commaNum(num) 
{
    if (num < 0) { num *= -1; var minus = true} 
    else var minus = false      
    var dotPos = (num+"").split(".")
    var dotU = dotPos[0] 
    var dotD = dotPos[1] 
    var commaFlag = dotU.length%3 

    if(commaFlag) { 
        var out = dotU.substring(0, commaFlag)  
        if (dotU.length > 3) out += "," 
    } 
    else var out = "" 
    for (var i=commaFlag; i < dotU.length; i+=3) { 
        out += dotU.substring(i, i+3)  
        if( i < dotU.length-3) out += "," 
    } 
    if(minus) out = "-" + out 
    if(dotD) return out + "." + dotD 
    else return out 
} 

/*숫자만 입력 가능*/
function f_keyIsNum()
{
	var e = event.keyCode;
	
	if ((e >= 48 && e <= 57) || (e >= 96 && e <= 105) || e == 8 || e == 46 || e == 37 || e == 39 || e == 109 || e == 35 || e == 36 || e == 9)
		event.returnValue = true;
	else
		event.returnValue = false;
}

//숫자인지를 돌려줌 
//문자열 중에서 꼼마를 제거함.
function isNum(num)
{
    
	if (num == '')
	{
	 return false;
	}

	var Tnum = Trim(num.replace(/,/g,''));
   
    state = false
    if (num != '')
    {
	   	var state = isNaN(num);
		state = !state;
    }
    
	return state
}//isNumeric

//<!-- AceCounter Log Gathering Script V.71.2010011401 -->
if(typeof _GUL == 'undefined'){
var _GUL = 'gtb9.acecounter.com';var _GPT='8080'; var _AIMG = new Image(); var _bn=navigator.appName; var _PR = location.protocol=="https:"?"https://"+_GUL:"http://"+_GUL+":"+_GPT;if( _bn.indexOf("Netscape") > -1 || _bn=="Mozilla"){ setTimeout("_AIMG.src = _PR+'/?cookie';",1); } else{ _AIMG.src = _PR+'/?cookie'; };
document.writeln("<scr"+"ipt language='javascript' src='/Common/Js/acecounter_V70.js'></scr"+"ipt>");
}
//<!-- AceCounter Log Gathering Script End -->

// 20110222 new tab

// Tab Content
function initTabMenu(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "tab")
			thismenu = tabAnchor.item(i);
		else
			continue;

		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);
		if (thismenu.imgEl) {
			thismenu.onmouseover = function () {
				//this.onclick();
			}
		}
		thismenu.onclick = tabMenuClick;
		
		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
	}
	tabContainer.first.onclick();
}
function tabMenuClick() {
	currentmenu = this.container.current;
	if (currentmenu != this) {
		if (currentmenu) {
			currentmenu.targetEl.style.display = "none";
			if (currentmenu.imgEl) {
				currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_over.gif", ".gif");
			} else {
				currentmenu.className = currentmenu.className.replace(" on", "");
			}
		}

		this.targetEl.style.display = "block";
		if (this.imgEl) {
			this.imgEl.src = this.imgEl.src.replace(".gif", "_over.gif");
		} else {
			this.className += " on";
		}
		this.container.current = this;
	}
	return false;
}


// 플래시
function showflashes(_file_, _width_, _height_) {
  var _object_ = "";
  _object_ += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ _width_ +'" height="'+ _height_ +'">';
  _object_ += '<param name="movie" value="'+ _file_ +'">';
  _object_ += '<param name="quality" value="high">';
  _object_ += '<param name="wmode" value="transparent">';
  _object_ += '<embed src="'+ _file_ +'" wmode="transparent" quality="high" pluginspage="https://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ _width_ +'" height="'+ _height_ +'"></embed>';
  _object_ += '</object>';

  document.write(_object_);
}
