
/******************************************************************************
* XMLHTTP¸¦ »ç¿ëÇÑ µ¿Àû ÆäÀÌÁö ¾÷µ¥ÀÌÆ®
/*****************************************************************************/

var xmlHttp;

function createXMLHttpRequest() {

    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
    }
}

function startRequest(method, page, param) {

	createXMLHttpRequest();

	xmlHttp.onreadystatechange = handleStateChange;

	if (method == "POST"){
		xmlHttp.open("POST", page, true);

      	xmlHttp.setRequestHeader("Accept-Language","ko");
      	xmlHttp.setRequestHeader("Content-type:", "text/html");
      	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

		xmlHttp.send(param);
	}else if("GET"){
		xmlHttp.open("GET", page +"?"+ param, true);
		xmlHttp.send(null);
	}
}


/******************************************************************************
* °Ë»ö
******************************************************************************/
function SearchForm(){
	var oForm	 = document.fSearch;
	var oKeyword = oForm.tKeyword;

	if (oKeyword.value.trim().length == 0) {
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		oKeyword.focus();
		return;
	}
	else
	{
		oForm.submit();
	}
}

/******************************************************************************
* Àç¹æ,ÃßÃµ,½ºÅ©·¦
******************************************************************************/
function strPgmReCom(chCd, pgmCd, sCd, sName, sCg) {

    var oForm  = document.tForm;

    oForm.target = "ifrm";

    oForm.action = "programRe.asp?chCd="+chCd+"&pgmCd="+pgmCd+"&sCd="+sCd+"&sName="+sName+"&sCg="+sCg;
    oForm.submit();
}

/******************************************************************************
* ÁÖ¼Òº¹»ç ½ºÅ©¸³Æ®
******************************************************************************/

function clipBoardCopy(URL) {
    window.clipboardData.setData("Text",URL);
	alert("ÁÖ¼Ò°¡ º¹»çµÇ¾ú½À´Ï´Ù.");
  return;
}


/******************************************************************************
* ¸¶¿ì½º¿À¹ö½Ã ÀÌ¹ÌÁöÀüÈ¯
*******************************************************************************/
function imgChange(imgName,imgSrc) {
	document[imgName].src = imgSrc;
}

/******************************************************************************
* ¸ð´ÏÅÍ Áß¾Ó¿¡ À©µµ¿ì ¿ÀÇÂ (yes/no : 1/0)
  toolbar(µµ±¸»óÀÚ) , location(ÁÖ¼Ò), directories(¿¬°á), status(»óÅÂÇ¥½ÃÁÙ), menubars(¸Þ´º), scrollbars, resizable, width, height

*******************************************************************************/
function WinOpenCenter(openPpage,winName,w,h,scroll,option){
    LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
    TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

    settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+option;
    _centerWin = window.open(openPpage,winName,settings)
    return _centerWin;
}

/******************************************************************************
* ÁÖ¹Îµî·Ï¹øÈ£ Ã¼Å©
*******************************************************************************/
function ssnConfirm(ssn1,ssn2){

    var str1 = ssn1.value.trim();
    var str2 = ssn2.value.trim();

    if(str1.length == 0 || str2.length == 0){
        return false;
    }
    if( (str1+str2).length !=13 ){
        return false;
    }

    // ¹®ÀÚ¿­À» Á¤¼ö·Î ¹Ù²ãÁÖ´Â ³»ÀåÇÔ¼ö : parseInt()
    a1 = parseInt(str1.charAt(0))*2
    a2 = parseInt(str1.charAt(1))*3
    a3 = parseInt(str1.charAt(2))*4
    a4 = parseInt(str1.charAt(3))*5
    a5 = parseInt(str1.charAt(4))*6
    a6 = parseInt(str1.charAt(5))*7
    a7 = parseInt(str2.charAt(0))*8
    a8 = parseInt(str2.charAt(1))*9
    a9 = parseInt(str2.charAt(2))*2
    a10 = parseInt(str2.charAt(3))*3
    a11 = parseInt(str2.charAt(4))*4
    a12 = parseInt(str2.charAt(5))*5

    tot=a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+a11+a12

    na=tot%11
    ch=11-na

    if(ch==10)ch=0
    if(ch==11)ch=1

    if(ch==parseInt(str2.charAt(6))){
        return true;
    }
    else{
        return false;
    }
}

