﻿var Ncm_charset = "utf-8"; 
var Ncm_is_gecko  = navigator.userAgent.toLowerCase().indexOf("gecko") != -1;
var tmpActiveObjSrc = ""; // flash 보이게하는변수



function rsumRoad() {
    try {
        militaryChk();
    }
    catch (ex)
    { }

    try {
        samePost();
    } catch (ex)
   { }
    try {
        InitNation();
    } catch (ex)
    { }
}
/********************************************
* 함수명    : _ResizeImage
* 기능      : 이미지 배열에 저장하고 테이블폭맞추기
* parameter : imageWidth, borderColor
********************************************/
function _ResizeImage(imageWidth, borderColor) 
{
    var target = document.getElementsByName('resizeImage[]');
    var imageHeight = 0;
    
    if (target) 
    {
        for(i=0; i<target.length; i++) 
        { 
            // 원래 사이즈를 저장해 놓는다
            target[i].tmp_width  = target[i].width;
            target[i].tmp_height = target[i].height;
            
            // 이미지 폭이 테이블 폭보다 크다면 테이블폭에 맞춘다
            if(target[i].width > imageWidth) {
                imageHeight = parseFloat(target[i].width / target[i].height)
                target[i].width = imageWidth;
                target[i].height = parseInt(imageWidth / imageHeight);
                target[i].style.cursor = 'pointer';

                // 스타일에 적용된 이미지의 폭과 높이를 삭제한다
                target[i].style.width = '';
                target[i].style.height = '';
            }

            if (borderColor) 
            {
                target[i].style.borderWidth = '1px';
                target[i].style.borderStyle = 'solid';
                target[i].style.borderColor = borderColor;
            }
        }
    }
}

/********************************************
* 함수명    : _ImgWindow
* 기능      : 이미지 새창띄우기
* parameter : this
********************************************/
function _ImgWindow(img, imgWidth, imgHeight)
{   
    var w = img.width; 
    var h = img.height; 
    if(imgWidth != '' && imgWidth != undefined)
        w = imgWidth;
    if(imgHeight != '' && imgHeight != undefined)
        h = imgHeight;
        
    var winl = (screen.width-w)/2; 
    var wint = (screen.height-h)/3; 
    var errorImage = "onerror='this.src=\"/Ncm_board/images/blank.gif\"' ";

    if (w >= screen.width) 
    { 
        winl = 0; 
        h = (parseInt)(w * (h / w)); 
    } 

    if (h >= screen.height) 
    { 
        wint = 0; 
        w = (parseInt)(h * (w / h)); 
    } 

    var js_url = "<script language='JavaScript1.2'> \n"; 
        js_url += "<!-- \n"; 
        js_url += "var ie=document.all; \n"; 
        js_url += "var nn6=document.getElementById&&!document.all; \n"; 
        js_url += "var isdrag=false; \n"; 
        js_url += "var x,y; \n"; 
        js_url += "var dobj; \n"; 
        js_url += "function movemouse(e) \n"; 
        js_url += "{ \n"; 
        js_url += "  if (isdrag) \n"; 
        js_url += "  { \n"; 
        js_url += "    dobj.style.left = nn6 ? tx + e.clientX - x : tx + event.clientX - x; \n"; 
        js_url += "    dobj.style.top  = nn6 ? ty + e.clientY - y : ty + event.clientY - y; \n"; 
        js_url += "    return false; \n"; 
        js_url += "  } \n"; 
        js_url += "} \n"; 
        js_url += "function selectmouse(e) \n"; 
        js_url += "{ \n"; 
        js_url += "  var fobj      = nn6 ? e.target : event.srcElement; \n"; 
        js_url += "  var topelement = nn6 ? 'HTML' : 'BODY'; \n"; 
        js_url += "  while (fobj.tagName != topelement && fobj.className != 'dragImage') \n"; 
        js_url += "  { \n"; 
        js_url += "    fobj = nn6 ? fobj.parentNode : fobj.parentElement; \n"; 
        js_url += "  } \n"; 
        js_url += "  if (fobj.className=='dragImage') \n"; 
        js_url += "  { \n"; 
        js_url += "    isdrag = true; \n"; 
        js_url += "    dobj = fobj; \n"; 
        js_url += "    tx = parseInt(dobj.style.left+0); \n"; 
        js_url += "    ty = parseInt(dobj.style.top+0); \n"; 
        js_url += "    x = nn6 ? e.clientX : event.clientX; \n"; 
        js_url += "    y = nn6 ? e.clientY : event.clientY; \n"; 
        js_url += "    document.onmousemove=movemouse; \n"; 
        js_url += "    return false; \n"; 
        js_url += "  } \n"; 
        js_url += "} \n"; 
        js_url += "document.onmousedown=selectmouse; \n"; 
        js_url += "document.onmouseup=new Function('isdrag=false'); \n"; 
        js_url += "//--> \n"; 
        js_url += "</"+"script> \n"; 

    var settings;

    if (Ncm_is_gecko) 
    {
        settings  ='width='+(w)+','; 
        settings +='height='+(h-50)+','; 
    } 
    else 
    {
        settings  ='width='+(w)+','; 
        settings +='height='+(h-50)+','; 
    }
    settings +='top='+wint+','; 
    settings +='left='+winl+','; 
    settings +='scrollbars=0,'; 
    settings +='resizable=1,'; 
    settings +='status=0'; 

    win = window.open("", "_ImgWindow", settings); 
    win.document.open(); 
    win.document.write ("<html><head> \n<meta http-equiv='imagetoolbar' CONTENT='no'> \n<meta http-equiv='content-type' content='text/html; charset="+Ncm_charset+"'>\n"); 
    var size = ""+w+" x "+h;
    win.document.write ("<title>"+size+"</title> \n"); 
    var click = "";
    if(w >= (screen.width-200) || h >= (screen.height-200)) 
    { 
        win.document.write (js_url); 
        click = "ondblclick='window.close();' style='cursor:move' title=' "+size+" \n 마우스 왼쪽버튼을 클릭후 드래그 해 보십시오 \n 더블 클릭 닫힘'"; 
    } 
    else 
        click = "onclick='window.close();' style='cursor:pointer' title=' "+size+" \n 클릭 닫힘'"; 
        
    win.document.write ("<style>.dragImage{position:relative;}</style> \n"); 
    win.document.write ("</head> \n\n"); 
    win.document.write ("<body leftmargin='0' topmargin='0' bgcolor='#dddddd' style='cursor:arrow;'> \n"); 
    win.document.write ("<table width='100%' height='100%' cellpadding='0'cellspacing='0'><tr><td align='center' valign='middle'><img src='"+img.src+"' width='"+w+"' height='"+h+"' border='0' class='dragImage' "+click+" " + errorImage + "></td></tr></table>");
    win.document.write ("</body></html>"); 
    win.document.close(); 

    if(parseInt(navigator.appVersion) >= 4)
        win.window.focus(); 
}