/******************************************************************************
* È¸¿ø°¡ÀÔ ºñ¹Ð¹øÈ£ Ã¼Å©
*******************************************************************************/
function pwdConfirm(str1,str2){
    if( str1.value.trim() != str2.value.trim()){
        return false;
    }
    else{
        return true;
    }
}


/******************************************************************************
* ÀÌ¸ÞÀÏ µµ¸ÞÀÎ Á÷Á¢ÀÔ·Â
*******************************************************************************/
function eMailDomainSel(objSel,objInput) {

    if( objSel.value.trim().length > 0){

        objInput.value = objSel.options[objSel.selectedIndex].text;
    }
    else{
        objInput.value = "";
    }
}

/******************************************************************************
* ÀÌ¸ÞÀÏ Ã¼Å©
*******************************************************************************/
function CheckMail(strMail) {
   /** Ã¼Å©»çÇ×
     - @°¡ 2°³ÀÌ»óÀÏ °æ¿ì
     - .ÀÌ ºÙ¾î¼­ ³ª¿À´Â °æ¿ì
     -  @.³ª  .@ÀÌ Á¸ÀçÇÏ´Â °æ¿ì
     - ¸ÇÃ³À½ÀÌ.ÀÎ °æ¿ì
     - @ÀÌÀü¿¡ ÇÏ³ªÀÌ»óÀÇ ¹®ÀÚ°¡ ÀÖ¾î¾ß ÇÔ
     - @°¡ ÇÏ³ªÀÖ¾î¾ß ÇÔ
     - Domain¸í¿¡ .ÀÌ ÇÏ³ª ÀÌ»ó ÀÖ¾î¾ß ÇÔ
     - Domain¸íÀÇ ¸¶Áö¸· ¹®ÀÚ´Â ¿µ¹®ÀÚ 2~4°³ÀÌ¾î¾ß ÇÔ **/

    var check1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/;

    var check2 = /^[a-zA-Z0-9\-\.\_]+\@[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4})$/;

    if ( !check1.test(strMail) && check2.test(strMail) ) {
        return true;
    } else {
        return false;
    }
}

/******************************************************************************
* °Ë»ö Ã¼Å©
*******************************************************************************/
function SearchFormChk(){
	oForm	 = document.getElementById("frmSearch");
	oKeyword = document.getElementById("keyword");

	if (oKeyword.value.trim().length == 0) {
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		oKeyword.focus();
		return false;
	}

	else
	{
		oForm.submit();
	}
}

/******************************************************************************
* ºñ¹Ð¹øÈ£ ¿µ¹®,¼ýÀÚ Á¶ÇÕ Ã¼Å©
*******************************************************************************/
function memPwdChk(str){
    try{
        var _NUM      = "0123456789";
        var _SALPHA   = "abcdefghijklmnopqrstuvwxyz";
        var _ALPHA    = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + _SALPHA;
        var _chkALPHA = false;
        var _chkNUM   = false;

        var i ;
        for ( i=0; i < str.value.length; i++ )  {
            if( _ALPHA.indexOf(str.value.substring(i,i+1)) >= 0) {
                _chkALPHA = true;
            }
            if( _NUM.indexOf(str.value.substring(i,i+1)) >= 0) {
                _chkNUM = true;
            }
        }
    }catch(e){}

    if( str.value.trim().length > 0){

        if( !/^[a-zA-Z0-9]{6,14}$/.test(str.value) ||  !(_chkALPHA && _chkNUM) ){
          alert ("ºñ¹Ð¹øÈ£´Â ¿µ¹®°ú ¼ýÀÚÀÇ Á¶ÇÕÀ¸·Î 6~14ÀÚ¸®³»¿¡¼­ ÀÔ·ÂÇÏ½Ê½Ã¿À.   ");
          str.focus();
          return;
        }
    }
}

/******************************************************************************
* ¾ÆÀÌµð ¿µ¹®,¼ýÀÚ Á¶ÇÕ Ã¼Å©
*******************************************************************************/
function memIdChk(str){
    try{
        var _NUM      = "0123456789";
        var _SALPHA   = "abcdefghijklmnopqrstuvwxyz";
        var _ALPHA    = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + _SALPHA;
        var _chkALPHA = false;
        var _chkNUM   = false;

        var i ;
        for ( i=0; i < str.value.length; i++ )  {
            if( _ALPHA.indexOf(str.value.substring(i,i+1)) >= 0) {
                _chkALPHA = true;
            }
            if( _NUM.indexOf(str.value.substring(i,i+1)) >= 0) {
                _chkNUM = true;
            }
        }
    }catch(e){}

    if( str.value.trim().length > 0){

        if( !/^[a-zA-Z0-9]{6,14}$/.test(str.value) ||  !(_chkALPHA || _chkNUM) ){
          alert ("¾ÆÀÌµð´Â ¿µ¹®, ¼ýÀÚ·Î 6~14ÀÚ¸®³»¿¡¼­ ÀÔ·ÂÇÏ½Ê½Ã¿À.   ");
          str.focus();
          return;
        }
    }
}


/*****************************************************************
* DIV ·¹ÀÌ¾î Å¬¸¯ÇÑ À§Ä¡¿¡ ¶ç¿ì±â
*******************************************************************/
function getDivOpen(ClickId, DivID, MoveTop, MoveLeft) {
  var oTargetElem;
  var oTargetDiv;

  if (typeof (ClickId) == "string")
    oTargetElem = document.getElementById(ClickId);
  else
    oTargetElem = ClickId;

  var oElement = oTargetElem;
  var curleft = 0;
  var curtop = 0;

  if (oElement.offsetParent) {
    while (oElement.offsetParent) {
      curleft += (oElement.offsetLeft - oElement.scrollLeft);
      curtop += (oElement.offsetTop - oElement.scrollTop);
      oElement = oElement.offsetParent;
    }
  }

  if (typeof (DivID) == "string")
    oTargetDiv = document.getElementById(DivID);
  else
    oTargetDiv = DivID;

  oTargetDiv.style.display = "none";
  oTargetDiv.style.left = curleft + MoveLeft; //Å¬¸¯ÇÑ°÷ÀÇ °¡·Î¼öÄ¡·Î ÀÌµ¿
  oTargetDiv.style.top = curtop + MoveTop; 	//Å¬¸¯ÇÑ°÷ÀÇ ¼¼·Î¼öÄ¡·Î ÀÌµ¿
  oTargetDiv.style.display = "block";
}
/******************************************************************************
* ·¹ÀÌ¾î ¼û±è/º¸ÀÓ
******************************************************************************/
function layer_toggle(obj) {
  if (obj.style.display == 'none') {
    obj.style.display = 'block';
  }
  else if (obj.style.display == 'block') {
    obj.style.display = 'none';
  }
}


ok=0; old_what="non";
function show(what){
	if((old_what != "non") && (what != old_what)){
 		ok=1;
 		old_what.style.display="none";
 		what.style.display="";
  }
  else{
 		if(ok){
  		ok=0;
  		what.style.display="none";
 		}
 		else{
  		ok=1;
  		what.style.display="";
 		}
  }
  old_what=what;
}

/******************************************************************************
* ¾ÆÀÌÇÁ·¹ÀÓ ³»¿ë¿¡ ¸Â°Ô »çÀÌÁî Á¶Á¤
/*****************************************************************************/
function IframeSizeAuto() {
  try {
    var objBody = ifrm.document.body;
    var objFrame = document.all["ifrm"];
    ifrmHeight = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight);
    objFrame.style.height = ifrmHeight;
  }
  catch (e) { }
}

/******************************************************************************
* Delete Ã¼Å©
******************************************************************************/
function DeleteCheck(sChk,sVal,sMsg) {

    if(sMsg == ""){
      sMsg = "ÇØ´ç ³»¿ëÀ» »èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?   \n\n»èÁ¦µÈ ³»¿ëÀº º¹¿øµÇÁö ¾Ê½À´Ï´Ù.";
    }

    ans = confirm(sMsg);

    var oForm = document.theForm;

    if (ans == true) {
        if( sChk == "Form"){
          oForm.submit();
        }
        else{
          location.href = sVal;
        }
    }
    else {
        return false;
    }
}

/******************************************************************************
* ¼±ÅÃµÈ  Ã¼Å©¹Ú½º& ¶óµð¿À¹öÆ°ÀÌ ÀÖ´ÂÁö Ã¼Å©
* ex) if (!inputChecked(Form.radios)) {
*         alert("¼±ÅÃÇØ ÁÖ¼¼¿ä.");
*     }
* ex) if (!inputChecked(Form.checkboxes))
*         alert("¼±ÅÃÇØ ÁÖ¼¼¿ä.");
*     }
/*****************************************************************************/
function inputChecked(boxName) {
	//alert(boxName.length);
	if (boxName.length > 1) {
		for (var inx = 0; inx < boxName.length; inx++) {
			if (boxName[inx].checked) return true;
		}
	}
	else {
		if (boxName.checked) return true;
	}
	return false;
}