/***********************************
/ 이미지 사이즈에 맞게 새창띄우기
/***********************************/
function OpenImage(imgSrc, imgWidth, imgHeight){
     srcImg = new Image();
     srcImg.src = imgSrc;
     _ImgWindow(srcImg, imgWidth, imgHeight);
}
/********************************************
* 함수명    : _AddActiveObject
* 기능      : flash 보이게 하는 함수
* parameter : objName, objSrc
********************************************/
function _AddActiveObject(objName, objSrc) 
{
    var tmpObj;
    tmpObj = document.getElementById(objName);
    tmpObj.innerHTML = objSrc;
}

/********************************************
* 함수명    : _OpenWinCenter
* 기능      : 화면중간에 작은창 띄우기  
* parameter : url, wname, wopt     
* 옵션 : option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=600";      
********************************************/
function _OpenWinCenter(url, wname, wopt) 
{
    var newopt = "", wHeight = 0, wWidth = 0;
    if (wopt != undefined) 
    {
        var woptlist = wopt.replace(/ /g, "").split(",");
        for (var i in woptlist) 
        {
            if (woptlist[i].match(/^height=/i)) 
            {
                wHeight = parseInt(woptlist[i].substr(7),10);
                if (!isNaN(wHeight)) newopt += "top=" + Math.floor((screen.availHeight - wHeight) / 2) + ",";
            }
            
            if (woptlist[i].match(/^width=/i)) 
            {
                wWidth = parseInt(woptlist[i].substr(6),10);
                if (!isNaN(wWidth)) newopt += "left=" + Math.floor((screen.availWidth - wWidth) / 2) + ",";
            }
        }
    }
    
    return window.open(url, wname, newopt + wopt).focus();
} 

/****************************************************
* 함수명    : _Trim
* 함수내용  : 공백문자
* parameter : fldValue       // \s 공백 문자
*****************************************************/
function _Trim(fldValue) 
{
    var pattern = /(^\s*)|(\s*$)/g;
    return fldValue = fldValue.replace(pattern, "");
}

/******************************************
* 함수명    : _StrLength
* 기능      : 문자열 길이구하기            
* parameter : fldValue 
*******************************************/
function _StrLength(fldValue)
{
       var Length = 0;
       var Nav = navigator.appName;
       var Ver = navigator.appVersion;
       var IsExplorer = false;
       var ch;
       if ( (Nav == 'Microsoft Internet Explorer') && (Ver.charAt(0) >= 4) )
       {
          IsExplorer = true;
       }

       if(IsExplorer)
       {
          for(var i = 0 ; i < fldValue.length; i++)
          {
              ch = fldValue.charAt(i);
              if ((ch == "\n") || ((ch >= "ㅏ") && (ch <= "히")) ||
                 ((ch >="ㄱ") && (ch <="ㅎ")))
              {
                  Length += 2;
              } 
              else
              {
                  Length += 1;
              }
          }
       }
       else 
          Length = fldValue.length ;
       
       return Length;
}

/********************************************************************************
 *  함수명  : _GetLeftPos
 *  함수내용 : 브라우저에서 오브젝트의 왼쪽 좌표알아내기
 * parameter : obj
 *********************************************************************************/
function _GetLeftPos(obj)
{
    var parentObj = null;
    var clientObj = obj;
    var left = obj.offsetLeft;

    while((parentObj = clientObj.offsetParent) != null)
    {
        left = left + parentObj.offsetLeft;
        clientObj = parentObj;
    }

    return left;
}

/********************************************************************************
 *  함수명  : _GetTopPos
 *  함수내용 : 브라우저에서 오브젝트의 상단좌표알아내기
 * parameter : obj
 *********************************************************************************/
function _GetTopPos(obj)
{
    var parentObj = null;
    var clientObj = obj;
    var top = obj.offsetTop;

    while((parentObj=clientObj.offsetParent) != null)
    {
        top = top + parentObj.offsetTop;
        clientObj = parentObj;
    }

    return top;
}

/********************************************************************************
 * 함수명  : _SelectBoxHidden
 * 함수내용 : Internet Explorer에서 셀렉트박스와 레이어가 겹칠시 레이어가 셀렉트 박스 뒤로 숨는 현상을 해결하는 함수
 *            레이어가 셀렉트 박스를 침범하면 셀렉트 박스를 hidden 시킴
 * ex : <div id=LayerID style="display:none; position:absolute;" onpropertychange="_SelectBoxHidden('LayerID')">
 *********************************************************************************/
function _SelectBoxHidden(layer_id) 
{
    //var ly = eval(layer_id);
    var ly = document.getElementById(layer_id);

    // 레이어 좌표
    var ly_left   = ly.offsetLeft;
    var ly_top    = ly.offsetTop;
    var ly_right  = ly.offsetLeft + ly.offsetWidth;
    var ly_bottom = ly.offsetTop + ly.offsetHeight;

    // 셀렉트박스의 좌표
    var el;

    for (i=0; i<document.forms.length; i++) {
        for (k=0; k<document.forms[i].length; k++) {
            el = document.forms[i].elements[k];    
            if (el.type == "select-one") {
                var el_left = el_top = 0;
                var obj = el;
                if (obj.offsetParent) {
                    while (obj.offsetParent) {
                        el_left += obj.offsetLeft;
                        el_top  += obj.offsetTop;
                        obj = obj.offsetParent;
                    }
                }
                el_left   += el.clientLeft;
                el_top    += el.clientTop;
                el_right  = el_left + el.clientWidth;
                el_bottom = el_top + el.clientHeight;

                // 좌표를 따져 레이어가 셀렉트 박스를 침범했으면 셀렉트 박스를 hidden 시킴
                if ( (el_left >= ly_left && el_top >= ly_top && el_left <= ly_right && el_top <= ly_bottom) || 
                     (el_right >= ly_left && el_right <= ly_right && el_top >= ly_top && el_top <= ly_bottom) ||
                     (el_left >= ly_left && el_bottom >= ly_top && el_right <= ly_right && el_bottom <= ly_bottom) ||
                     (el_left >= ly_left && el_left <= ly_right && el_bottom >= ly_top && el_bottom <= ly_bottom) ||
                     (el_top <= ly_bottom && el_left <= ly_left && el_right >= ly_right)
                    )
                    el.style.visibility = 'hidden';
            }
        }
    }
}