/******************************************************************************
* Ã¼Å©¹Ú½º Readonly
/*****************************************************************************/
function checkboxReadonly(str) {
	str.checked =! str.checked;
}


/******************************************************************************
* °ü¸®ÀÚ ·Î±×ÀÎ Ã¼Å©
/*****************************************************************************/
function lognFormCheck() {

    var oForm = document.theForm;
    var oLoginID = document.all.strLoginID;
    var oLoginPW = document.all.strLoginPwd;
    var oLoginStat = document.all.strLoginStat;

    if (oLoginID.value.trim().length == "") {
        oLoginStat.innerHTML = "<font color='#B50000' class='b'>&#8226 ¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.</font>"
        oLoginID.focus();
        return false;
    }

    else if (oLoginPW.value.trim().length == "") {
        oLoginStat.innerHTML = "<font color='#B50000' class='b'>&#8226 ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.</font>"
        oLoginPW.focus();
        return false;
    }
    else {
        oLoginPW.value = MD5(oLoginPW.value);
        oForm.target = "ifrm";
        oForm.action = "loginExec.asp";
        oForm.submit();
    }
}

function lognCheck(str) {

    var oLoginID = parent.document.all.strLoginID;
    var oLoginPW = parent.document.all.strLoginPwd;
    var oLoginStat = parent.document.all.strLoginStat;

    if(str==""){
        oLoginStat.innerHTML = "<font color='#B50000' class='b'>&#8226 ·Î±×ÀÎÀ» ÇÏ½Ã¸é Á¢¼Ó °¡´ÉÇÕ´Ï´Ù.</font>"
        oLoginID.value = "";
        oLoginPW.value = "";
        oLoginID.focus();
        return false;
    }
    else if (str == "id") {
        oLoginStat.innerHTML = "<font color='#B50000' class='b'>&#8226 ¾ÆÀÌµð¸¦ È®ÀÎÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.</font>"
        oLoginPW.value = "";
        oLoginID.focus();
        return false;
    }
    else if (str == "pwd") {
        oLoginStat.innerHTML = "<font color='#B50000' class='b'>&#8226 ºñ¹Ð¹øÈ£¸¦ È®ÀÎÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.</font>"
        oLoginPW.value = "";
        oLoginPW.focus();
        return false;
    }
    else {
        oLoginID.value = "";
        oLoginPW.value = "";
        oLoginID.focus();
        return false;
    }
}

/******************************************************************************
* LogOut Ã¼Å©
******************************************************************************/
function logOutCheck() {
    ans = confirm('°ü¸®ÀÚ¸ðµå ·Î±×¾Æ¿ô ÇÏ½Ã°Ú½À´Ï±î?     \n');

	if(ans == true){
		location.href = "../login/logout.asp"
	}
	else {
	  //parent.location.href = "/";
		return false;
	}
}

/******************************************************************************
* Time ½ºÅ©¸³Æ®
/*****************************************************************************/
function getFullToday() {

    var yIdx = 'ÀÏ¿ùÈ­¼ö¸ñ±ÝÅä';
    var today = new Date();
    var buf = "";

    yy = today.getYear();
    mm = today.getMonth() + 1; if (mm < 10) { mm = '0' + mm; }
    dd = today.getDate(); if (dd < 10) { dd = '0' + dd; }
    h = today.getHours(); if (h > 12) { h -= 12; ap = 'PM'; } else { ap = 'AM'; } if (h < 10) { h = '0' + h; }
    m = today.getMinutes(); if (m < 10) { m = '0' + m; }
    s = today.getSeconds(); if (s < 10) { s = '0' + s; }

    yo = '(' + yIdx.charAt(today.getDay()) + ')';

    buf = yy + '-' + mm + '-' + dd + ' ' + yo + ' ' + ap + ' ' + h + ':' + m + ':' + s + '&nbsp; ';

    return buf;
}

function putsTime() {
    if (typeof (document.all.divTime) == "object") {
        document.all.divTime.innerHTML = "" + getFullToday() + " ";
    }
    setTimeout("putsTime()", 1000);
}

/******************************************************************************
* ¹®ÀÚ¿­ ÀÚ¸£±â
******************************************************************************/
function CutChar(ctrl, strLen) {
    var str, msg;
    var len = 0;
    var temp;
    var count;
    count = 0;

    msg = ctrl.value;
    str = new String(msg);
    len = str.length;

    for (k = 0; k < len; k++) {
        temp = str.charAt(k);

        if (escape(temp).length > 4) {
            count += 2;
        }
        else if (temp == '\r' && str.charAt(k + 1) == '\n') { // \r\nÀÏ °æ¿ì
            count += 2;
        }
        else if (temp != '\n') {
            count++;
        }
        if (count > strLen) {
            str = str.substring(0, k);
            break;
        }
    }
    ctrl.value = str;

    CheckStringCut(ctrl, strLen);
}

/******************************************************************************
* ¹®ÀÚ¿­ ±æÀÌ °Ë»ç (¹®ÀÚ¿­ ÀÚ¸§)
******************************************************************************/
function CheckStringCut(ctrl, strLen) {
    var str, msg;
    var len = 0;
    var temp;
    var count = 0;

    msg = ctrl.value;
    str = new String(msg);
    len = str.length;

    for (k = 0; k < len; k++) {
        temp = str.charAt(k);

        if (escape(temp).length > 4) {
            count += 2;
        }
        else if (temp == '\r' && str.charAt(k + 1) == '\n') { // \r\nÀÏ °æ¿ì
            count += 2;
        }
        else if (temp != '\n') {
            count++;
        }
    }

    if (count > strLen) {
        alert("ÇÑ±Û " + numOnMask(strLen / 2) + "ÀÚ(¿µ¹® " + numOnMask(strLen) + "ÀÚ)ÀÌ³»·Î ÀÛ¼ºÇØ ÁÖ¼¼¿ä.");
        CutChar(ctrl, strLen);
    }
}

/******************************************************************************
*¼ýÀÚ 3ÀÚ¸®¸¶´Ù ÄÞ¸¶
******************************************************************************/
function numOnMask(me) {
  var tmpH;

  me = me.toString();

  if (me.charAt(0) == "-") {	//À½¼ö°¡ µé¾î¿ÔÀ»¶§ '-'¸¦ »©°íÀû¿ëµÇ°Ô..
    tmpH = me.substring(0, 1);
    me = me.substring(1, me.length);
  }

  if (me.length > 3) {
    var c = 0;
    var myArray = new Array();

    for (var i = me.length; i > 0; i = i - 3) {
      myArray[c++] = me.substring(i - 3, i);
    }

    myArray.reverse();
    me = myArray.join(",");
  }

  if (tmpH) {
    me = tmpH + me;
  }
  return me;
}

/******************************************************************************
* ¼ýÀÚ¸¸ ÀÔ·Â
******************************************************************************/
function onlyNumber() {
  if ((event.keyCode < 48) || (event.keyCode > 57))
    event.returnValue = false;
}
function checkLetterNum(str) {
  var c;
  var i;
  for (i = 0; i < str.value.length; i++) {
    c = str.value.charAt(i);
    if (c < '0' || c > '9') {
      alert("¼ýÀÚ¸¸ ÀÔ·Â °¡´ÉÇÕ´Ï´Ù.   ");
      str.value="";
      str.focus();
      return;
    }
  }
}

/******************************************************************************
* ¹®ÀÚ¿­ ¾çÂÊ¿¡ °ø¹éÀ» Á¦°Å
* ÃâÃ³ : http://blog.stevenlevithan.com/archives/faster-trim-javascript
/*****************************************************************************/
String.prototype.trim = function() {
	var	str = this.replace(/^\s\s*/, ''),
		ws = /\s/,
		i = str.length;
	while (ws.test(str.charAt(--i)));
	return str.slice(0, i + 1);
}