/********************************************************************************
 * 함수명  : _SelectBoxVisible
 * 함수내용 : 감추어진 셀렉트 박스를 모두 보이게 함
 *********************************************************************************/
function _SelectBoxVisible() 
{
    for (i=0; i<document.forms.length; i++) 
    {
        for (k=0; k<document.forms[i].length; k++) 
        {
            el = document.forms[i].elements[k];    
            if (el.type == "select-one" && el.style.visibility == 'hidden')
                el.style.visibility = 'visible';
        }
    }
}
    
var save_layer = null;
function _LayerView(link_id, menu_id, opt, x, y)
{
    var link = document.getElementById(link_id);
    var menu = document.getElementById(menu_id);
    
    if (save_layer != null)
    {
        save_layer.style.display = "none";
        _SelectBoxVisible();
    }

    if (link_id == '')
        return;

    if (opt == 'hide')
    {
        menu.style.display = 'none';
        _SelectBoxVisible();
    }
    else
    {
        x = parseInt(x);
        y = parseInt(y);
        if(menu != null)
        {
            menu.style.left = _GetLeftPos(link) + x;
            menu.style.top  = _GetTopPos(link) + link.offsetHeight + y;
            menu.style.display = 'block';
        }
    }

    save_layer = menu;
}


/******************************************
* 함수명    : _IsEmail
* 기능      : 이메일 검사 패턴
* parameter : fldValue
*******************************************/
function _IsEmail(fldValue) 
{   
    var pattern = /([0-9a-zA-Z_-]+)@([0-9a-zA-Z_-]+)\.([0-9a-zA-Z_-]+)/;
    if (pattern.test(fldValue)) 
        return true;
    else
        return false;
}


/******************************************
* 함수명    : _StrReplace
* 기능      : 문자열 취환
* parameter : data, replaceChar
*******************************************/
function _StrReplace(fldValue, replaceChar)
{
	var returnStr = fldValue.replace(/replaceChar/gi, "");
    return returnStr;
}

/************************************************************
 *  함수명  : _IsMaxLenth
 *  함수내용 : 주어진 문자열의 자릿수보다 작은지 검사
 * parameter : fldValue, maxLenth
 ************************************************************/
function _IsMaxLenth(fldValue, maxLenth)
{
     // 바이트계산길이
     if(_StrLength(fldValue) <= maxLenth)
        return true;
     else
        return false;
}

/******************************************
* 함수명    : _IsOutOfRange
* 기능      : 문자열 길이제한                 
* parameter : fldValue, min, max
*******************************************/
function _IsOutOfRange(fldValue, min, max)
{   
     if(_StrLength(fldValue) < min || _StrLength(fldValue) > max)
        return false;
     else
        return true;
}

/************************************************************
 *  함수명  : _IsStrLength
 *  함수내용 : 주어진 문자열의 자릿수와 맞는지 검사
 * parameter : fldValue, maxLenth
 ************************************************************/
function _IsStrLength(fldValue, len)
{
     // 바이트계산길이
     if(_StrLength(fldValue) == len)
        return true;
     else
        return false;
}

/************************************************************
 *  함수명   : _CheckAll
 *  함수내용 : 체크박스체크
 * parameter : checkAllBox, chkName
 ************************************************************/
function _CheckAll(checkAllBox, chkName)                         
{   
	var frm = document.forms[0];                        
	var chkState = checkAllBox.checked;
	for(i=0; i< frm.length; i++)                         
	{   
		e = frm.elements[i];   
		if(e.type=='checkbox' && e.name.indexOf(chkName) != -1)
			e.checked= chkState;                       
	}
} 

/************************************************************
 *  함수명   : IsSelectedDropDown
 *  함수내용 : 드롭다운선택여부
 * parameter : ddlClientId
 ************************************************************/
function IsSelectedDropDown(ddlClientId)                         
{   
	var frm = document.forms[0];
	for(i=0; i< frm.length; i++)                         
	{   
		e = frm.elements[i];   
		if(e.type.indexOf("select") != -1 && e.id.indexOf(ddlClientId) != -1)
		{   
		    if(e.selectedIndex == 0)
		    {   
			    return false;       
			}
	    }            
	}
	return true;
}

/************************************************************
 *  함수명   : IsEmptyCheckBox
 *  함수내용 : 체크박스체크유무
 * parameter : chkBoxId
 ************************************************************/
function IsEmptyCheckBox(chkBoxClientId)                         
{   
	var frm = document.forms[0];
	for(i=0; i< frm.length; i++)                         
	{   
		e = frm.elements[i];   
		if(e.type == 'checkbox' && e.id.indexOf(chkBoxClientId) != -1)
		    if(e.checked)
			    return false;                   
	}
	return true;
} 

/************************************************************
 *  함수명   : IsEmpty
 *  함수내용 : 공백체크
 * parameter : clientId
 ************************************************************/
function IsEmpty(InputValue) 
{   
    InputValue = InputValue.replace(/\s/gi,"");
    if (InputValue == "" || InputValue.length == 0 )
        return true;
    else
        return false;
}

/************************************************************
 *  함수명   : IsEmpty
 *  함수내용 : 공백체크
 * parameter : clientId
 ************************************************************/
function IsEmptyClientID(txtClientID) 
{   
    return IsEmpty(document.getElementById(txtClientID).value);
}

function IsCheckedCheckBox(msg)
{
    if(IsEmptyCheckBox("chk_sel"))
        return true;
    else
    {   
        alert(msg);
        return false;
    }
}



function printArea(subject, content, write_date, writer)
{
    win = window.open();
    self.focus();
    win.document.open();
    
    win.document.write('<html>');
    win.document.write('<head>');
    win.document.write('<link href=/App_Themes/print001/print_popup.css rel=stylesheet type=text/css />');
    win.document.write('<title>프린트하기</title>');
    win.document.write('<style type=text/css>body {margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px;}');
    win.document.write('.title {height:29px; background:url(/img_ncm_board/images/bg_title.gif) 0 0 repeat-x; color:#3A7CD3; position:relative; font-weight:bold; line-height:29px; padding-left:10px;}');
    win.document.write('</style></head>');
    win.document.write('<body>');
    win.document.write('<table class=table border=0 cellpadding=0 cellspacing=0>');
    win.document.write('<tr>');
    win.document.write('<td><div class=title>프린트하기');
    win.document.write('<a href='+'javascript:print();'+' class=print><img src=/img_ncm_board/ncm_module/ncm_board/board_bgv/btn_print.gif alt=프린트하기 border=0/></a>');
    win.document.write('<a href='+'javascript:self.close();'+' class=close><img src=/img_ncm_board/ncm_module/ncm_board/board_bgv/btn_close.gif alt=닫기  border=0/></a>');
    win.document.write('</div></td>');
    win.document.write('</tr>');
    win.document.write('<tr><td>');
    win.document.write('<div class=articleviewarea>');
    win.document.write('<h1>'+document.getElementById(subject).innerHTML+'</h1>');
    win.document.write('</div>');
    win.document.write('<div class=articleInfo>');
    win.document.write('등록일<em>'+document.getElementById(write_date).innerHTML+'</em>작성자<em>'+document.getElementById(writer).innerHTML+'</em>');
    win.document.write('</div>');
    win.document.write('<div class=articleTxt>');
    win.document.write(document.getElementById(content).innerHTML);
    win.document.write('</div>');
    win.document.write('</td></tr>');
    win.document.write('<tr><td align=center style=padding-bottom:20px;><a href='+'javascript:print();'+'><img src=/img_ncm_board/ncm_module/ncm_board/board_bgv/btn_print.gif alt=프린트하기 width=67 height=20/></a></td></tr>');
    win.document.write('</table>');
    win.document.write('</body>');
    win.document.write('</html>');
    win.document.close();
    win.print();
    return false;
}