/******************************************************************************
* MD5 ÇØ½¬ÇÔ¼ö
/*****************************************************************************/
function MD5(sMessage) {
    function RotateLeft(lValue, iShiftBits) { return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits)); }
    function AddUnsigned(lX, lY) {
        var lX4, lY4, lX8, lY8, lResult;
        lX8 = (lX & 0x80000000);
        lY8 = (lY & 0x80000000);
        lX4 = (lX & 0x40000000);
        lY4 = (lY & 0x40000000);
        lResult = (lX & 0x3FFFFFFF) + (lY & 0x3FFFFFFF);
        if (lX4 & lY4) return (lResult ^ 0x80000000 ^ lX8 ^ lY8);
        if (lX4 | lY4) {
            if (lResult & 0x40000000) return (lResult ^ 0xC0000000 ^ lX8 ^ lY8);
            else return (lResult ^ 0x40000000 ^ lX8 ^ lY8);
        } else return (lResult ^ lX8 ^ lY8);
    }
    function F(x, y, z) { return (x & y) | ((~x) & z); }
    function G(x, y, z) { return (x & z) | (y & (~z)); }
    function H(x, y, z) { return (x ^ y ^ z); }
    function I(x, y, z) { return (y ^ (x | (~z))); }
    function FF(a, b, c, d, x, s, ac) {
        a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac));
        return AddUnsigned(RotateLeft(a, s), b);
    }
    function GG(a, b, c, d, x, s, ac) {
        a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac));
        return AddUnsigned(RotateLeft(a, s), b);
    }
    function HH(a, b, c, d, x, s, ac) {
        a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac));
        return AddUnsigned(RotateLeft(a, s), b);
    }
    function II(a, b, c, d, x, s, ac) {
        a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac));
        return AddUnsigned(RotateLeft(a, s), b);
    }
    function ConvertToWordArray(sMessage) {
        var lWordCount;
        var lMessageLength = sMessage.length;
        var lNumberOfWords_temp1 = lMessageLength + 8;
        var lNumberOfWords_temp2 = (lNumberOfWords_temp1 - (lNumberOfWords_temp1 % 64)) / 64;
        var lNumberOfWords = (lNumberOfWords_temp2 + 1) * 16;
        var lWordArray = Array(lNumberOfWords - 1);
        var lBytePosition = 0;
        var lByteCount = 0;
        while (lByteCount < lMessageLength) {
            lWordCount = (lByteCount - (lByteCount % 4)) / 4;
            lBytePosition = (lByteCount % 4) * 8;
            lWordArray[lWordCount] = (lWordArray[lWordCount] | (sMessage.charCodeAt(lByteCount) << lBytePosition));
            lByteCount++;
        }
        lWordCount = (lByteCount - (lByteCount % 4)) / 4;
        lBytePosition = (lByteCount % 4) * 8;
        lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition);
        lWordArray[lNumberOfWords - 2] = lMessageLength << 3;
        lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29;
        return lWordArray;
    }
    function WordToHex(lValue) {
        var WordToHexValue = "", WordToHexValue_temp = "", lByte, lCount;
        for (lCount = 0; lCount <= 3; lCount++) {
            lByte = (lValue >>> (lCount * 8)) & 255;
            WordToHexValue_temp = "0" + lByte.toString(16);
            WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length - 2, 2);
        }
        return WordToHexValue;
    }
    var x = Array();
    var k, AA, BB, CC, DD, a, b, c, d
    var S11 = 7, S12 = 12, S13 = 17, S14 = 22;
    var S21 = 5, S22 = 9, S23 = 14, S24 = 20;
    var S31 = 4, S32 = 11, S33 = 16, S34 = 23;
    var S41 = 6, S42 = 10, S43 = 15, S44 = 21;
    // Steps 1 and 2.  Append padding bits and length and convert to words
    x = ConvertToWordArray(sMessage);
    // Step 3.  Initialise
    a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476;
    // Step 4.  Process the message in 16-word blocks
    for (k = 0; k < x.length; k += 16) {
        AA = a; BB = b; CC = c; DD = d;
        a = FF(a, b, c, d, x[k + 0], S11, 0xD76AA478);
        d = FF(d, a, b, c, x[k + 1], S12, 0xE8C7B756);
        c = FF(c, d, a, b, x[k + 2], S13, 0x242070DB);
        b = FF(b, c, d, a, x[k + 3], S14, 0xC1BDCEEE);
        a = FF(a, b, c, d, x[k + 4], S11, 0xF57C0FAF);
        d = FF(d, a, b, c, x[k + 5], S12, 0x4787C62A);
        c = FF(c, d, a, b, x[k + 6], S13, 0xA8304613);
        b = FF(b, c, d, a, x[k + 7], S14, 0xFD469501);
        a = FF(a, b, c, d, x[k + 8], S11, 0x698098D8);
        d = FF(d, a, b, c, x[k + 9], S12, 0x8B44F7AF);
        c = FF(c, d, a, b, x[k + 10], S13, 0xFFFF5BB1);
        b = FF(b, c, d, a, x[k + 11], S14, 0x895CD7BE);
        a = FF(a, b, c, d, x[k + 12], S11, 0x6B901122);
        d = FF(d, a, b, c, x[k + 13], S12, 0xFD987193);
        c = FF(c, d, a, b, x[k + 14], S13, 0xA679438E);
        b = FF(b, c, d, a, x[k + 15], S14, 0x49B40821);
        a = GG(a, b, c, d, x[k + 1], S21, 0xF61E2562);
        d = GG(d, a, b, c, x[k + 6], S22, 0xC040B340);
        c = GG(c, d, a, b, x[k + 11], S23, 0x265E5A51);
        b = GG(b, c, d, a, x[k + 0], S24, 0xE9B6C7AA);
        a = GG(a, b, c, d, x[k + 5], S21, 0xD62F105D);
        d = GG(d, a, b, c, x[k + 10], S22, 0x2441453);
        c = GG(c, d, a, b, x[k + 15], S23, 0xD8A1E681);
        b = GG(b, c, d, a, x[k + 4], S24, 0xE7D3FBC8);
        a = GG(a, b, c, d, x[k + 9], S21, 0x21E1CDE6);
        d = GG(d, a, b, c, x[k + 14], S22, 0xC33707D6);
        c = GG(c, d, a, b, x[k + 3], S23, 0xF4D50D87);
        b = GG(b, c, d, a, x[k + 8], S24, 0x455A14ED);
        a = GG(a, b, c, d, x[k + 13], S21, 0xA9E3E905);
        d = GG(d, a, b, c, x[k + 2], S22, 0xFCEFA3F8);
        c = GG(c, d, a, b, x[k + 7], S23, 0x676F02D9);
        b = GG(b, c, d, a, x[k + 12], S24, 0x8D2A4C8A);
        a = HH(a, b, c, d, x[k + 5], S31, 0xFFFA3942);
        d = HH(d, a, b, c, x[k + 8], S32, 0x8771F681);
        c = HH(c, d, a, b, x[k + 11], S33, 0x6D9D6122);
        b = HH(b, c, d, a, x[k + 14], S34, 0xFDE5380C);
        a = HH(a, b, c, d, x[k + 1], S31, 0xA4BEEA44);
        d = HH(d, a, b, c, x[k + 4], S32, 0x4BDECFA9);
        c = HH(c, d, a, b, x[k + 7], S33, 0xF6BB4B60);
        b = HH(b, c, d, a, x[k + 10], S34, 0xBEBFBC70);
        a = HH(a, b, c, d, x[k + 13], S31, 0x289B7EC6);
        d = HH(d, a, b, c, x[k + 0], S32, 0xEAA127FA);
        c = HH(c, d, a, b, x[k + 3], S33, 0xD4EF3085);
        b = HH(b, c, d, a, x[k + 6], S34, 0x4881D05);
        a = HH(a, b, c, d, x[k + 9], S31, 0xD9D4D039);
        d = HH(d, a, b, c, x[k + 12], S32, 0xE6DB99E5);
        c = HH(c, d, a, b, x[k + 15], S33, 0x1FA27CF8);
        b = HH(b, c, d, a, x[k + 2], S34, 0xC4AC5665);
        a = II(a, b, c, d, x[k + 0], S41, 0xF4292244);
        d = II(d, a, b, c, x[k + 7], S42, 0x432AFF97);
        c = II(c, d, a, b, x[k + 14], S43, 0xAB9423A7);
        b = II(b, c, d, a, x[k + 5], S44, 0xFC93A039);
        a = II(a, b, c, d, x[k + 12], S41, 0x655B59C3);
        d = II(d, a, b, c, x[k + 3], S42, 0x8F0CCC92);
        c = II(c, d, a, b, x[k + 10], S43, 0xFFEFF47D);
        b = II(b, c, d, a, x[k + 1], S44, 0x85845DD1);
        a = II(a, b, c, d, x[k + 8], S41, 0x6FA87E4F);
        d = II(d, a, b, c, x[k + 15], S42, 0xFE2CE6E0);
        c = II(c, d, a, b, x[k + 6], S43, 0xA3014314);
        b = II(b, c, d, a, x[k + 13], S44, 0x4E0811A1);
        a = II(a, b, c, d, x[k + 4], S41, 0xF7537E82);
        d = II(d, a, b, c, x[k + 11], S42, 0xBD3AF235);
        c = II(c, d, a, b, x[k + 2], S43, 0x2AD7D2BB);
        b = II(b, c, d, a, x[k + 9], S44, 0xEB86D391);
        a = AddUnsigned(a, AA); b = AddUnsigned(b, BB); c = AddUnsigned(c, CC); d = AddUnsigned(d, DD);
    }
    // Step 5.  Output the 128 bit digest
    var temp = WordToHex(a) + WordToHex(b) + WordToHex(c) + WordToHex(d);
    return temp.toLowerCase();
}





