var readFontSize = 3;
function fontPlus() {	
    if (readFontSize < 6) {
        readFontSize = readFontSize + 1; 
        setFont(readFontSize); 
    }
}

function fontSub() {
    if (readFontSize > 1) {
        readFontSize = readFontSize - 1; 
        setFont(readFontSize); 
    }
}   

function fontNor() {
    readFontSize = 3; 
    setFont(readFontSize); 
}  

function setFont(readFontSize) { 
    if(!readFontSize)
        readFontSize = 3; 
    document.getElementById("readBody").className = "read0"+readFontSize;
    setCookie("textsize", readFontSize, 1);
}

// 쿠키만들기
function setCookie(cookiename, value, expiredays)
{
	var todayDate = new Date();
	todayDate.setDate(todayDate.getDate() + expiredays);
	document.cookie = cookiename + "=" + value + "; path=/; expires=" + todayDate.toGMTString() +1+ ";";
}
function getCookie(name)
{
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while(i< clen)
	{
		var j = i + alen;
		if(document.cookie.substring(i,j)==arg){
			var end = document.cookie.indexOf(";",j);
			if(end == -1)
				end = document.cookie.length;
			return unescape(document.cookie.substring(j,end));
		}
		i=document.cookie.indexOf(" ",i)+1;
		if (i==0) break;
	}
	return null;
}
    
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;
}

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];}
}
/**************************************************************************************
* 설명     : 공통 Url 체크
***************************************************************************************/
//주소라벨 팝업
function win_label_popup(paperUrl)
{ 
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=1000,height=500";
    _OpenWinCenter(paperUrl, "주소라벨", option); 
}
//주소값 부모창에 값 넘기기
function get_addr(post1, post2, postId, addr, openerPost1, openerPost2, openerPostId, openerAddr, openerAddrEtc)
{   
    opener.document.getElementById(openerPost1).value = post1;
    opener.document.getElementById(openerPost2).value = post2;
    opener.document.getElementById(openerPostId).value = postId;
    opener.document.getElementById(openerAddr).value = addr;
    opener.document.getElementById(openerAddrEtc).focus();
    self.close();
}
//주소값 부모창에 값 넘기기
function get_addr1(post1, post2, postId, addr, addrEtc, openerPost1, openerPost2, openerPostId, openerAddr, openerAddrEtc) {
    opener.document.getElementById(openerPost1).value = post1;
    opener.document.getElementById(openerPost2).value = post2;
    opener.document.getElementById(openerPostId).value = postId;
    opener.document.getElementById(openerAddr).value = addr;
    opener.document.getElementById(openerAddrEtc).value = addrEtc;
    self.close();
}
//주소값 부모창에 값 넘기기
function getAddrSiDo(openerSi, openerDo, openerPostId)
{   
    opener.document.getElementById(openerPost1).value = post1;
    opener.document.getElementById(openerPost2).value = post2;
    opener.document.getElementById(openerPostId).value = postId;
    opener.document.getElementById(openerAddr).value = addr;
    opener.document.getElementById(openerAddrEtc).focus();
    self.close();
}
//휴대폰 인증 부모창에 값 넘기기
function get_hp(hp1, hp2, hp3, openerHp1, openerHp2, openerHp3)
{   
    opener.document.getElementById(openerHp1).value = hp1;
    opener.document.getElementById(openerHp2).value = hp2;
    opener.document.getElementById(openerHp3).value = hp3;
    alert('인증이 정상적으로 이루어 졌습니다.');
    self.close();
}
//메뉴팝업창
function WinPopup(winUrl, winTitle, winWidth, winHeight)
{   
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width="+winWidth+",height=" + winHeight;
    _OpenWinCenter(winUrl, winTitle, option); 
}
//메뉴팝업창
function win_menu_edit(menuUrl, btn_bind)
{   
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=790,height=700";
    _OpenWinCenter(menuUrl + "&btn_bind="+btn_bind, "메뉴등록", option); 
}
//일정관리
function win_schedule_popup(scheduleUrl)
{   
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=700";
    _OpenWinCenter(scheduleUrl, "일정관리", option); 
}
//주소찾기 작은창 열기
function win_post(post1, post2, postId, addr, addrEtc, postUrl)
{ 
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=400";
    _OpenWinCenter(postUrl + "&openerPost1="+post1+"&openerPost2="+post2+"&openerAddr="+addr+"&openerPostId="+postId+"&openerAddrEtc="+addrEtc+"", "post", option); 
}
function winPostSiDo(addrSi, addrDo, postId, postUrl)
{ 
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=400";
    _OpenWinCenter(postUrl + "&opener_addr_si="+addrSi+"&opener_addr_do="+addrDo+"&openerPostId="+postId, "post", option); 
}
//휴대폰 인증 팝업
function win_hp_confirm(hp1, hp2, hp3, hpUrl)
{ 
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=520,height=220";
    _OpenWinCenter(hpUrl + "&openerHp1="+hp1+"&openerHp2="+hp2+"&openerHp3="+hp3+"", "hp_confirm", option); 
}
//비번아이디 찾기팝업
function win_search_idpwd(pwdUrl)
{ 
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=600";
    _OpenWinCenter(pwdUrl, "비번찾기", option); 
}
//주소록 회원보기
function win_addr_user_view_popup(userUrl, user_id)
{   
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=685,height=310";
    _OpenWinCenter(userUrl + "&user_id=" + user_id, "주소록회원보기", option); 
}
//쪽지보내기 팝업
function win_paper_popup(paperUrl)
{  
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=1000,height=530";
    _OpenWinCenter(paperUrl, "쪽지보내기", option); 
}
//회원관리1
function win_user_popup1(userUrl, btn_bind)
{  
    //alert(userUrl);
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=688,height=700";
    _OpenWinCenter(userUrl + "&btn_bind="+btn_bind, "회원관리", option); 
}
//회원수정1
function win_user_edit_popup1(userUrl, user_id, btn_bind)
{   
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=688,height=700";
    _OpenWinCenter(userUrl + "&btn_bind="+btn_bind+"&user_id=" + user_id, "회원관리", option); 
}
//회원관리
function win_user_popup(userUrl, btn_bind)
{  
    //alert(userUrl);
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=790,height=700";
    _OpenWinCenter(userUrl + "&btn_bind="+btn_bind, "회원관리", option); 
}
//회원수정
function win_user_edit_popup(userUrl, user_id, btn_bind)
{   
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=650,height=550";
    _OpenWinCenter(userUrl + "&btn_bind="+btn_bind+"&user_id=" + user_id, "회원관리", option); 
}
//회원관리(여성인력개발)
function win_user_write_popup(userUrl, btn_bind)
{  
    //alert(userUrl);
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=650,height=550";
    _OpenWinCenter(userUrl + "&btn_bind="+btn_bind, "회원관리", option); 
}
//회원수정(여성인력개발)
function win_user_edit_popup_woman(userUrl, user_id, btn_bind)
{   
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=650,height=600";
    _OpenWinCenter(userUrl + "&btn_bind="+btn_bind+"&user_id=" + user_id, "회원관리", option); 
}
//회원보기
function win_user_view_popup(userUrl, user_id, btn_bind)
{   
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=550";
    _OpenWinCenter(userUrl + "&btn_bind="+btn_bind+"&user_id=" + user_id, "회원관리", option); 
}
//사진업로드
function WinPhotoUpload(photoUrl)
{   
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=550";
    _OpenWinCenter(photoUrl, "photoUrl", option);
}
//코드관리
function WinRtlMngCode(rtlMngCodeUrl) {
    var option = "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=550";
    _OpenWinCenter(rtlMngCodeUrl, "photoUrl", option);
}
//쪽지보내기팝업창
function WinPaper(urlPaper)
{   
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=800,height=600";
    _OpenWinCenter(urlPaper, "urlPaper", option); 
}
//테이블찾기 작은창 열기
function win_table_name(tableUrl, gubun, tableNameClientId)
{ 
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=400,height=600";
    _OpenWinCenter(tableUrl + "&table_name_id=" + tableNameClientId+"&gubun=" + gubun, "tableName", option); 
}
//큰사진보기 팝업창
function WinLargeView(photoUrl, winWidth, winHeight)
{ 
//    winWidth = parseInt(winWidth) + 10;
//    winHeight = parseInt(winHeight) + 10;
//    if(winWidth < 500)
//        winWidth = 500;
//    if(winHeight < 500)
//        winHeight = 500;
        
    winWidth = 510;
    winHeight = parseInt(winHeight) + 10;
    if(winWidth < 500)
        winWidth = 500;
    if(winHeight < 500)
        winHeight = 500;
        
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width="+winWidth+",height=" + winHeight;
    _OpenWinCenter(photoUrl, "photoLargeView", option); 
}
//테이블이름 부모창에 값 넘기기
function get_table_name(tableName, tableNameId)
{   
    opener.document.getElementById(tableNameId).value = tableName;
    opener.document.getElementById(tableNameId).focus();
    self.close();
}
//SMS Hp 창열기
function WinSMSHp(urlSMSHp, findField1, findField2, findField3, findField4, findField5, findText, referKind)
{ 
//alert(referKind);
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=360";
    _OpenWinCenter(urlSMSHp + "&find_field1="+findField1+"&find_field2="+findField2+"&find_field3="+findField3+"&find_field4="+findField4+"&find_field5="+findField5+"&find_text="+findText+"&refer_kind="+referKind, "WinSMSHp", option); 
}
//선택회원sms 발송하기
function WinSMSUserHp(urlSMSHp, sndUser, referKind)
{   
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=630,height=360";
    _OpenWinCenter(urlSMSHp + "&rcv_user="+sndUser+"&refer_kind="+referKind, "WinSMSUserHp", option); 
}
//한국철강합격자공고팝업
function WinEmpRsumResult(EmpUrl) {
    var option = "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=550";
    _OpenWinCenter(EmpUrl, "EmpUrl", option);
}
/**************************************************************************************
* 설명     : 공통 이벤트 체크
***************************************************************************************/