/******************************************************************************
* ¸Þ´º Ä«Å×°í¸®
/*****************************************************************************/

var old = "";
function category_second(v){
	var f = document.getElementById(v);

	if(old != ""){
		document.getElementById(old).style.display="none";
		if(f.style.display=="none" && v !="") f.style.display="";
		else f.style.display="none";
	}else{
		if(f.style.display=="none" && v !="") f.style.display="";
		else f.style.display="none";
	}
	old = v;
}

   // select ¸Þ´º ÀÌµ¿
   function goSelectMenu(form) {

   	   var sltVal = form.menu.selectedIndex; // ¼±ÅÃµÈ °ª
	   var ct     = form.ct.value;

	   location.href =  '?ct=' + ct + '&sm=' +  form.menu.options[sltVal].value;
//         location.href =  '?sm=' +  form.menu.options[sltVal].value;

   }

   // select ¸Þ´º ÀÌµ¿ 2Â÷ ºÐ·ù¿¡¼­
   function goSelectMenuCt(form, sm) {

   	   var sltVal = form.menu.selectedIndex; // ¼±ÅÃµÈ °ª

       location.href =  '?sm=' + sm + '&ct=' +  form.menu.options[sltVal].value;
   }

   // display Á¦¾î
   function setDisplay(id) {

	   if (id.style.display == 'none')
		   id.style.display = '';
	   else
		   id.style.display = 'none';
   }

   // display Á¦¾î (Ãß°¡½Ã¿¡)
   function setDisplayIn(id){

	   if (id.style.display == 'none') {

		   id.style.display = '';
           location.href = '#footer';
		   document.ct.ctName.focus();
	   } else {

		   id.style.display = 'none';
	   }
   }

   // display Á¦¾î (Ãß°¡½Ã¿¡) Å×½ºÆ®
   function setDisplayIn2() {
		   ctForm.style.display = '';
		   document.ct.ctSort.focus();
		   document.ct.ctName.focus();
		   location.href = '#footer';
   }

   function setLinkUrl() {
    var f = document.ct;

		  if(f.SelChk[1].checked){
		    f.ctLinkUrl.value="";
		    f.ctLinkUrl.disabled=true;

		  }
		  else{
		    f.ctLinkUrl.disabled=false;
		  }

   }

   //onclick

   // 1Â÷ºÐ·ù ÀÔ·Â °Ë»ç
    function inputCheckCt() {

          var f = document.ct;

      if ( f.ctSort.value == '' || f.ctName.value == '' ){

     	   alert(" '¸Þ´º¸í'À» ÀÔ·ÂÇØÁÖ¼¼¿ä!");
			   return false;
		  }




		  //if (boxName[inx].checked) return true;
      return;
    }

	// ºÐ·ù Áö¿ï¶§
	function ctDelete(ctName, id) {

          var f =  eval("document.ctf" + id );

          var msg = ctName + '\n\nÀÌ ¸Þ´º¸¦ Áö¿ì½Ã°Ú½À´Ï±î ?\n\nÀÌ ¸Þ´º¿¡ ¼ÓÇÏ´Â ÇÏÀ§ ¸Þ´º±îÁö ¸ðµÎ »èÁ¦µË´Ï´Ù.';

		  if (confirm(msg)){

			  f.sm.value = 'delete_'; // ¼öÁ¤ -> Áö¿ì±â·Î ¸ðµå º¯°æ
			  f.submit();

		  }else{

			  return;
		  }
    }


	// ÆÄÀÏ ³»¿ëº¸±â
	function fileViewWin(url, width, height) {

        var option;

        if (width != -1)  option += ' width=' + width + ' ';
        if (height != -1) option += ', height=' + height + ' ';


		window.open(url, '', option + 'left=10, top=10, scrollbars=yes, menubar=yes, resizable=yes');
		return;
	}