/********************************************
* 함수명    : _IsValidJumin
* 기능      : 주민등록번호 Check  
* parameter : jumin.value           
********************************************/
function ChkJumin(obj, e)
{   
    // 주민번호 체크
    e.IsValid = true;
    
    fldValue = e.Value.replace(/-/gi, "");
    var jumin1 = fldValue.substring(0,6);
    var jumin2 = fldValue.substr(6,7);
    
    var chk = 0 ;
    var yy = jumin1.substring(0,2);
    var mm = jumin1.substring(2,4);
    var dd = jumin1.substring(4,6);
	
    var tmp = 0 ;  		
    var sex = jumin2.substring(0,1);
	
    for (var i = 0; i <= 5 ; i++)
	    tmp = tmp + ((i%8+2) * parseInt(jumin1.substring(i,i+1)))
	
    for (var j = 6; j <=11 ; j++)
        tmp = tmp + ((j%8+2) * parseInt(jumin2.substring(j-6,j-5)))

    tmp = 11 - (tmp %11)
    tmp = tmp % 10
	
    //if ((jumin1.length != 6 ) || (yy < 25 || mm < 1 || mm > 12 || dd < 1))
    if ((jumin1.length != 6 ) || (mm < 1 || mm > 12 || dd < 1))
    {   
	    e.IsValid = false;
	}
    else if (jumin2.length !=7)
    {   
	    e.IsValid = false;
	}
    //else if ((sex != 1 && sex !=2 && sex !=3 && sex !=4) || (jumin2.length != 7 ))
    else if (jumin2.length != 7 )
    {   
	    e.IsValid = false;
	}
    else if (tmp != jumin2.substring(6,7))
    {   
	    e.IsValid = false;
    }
}

// 주민번호체크
//function ChkJumin(obj, e)
//{   
//    if(_IsStrLength(e.Value, 14))
//        e.IsValid = true;
//    else
//        e.IsValid = false;
//}

// 전화번호체크
function ChkTel(obj, e)
{   
    var fldValue = e.Value.substring(0,2);
    if(fldValue == "02")
    {   
        if(_IsOutOfRange(e.Value, 11, 12))
            e.IsValid = true;
        else
            e.IsValid = false;
    }
    else
    {   
        if(_IsOutOfRange(e.Value, 12, 13))
            e.IsValid = true;
        else
            e.IsValid = false;
    }
}

// 핸드폰번호 체크
function ChkHp(obj, e)
{   
    if(_IsOutOfRange(e.Value, 12, 13))
        e.IsValid = true;
    else
        e.IsValid = false;
}

// 이메일체크
function ChkEmail(obj, e)
{   
    if(_IsEmail(e.Value))
        e.IsValid = true;
    else
        e.IsValid = false;
}

// 핸드폰번호 체크
function ChkContact(obj, e)
{   
    if(_IsOutOfRange(e.Value, 10, 18))
        e.IsValid = true;
    else
        e.IsValid = false;
}

// 생일체크
function ChkBirth(obj, e)
{   
    if(_IsStrLength(e.Value, 10))
        e.IsValid = true;
    else
        e.IsValid = false;
}
// 사용자그룹코드
function ChkGroupCode(obj, e)
{   
    if(_IsStrLength(e.Value, 5))
        e.IsValid = true;
    else
        e.IsValid = false;
}


/******************************************
* 함수명    : ChkTinyMCEText
* 기능      : TinyMCE 공백체크            
*******************************************/
function ChkTinyMCEText(obj, e) 
{   
    var txt = document.getElementById(obj.controltovalidate);
    tinyMCE.triggerSave();
    e.Value = (txt.value.replace(/^\W+/,'')).replace(/\W+$/,'').replace(/<p\/>/gi,"");
    e.IsValid = (e.Value != '');
}


/******************************************
* 함수명    : DateCheck
* 기능      : 날짜체크, 날짜비교            
*******************************************/
function DateCheck(fDate,eDate,wYear,wMonth,gubun) 
{
    var num, year, month, day, tDate, startDate, endDate;
    if(gubun == "f")
    {
        num = document.getElementById(fDate).value;
        tDate = fDate;
    }
    else
    {
        num = document.getElementById(eDate).value;
        tDate = eDate;
    }
    
    while (num.search("-") != -1)
    { 
        num = num.replace("-","");
    }
 
    if (isNaN(num)) 
    {        
        window.alert("숫자로만 작성하셔야 합니다");        
        document.getElementById(tDate).focus();
        document.getElementById(tDate).value = "";
    }
    if( num != 0 && num.length == 8 ) 
    {
        year = num.substring( 0, 4 );
        month = num.substring( 4, 6 );  
        day = num.substring(6);
        if(isValidDay(year,month,day) == false) 
        {
            alert("유효하지 않는 일자입니다. 다시 한번 확인하시고 입력해 주세요.");            
            document.getElementById(tDate).focus();
            document.getElementById(tDate).value = "";
        }    
        else
        {
            num = year + "-" + month + "-" + day;
            document.getElementById(tDate).value = num;
            
            startDate = document.getElementById(fDate).value;
            endDate = document.getElementById(eDate).value;
            
            if( startDate.length == 10 && endDate.length == 10)
            {
                var arySrtDt = startDate.split("-");
                var aryEndDt = endDate.split("-");
               
                var startDt = new Date(Number(arySrtDt[0]),Number(arySrtDt[1])-1,Number(arySrtDt[2]));
                var endDt = new Date(Number(aryEndDt[0]),Number(aryEndDt[1])-1,Number(aryEndDt[2]));
                  
                resultDt = Math.floor(endDt.valueOf()/(24*60*60*1000)- startDt.valueOf()/(24*60*60*1000));
                  
                if(resultDt < 0 )
                {
                   alert("시작날짜가 더 큽니다.");
                   document.getElementById(fDate).value = "";
                   document.getElementById(eDate).value = "";
                }
                else
                {
                    resultMonth = Math.floor((Number(aryEndDt[0]) - Number(arySrtDt[0])) * 12 + Number(aryEndDt[1]) - Number(arySrtDt[1]));
                    workYear = resultMonth / 12;
                    workMonth = resultMonth % 12;
                    
                    document.getElementById(wYear).value = parseInt(workYear);
                    document.getElementById(wMonth).value = workMonth;
                }
            }           
        }
    }    
}
//유효한(존재하는) 일(日)인지 체크
function isValidDay(yyyy, mm, dd) 
{
    var m = parseInt(mm,10) - 1;
    var d = parseInt(dd,10);

    var end = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
    if ((yyyy % 4 == 0 && yyyy % 100 != 0) || yyyy % 400 == 0) 
    {
        end[1] = 29;
    }

    return (d >= 1 && d <= end[m]);
}


/*
sms에서 사용하는 부분
*/

//* 플래쉬 파일 INCLUDE *//
// flashWrite(파일경로, 가로, 세로, 아이디, 배경색, 윈도우모드)
function flashWrite(url,w,h,id,bg,win)
{
    // 플래시 코드 정의
    var flashStr=
    "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
    "<param name='movie' value='"+url+"' />"+
    "<param name='wmode' value='"+win+"' />"+
    "<param name='menu' value='false' />"+
    "<param name='quality' value='high' />"+
    "<param name='bgcolor' value='"+bg+"' />"+
    "<embed src='"+url+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
    "</object>";

    // 플래시 코드 출력
    document.write(flashStr);
}
// 주소록 수정
function winAddrDtl(groupId, addrId, bindBtn)
{   
    var newwindow="";
    var url = ""
    if(addrId == "")
    {
        newwindow="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=392,height=350";
        url = "/sms_module/addr/addr020.aspx?group_id=" + groupId+"&bind_btn=" + bindBtn;
    }
    else // 수정
    {
        newwindow="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=392,height=350";
        url = "/sms_module/addr/addr021.aspx?group_id=" + groupId+"&addr_id=" + addrId+"&bind_btn=" + bindBtn;
    }
    var win = _OpenWinCenter(url, 'new_addr', newwindow); 
    win.focus();
}

// 메세지등록 팝업창
function winMsg(save_gubun, bindBtn)
{   
    var newwindow="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=260,height=220";
    var url = "/sms_module/msg/msg011.aspx?msg_gubun=" + save_gubun + "&bind_btn=" +bindBtn;
    var win = _OpenWinCenter(url, 'new_msg', newwindow); 
    win.focus();
}
// 예약현황팝업창
function winRes(sndYear, sndMonth, sndDay, resId, bindBtn)
{   
    var newwindow="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=415,height=350";
    var url = "/sms_module/res/res011.aspx?snd_year=" + sndYear + "&snd_month=" + sndMonth + "&snd_day=" + sndDay + "&res_id=" + resId + "&bind_btn=" + bindBtn;
    var win = _OpenWinCenter(url, 'new_res', newwindow); 
    win.focus();
}
// 업체찾기
function winDealer(txt_site_id)
{   
    var newwindow="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=750,height=400";
    var url = "/sms_module/sta/sta011.aspx?txt_site_id=" + txt_site_id;
    _OpenWinCenter(url, 'new_dealer', newwindow); 
    
}

// 전송시간체크
function winTimeCheck()
{   
    var newwindow="toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=450,height=240";
    var url = "/sms_module/snd/snd_time_check.aspx";
    var win = _OpenWinCenter(url, 'new_snd_time_check', newwindow); 
    win.focus();
}

//특수문자팝업창
function WinSMSSpecial(url, txt_message, num1)
{   
    var newwindow="toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=400,height=300";
    _OpenWinCenter(url+"&num1="+num1, 'special', newwindow); 
}

var tmpActiveObjSrc;

function addActiveObject(objName, objSrc) {

  var tmpObj;

  tmpObj = eval("document.all."+objName);

 tmpObj.innerHTML = ""+objSrc+"";


}


// flashWrite(파일경로, 가로, 세로, 아이디, 배경색, 윈도우모드)
function flashWrite(url,w,h,id,bg,win){

// 플래시 코드 정의
var flashStr=
"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
"<param name='movie' value='"+url+"' />"+
"<param name='wmode' value='"+win+"' />"+
"<param name='menu' value='false' />"+
"<param name='quality' value='high' />"+
"<param name='bgcolor' value='"+bg+"' />"+
"<embed src='"+url+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
"</object>";

// 플래시 코드 출력
document.write(flashStr);

}

//null을 체크하는 함수
function _IsEmpty(clientId) {
 var InputValue = document.getElementById(clientId).value;
 InputValue = InputValue.replace(/\s/gi,"");
 if (InputValue == "" || InputValue.length == 0 )
  return true;
 else
  return false;
}


var REGIST_80_BYTE			= "80바이트까지만 등록이 가능합니다.";
var CONTNET_80_BYTE_MSG		= "메시지 입력은 80바이트까지만 가능합니다.";
var NULL_MSG				= "";
var TOG_WORD				= '%0D';
var MSG_LEN_80				= 80;	

/****************************************************
* 함수명    : _CheckShrtMsgLen, _CheckMsgLen
* 함수내용  : 메세지 길이관련 함수들
* parameter : fldThis, sByteLen
*****************************************************/
function _CheckMsgLen(fldThis,sByteLen) {

	var iCounts = new Array();
	iCounts = _GetByteLen(fldThis);	//변수의 길이를 구하는 함수

	if (iCounts[0] > sByteLen)
		return false;
	else
		return true;
}
//한국철강온라인채용
function _CheckMsgLen1(fldThis, sByteLen) {

    var iCounts = new Array();
    iCounts = _GetByteLen1(fldThis); //변수의 길이를 구하는 함수

    if (iCounts[0] > sByteLen)
        return false;
    else
        return true;
}

function _CheckShrtMsgLen(fldThis, lbl_byte) {
	var bResult		= _CheckMsgLen(fldThis,MSG_LEN_80);
	var iCountByte	= 0;
	var sContentMsg	= '';
	var str_lbl_byte = document.getElementById(lbl_byte);

	if (!bResult){
		alert(CONTNET_80_BYTE_MSG);
		sContentMsg = _CutText(fldThis,MSG_LEN_80);
		fldThis.value = sContentMsg;		
	}
	iCountByte = _GetByteLen(fldThis);
	
	str_lbl_byte.innerText = iCountByte[0];
}
//한국철강온라인채용
function _CheckShrtMsgLen(fldThis, txt_selfintro_num_count, txt_selfintro_num) {

alert(fldThis);
    //var REGIST_80_BYTE = txt_selfintro_num.toString();
    var CONTNET_80_BYTE_MSG = "입력은 " + txt_selfintro_num + "자까지만 가능합니다."; //"메시지 입력은 1200바이트까지만 가능합니다.";
    var NULL_MSG = "";
    var TOG_WORD = '%0D';
    var MSG_LEN_80 = txt_selfintro_num
    var bResult = _CheckMsgLen1(fldThis, MSG_LEN_80);
    var iCountByte = 0;
    var sContentMsg = '';
    var str_lbl_byte = document.getElementById(txt_selfintro_num_count);

    if (!bResult) {
        alert(CONTNET_80_BYTE_MSG);
        sContentMsg = _CutText1(fldThis, MSG_LEN_80);
        fldThis.value = sContentMsg;
    }
    iCountByte = _GetByteLen1(fldThis);

    str_lbl_byte.innerText = iCountByte[0];
}

/****************************************************
* 함수명    : cutText
* 함수내용  : 80바이트 이상 되면 변수의 길이를 자르는 함수
* parameter : fldThis, sByteLen
*****************************************************/
function _CutText(fldThis, sByteLen) {

    var sTmpMsg = '';
    var iTmpMsgLen = 0;
    var sOneChar = '';
    var iCount = 0;
    var sOneCharNext = '';

    sTmpMsg = new String(fldThis.value);
    iTmpMsgLen = sTmpMsg.length;

    for (var k = 0; k < iTmpMsgLen; k++) {
        sOneChar = sTmpMsg.charAt(k);
        sOneCharNext = sTmpMsg.charAt(k + 1);
        if (escape(sOneChar) == TOG_WORD) {
            iCount++;
            if (iCount > sByteLen - 1) {
                sTmpMsg = sTmpMsg.substring(0, k);
                break;
            }
        }
        else if (escape(sOneChar).length > 4) {
            iCount += 2;
        }
        else {
            iCount++;
        }
        if (iCount > sByteLen) {
            sTmpMsg = sTmpMsg.substring(0, k);
            break;
        }
    }
    return sTmpMsg;
}
//한국철강온라인채용
function _CutText1(fldThis, sByteLen) {

    var sTmpMsg = '';
    var iTmpMsgLen = 0;
    var sOneChar = '';
    var iCount = 0;
    var sOneCharNext = '';

    sTmpMsg = new String(fldThis.value);
    iTmpMsgLen = sTmpMsg.length;

    for (var k = 0; k < iTmpMsgLen; k++) {
        sOneChar = sTmpMsg.charAt(k);
        sOneCharNext = sTmpMsg.charAt(k + 1);
        if (escape(sOneChar) == TOG_WORD) {
            iCount++;
            if (iCount > sByteLen - 1) {
                sTmpMsg = sTmpMsg.substring(0, k);
                break;
            }
        }
        else if (escape(sOneChar).length > 4) {
            iCount++;
        }
        else {
            iCount++;
        }
        if (iCount > sByteLen) {
            sTmpMsg = sTmpMsg.substring(0, k);
            break;
        }
    }
    return sTmpMsg;
}


/****************************************************
* 함수명    : _GetByteLen
* 함수내용  : 한글일 경우에는 2byte를 그외의 문자는 1byte로 계산하여  iCounts에 저장하여 return 해준다.
* parameter : fldThis, sMsgLng
*****************************************************/
function _GetByteLen(fldThis, sMsgLng) {

    var sMsg = fldThis.value;
    var sTmpMsg = ''; 											//메시지를 임시로 저장하는 변수
    var sTmpMsgLen = 0; 												//임시로 저장된 메시지의 길이를 저장하는 변수
    var sOneChar = ''; 											//한문자를 저장하는 변수
    var iCounts = new Array(); 									//총 바이트와 페이지당 바이트 수를 저장하는 배열

    iCounts[0] = 0; 													//총 바이트를 저장 하는 변수

    if (sMsgLng != null) {
        sTmpMsg = new String(sMsgLng);
    }
    else
        sTmpMsg = new String(sMsg);
    sTmpMsgLen = sTmpMsg.length;

    for (k = 0; k < sTmpMsgLen; k++) {
        sOneChar = sTmpMsg.charAt(k);
        if (escape(sOneChar) == TOG_WORD) {
            iCounts[0]++;
        }
        else if (escape(sOneChar).length > 4) {
            iCounts[0] += 2;
        }
        else {
            iCounts[0]++;
        }
    }

    return iCounts;
}
//한국철강온라인채용
function _GetByteLen1(fldThis, sMsgLng) {

    var sMsg = fldThis.value;
    var sTmpMsg = ''; 											//메시지를 임시로 저장하는 변수
    var sTmpMsgLen = 0; 												//임시로 저장된 메시지의 길이를 저장하는 변수
    var sOneChar = ''; 											//한문자를 저장하는 변수
    var iCounts = new Array(); 									//총 바이트와 페이지당 바이트 수를 저장하는 배열

    iCounts[0] = 0; 													//총 바이트를 저장 하는 변수

    if (sMsgLng != null) {
        sTmpMsg = new String(sMsgLng);
    }
    else
        sTmpMsg = new String(sMsg);
    sTmpMsgLen = sTmpMsg.length;

    for (k = 0; k < sTmpMsgLen; k++) {
        sOneChar = sTmpMsg.charAt(k);
        if (escape(sOneChar) == TOG_WORD) {
            iCounts[0]++;
        }
        else if (escape(sOneChar).length > 4) {
            iCounts[0]++;
        }
        else {
            iCounts[0]++;
        }
    }

    return iCounts;
}


/****************************************************
* 함수명    : iFrameResize
* 함수내용  : 아이프레임 크기조절
* parameter : 
*****************************************************/
function IFrameResize(ifrm) {
    ifrm.height = ifrm.contentWindow.document.body.scrollHeight + 20;
}

/********************************************
* 함수명    : _StrComma
* 기능      : 콤마찍기
* parameter : imageWidth, borderColor
********************************************/
function CommaReplace(fldThis, invalidMessage) {

    var fldValue = fldThis.innerHTML;	 
    if(fldValue.length > 0)
	{	 
		 if(fldValue != "-")
		 {
			 var IsdotU = false;
			 if(fldValue.indexOf(".") >= 0 )  
			 { 
				IsdotU = true;
				var dotPos = fldValue.split(".");
				num = dotPos[0];
				dotU = dotPos[1];  
			 }
			 else
				num = fldValue;

			 num = new String(num);
			 num = num.replace(/,/gi,""); 
			 fl = "";   
			 if(num == 0) return num; 
			 if(num < 0) 
			 { 
				num = num * (-1); 
				fl = "-";
			 }
			 else
				num = num * 1;

			 num = new String(num); 
			 temp = "";
			 co = 3; 
			 num_len = num.length 
			 while(num_len > 0)
			 { 
				num_len=num_len-co; 
				if(num_len < 0){ co=num_len+co;num_len=0; } 
				temp="," + num.substr(num_len,co) + temp; 
			 }
			 
			 var ch_val = fl + temp.substr(1);            
			 if(IsdotU) ch_val = ch_val + "." + dotU;
			 {
				if(ch_val == "NaN")
				{
					alert(invalidMessage);
					fldThis.innerHTML = "";
					return false;
				}   
				else
					fldThis.innerHTML = ch_val; 
			 }
		 }
	}
}


/* 퀵메뉴 스크롤링 //
* 레이어 이동 스크립트
* 사용방법 : 홈페이지 하단에 new quickMove(object 이동할레이어,integer 이동시 브라우져상단관의 offset 값);
* 주의사항 
* - 반드시 레이어의 position 값은 absolute 값이어야 합니다
* - 레이어의 초기위치는 left,top 스타일로 정의되어 있어야 합니다. (보이는 위치에서 슬라이딩 됩니다)
* - DOM BASE 로 제작되었기 때문에 올바르지 않은 html 페이지에서 에러가 날 수 있습니다 (예: 이런경우는 드물지만 body 태그가 존재하지 않거나 한개이상 존재할경우 등..)
* - 슬라이딩 레이어에 background:url 로 배경을 이미지로 사용하지 마시기 바랍니다. 슬라이딩시 IE 브라우져에서 지속적으로 파일을 엑세스 합니다 
*/

function initMoving(target, topPosition, topLimit, btmLimit) {
	if (!target)
		return false;

	var obj = target;
	obj.initTop = topPosition;
	obj.topLimit = topLimit;
	obj.bottomLimit = document.documentElement.scrollHeight - btmLimit;

	obj.style.position = "absolute";
	obj.top = obj.initTop;
	obj.left = obj.initLeft;
	obj.style.top = obj.top + "px";

	obj.getTop = function() {
		if (document.documentElement.scrollTop) {
			return document.documentElement.scrollTop;
		} else if (window.pageYOffset) {
			return window.pageYOffset;
		} else {
			return 0;
		}
	}
	obj.getHeight = function() {
		if (self.innerHeight) {
			return self.innerHeight;
		} else if(document.documentElement.clientHeight) {
			return document.documentElement.clientHeight;
		} else {
			return 620;
		}
	}
	obj.move = setInterval(function() {
		//pos = obj.getTop() + obj.getHeight() / 2 - 15;
		pos = obj.getTop() + topPosition;

		if (pos > obj.bottomLimit)
			pos = obj.bottomLimit
		if (pos < obj.topLimit)
			pos = obj.topLimit

		interval = obj.top - pos;
		obj.top = obj.top - interval / 5;
		obj.style.top = obj.top + "px";
	}, 30)
}

