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_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v3.0
  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; }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
// ÀÌ¹ÌÁö ·Îµå
function MM_preloadImages() {
  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 open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable) {
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';
  window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

// ¼ýÀÚÃ¼Å©
function numberCheck() {
  if (event.keyCode > 57) event.returnValue = false;
}

// ¼ýÀÚÃ¼Å© ¼Ò¼öÁ¡»ç¿ë
function numberCheck2() {
  if (event.keyCode > 57 && event.keyCode != 110 && event.keyCode != 190 ) event.returnValue = false;
}

// HTML Tag ÀÔ·Â
function CheckTag(target, msg) {
  var count = 0;
  var tv = target.value
  for (i = 0;  i < tv.length;  i++) {
    ch = tv.charAt(i);
    if ((ch == "<") || (ch == ">")) {  
      count = count + 1;
    }
  }
  if (count >= 2){
    alert("\n" + msg + "¿¡´Â HTML Tag¸¦ ÀÔ·ÂÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.    ");
    target.focus() ;
    return true;
  }
  return false;
}

// ÀüÃ¼¼±ÅÃ
function select_all(checked) {
  var i = 0;
  while (i < document.form.elements.length) {
    if (document.form.elements[i].name == 'num') {
      document.form.elements[i].checked = checked;
    }
    i++;
  }
}

// ´ÙÀ½ inputÀ¸·Î ¿Å±â±â
var isNN = (navigator.appName.indexOf("Netscape")!=-1);

function autoTab(input, ele, len, e) { 
  var keyCode = (isNN) ? e.which : e.keyCode; 
  var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];  
  var eleVal = ele - 1;
  if (input.value.length >= len && !containsElement(filter,keyCode)) { 
    input.value = input.value.slice(0, len);
    input.form.elements[eleVal].focus(); 
  } 
  return true; 
} 

function containsElement(arr, ele) { 
  var found = false, index = 0; 
  while (!found && index < arr.length) 
    if (arr[index] == ele) 
      found = true; 
    else
      index++; 
      return found; 
} 

function getIndex(input) { 
  var index = -1, i = 0, found = false; 
  while (i < input.form.length && index == -1) 
    if (input.form[i] == input)index = i; 
    else i++; 
    return index; 
}

// ±ÛÀÚ¼ö¼¼±â
function chkbyte(target_form, target, len) {
  var ch = target.value;
  var cnt = 0;
  for (k = 0; k < ch.length; k++) {
      cnt++;
  }
  if (cnt >= len) {
    alert("\n" + len + "ÀÌ»ó ÀÔ·ÂÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.    ");
    target.focus() ;
    return true;
  }
  target_form.byte.value = cnt;
  return cnt;
}

// ½ºÅ©·Ñ¸Þ´º ½ºÅ©¸³Æ®
var stmnLEFT = 0;               // ½ºÅ©·Ñ¸Þ´ºÀÇ ÁÂÃø À§Ä¡
var stmnGAP1 = 0;               // ÆäÀÌÁö Çì´õºÎºÐÀÇ ¿©¹é
var stmnGAP2 = 0;               // ½ºÅ©·Ñ½Ã ºê¶ó¿ìÀú »ó´Ü°ú ¾à°£ ¶ç¿ò. ÇÊ¿ä¾øÀ¸¸é 0À¸·Î ¼¼ÆÃ
var stmnBASE = 0;               // ½ºÅ©·Ñ¸Þ´º ÃÊ±â ½ÃÀÛÀ§Ä¡ (¾Æ¹«·¸°Ô³ª ÇØµµ »ó°üÀº ¾øÁö¸¸ stmnGAP1°ú ¾à°£ Â÷ÀÌ¸¦ ÁÖ´Â°Ô º¸±â ÁÁÀ½)
var stmnActivateSpeed = 200;    // ¿òÁ÷ÀÓÀ» °¨ÁöÇÏ´Â ¼Óµµ (¼ýÀÚ°¡ Å¬¼ö·Ï ´Ê°Ô ¾Ë¾ÆÂ÷¸²)
var stmnScrollSpeed = 10;       // ½ºÅ©·ÑµÇ´Â ¼Óµµ (Å¬¼ö·Ï ´Ê°Ô ¿òÁ÷ÀÓ)

var stmnTimer;

function ReadCookie(name) {
  var label = name + "=";
  var labelLen = label.length;
  var cLen = document.cookie.length;
  var i = 0;

  while (i < cLen) {
    var j = i + labelLen;

    if (document.cookie.substring(i, j) == label) {
      var cEnd = document.cookie.indexOf(";", j);
      if (cEnd == -1) cEnd = document.cookie.length;
      return unescape(document.cookie.substring(j, cEnd));
    }
    i++;
  }
  return "";
}

function SaveCookie(name, value, expire) {
  var eDate = new Date();
  eDate.setDate(eDate.getDate() + expire);
  document.cookie = name + "=" + value + "; expires=" +  eDate.toGMTString()+ "; path=/";
}

function RefreshStaticMenu() {
  var stmnStartPoint, stmnEndPoint, stmnRefreshTimer;

  stmnStartPoint = parseInt(SCROLL_TARGET.style.top, 10);
  stmnEndPoint = document.body.scrollTop + stmnGAP2;
  if (stmnEndPoint < stmnGAP1) stmnEndPoint = stmnGAP1;

  stmnRefreshTimer = stmnActivateSpeed;

  if ( stmnStartPoint != stmnEndPoint ) {
    stmnScrollAmount = Math.ceil( Math.abs( stmnEndPoint - stmnStartPoint ) / 15 );
    SCROLL_TARGET.style.top = parseInt(SCROLL_TARGET.style.top, 10) + ( ( stmnEndPoint<stmnStartPoint ) ? -stmnScrollAmount : stmnScrollAmount );
    stmnRefreshTimer = stmnScrollSpeed;
  }
  stmnTimer = setTimeout ("RefreshStaticMenu();", stmnRefreshTimer);
}

function ToggleAnimate() {
  if (!MOVE_SCROLL.checked) {
    RefreshStaticMenu();
    SaveCookie("MOVE_SCROLL", "true", 300);
  } else {
    clearTimeout(stmnTimer);
    SCROLL_TARGET.style.top = stmnGAP1;
    SaveCookie("MOVE_SCROLL", "false", 300);
  }
}

function InitializeStaticMenu() {
  SCROLL_TARGET.style.left = stmnLEFT;
  if (ReadCookie("MOVE_SCROLL") == "false") {
    MOVE_SCROLL.checked = true;
    SCROLL_TARGET.style.top = document.body.scrollTop + stmnGAP1;
  } else {
    MOVE_SCROLL.checked = false;
    SCROLL_TARGET.style.top = document.body.scrollTop + stmnBASE;
    RefreshStaticMenu();
  }
}

function RefreshStaticMenu1() {
  var stmnStartPoint, stmnEndPoint, stmnRefreshTimer;

  stmnStartPoint = parseInt(SCROLL_TARGET1.style.top, 10);
  stmnEndPoint = document.body.scrollTop + stmnGAP2;
  if (stmnEndPoint < stmnGAP1) stmnEndPoint = stmnGAP1;

  stmnRefreshTimer = stmnActivateSpeed;

  if ( stmnStartPoint != stmnEndPoint ) {
    stmnScrollAmount = Math.ceil( Math.abs( stmnEndPoint - stmnStartPoint ) / 15 );
    SCROLL_TARGET1.style.top = parseInt(SCROLL_TARGET1.style.top, 10) + ( ( stmnEndPoint<stmnStartPoint ) ? -stmnScrollAmount : stmnScrollAmount );
    stmnRefreshTimer = stmnScrollSpeed;
  }
  stmnTimer = setTimeout ("RefreshStaticMenu1();", stmnRefreshTimer);
}

function ToggleAnimate1() {
  if (!MOVE_SCROLL1.checked) {
    RefreshStaticMenu1();
    SaveCookie("MOVE_SCROLL1", "true", 300);
  } else {
    clearTimeout(stmnTimer);
    SCROLL_TARGET1.style.top = stmnGAP1;
    SaveCookie("MOVE_SCROLL1", "false", 300);
  }
}

function InitializeStaticMenu1() {
  SCROLL_TARGET1.style.left = stmnLEFT;
  if (ReadCookie("MOVE_SCROLL1") == "false") {
    MOVE_SCROLL1.checked = true;
    SCROLL_TARGET1.style.top = document.body.scrollTop + stmnGAP1;
  } else {
    MOVE_SCROLL1.checked = false;
    SCROLL_TARGET1.style.top = document.body.scrollTop + stmnBASE;
    RefreshStaticMenu1();
  }
}

// ½Å ·Ñ¿À¹ö ½ºÅ©¸³Æ®
function rollImage(img_id, after) { 
  eval(img_id + '.filters.blendTrans.stop();'); 
  eval(img_id + '.filters.blendTrans.Apply();'); 
  eval(img_id + '.src="' + after + '";'); 
  eval(img_id + '.filters.blendTrans.Play();'); 
} 

// ÀüÃ¼ ÆäÀÌÁö Á¡¼± ¾ø¾Ö´Â ½ºÅ©¸³Æ®
//function autoBlur(){ 
//  for (i = 0; i < document.links.length; i++) document.links[i].onfocus = document.links[i].blur;
//} 
//document.onfocusin=autoBlur; 


// °èÁÂÁ¶È¸ »õÃ¢À¸·Î ¿­±â
function view_bank(str,w_width,w_height) {
  var winOpts = 'width=' + w_width + ',height=' + w_height + ',scrollbars=yes,left=170,top=100';
  win_bank = window.open(str,'desc',winOpts);
  win_bank.focus();
}

//---------------------------------------------------
// ±âÁ¸Å×ÀÌºíÀ» ¸ð¼­¸®°¡ µÕ±Ù Å×ÀÌºí·Î ÀüÈ¯ script
// p4nda
//----------------------------------------------------
function roundTable(objID) {
  var obj = document.getElementById(objID);
  var Parent, objTmp, Table, TBody, TR, TD;
  var bdcolor, bgcolor, Space;
  var trIDX, tdIDX, MAX;
  var styleWidth, styleHeight;

  // get parent node
  Parent = obj.parentNode;
  objTmp = document.createElement('SPAN');
  Parent.insertBefore(objTmp, obj);
  Parent.removeChild(obj);

  // get attribute
  bdcolor = obj.getAttribute('rborder');
  bgcolor = obj.getAttribute('rbgcolor');
  radius = parseInt(obj.getAttribute('radius'));
  if (radius == null || radius < 1) radius = 1;
  else if (radius > 6) radius = 6;

  MAX = radius * 2 + 1;
   
/*
create table {{
*/
  Table = document.createElement('TABLE');
  TBody = document.createElement('TBODY');

  Table.cellSpacing = 0;
  Table.cellPadding = 0;

  for (trIDX=0; trIDX < MAX; trIDX++) {
    TR = document.createElement('TR');
    Space = Math.abs(trIDX - parseInt(radius));
    for (tdIDX=0; tdIDX < MAX; tdIDX++) {
      TD = document.createElement('TD');
                 
      styleWidth = '1px'; styleHeight = '1px';
      if (tdIDX == 0 || tdIDX == MAX - 1) styleHeight = null;
      else if (trIDX == 0 || trIDX == MAX - 1) styleWidth = null;
      else if (radius > 2) {
        if (Math.abs(tdIDX - radius) == 1) styleWidth = '2px';
        if (Math.abs(trIDX - radius) == 1) styleHeight = '2px';
      }

      if (styleWidth != null) TD.style.width = styleWidth;
      if (styleHeight != null) TD.style.height = styleHeight;

      if (Space == tdIDX || Space == MAX - tdIDX - 1) TD.style.backgroundColor = bdcolor;
      else if (tdIDX > Space && Space < MAX - tdIDX - 1)  TD.style.backgroundColor = bgcolor;
                 
      if (Space == 0 && tdIDX == radius) TD.appendChild(obj);
      TR.appendChild(TD);
    }
    TBody.appendChild(TR);
  }
/*
}}
*/

  Table.appendChild(TBody);
   
  // insert table and remove original table
  Parent.insertBefore(Table, objTmp);
}

//---------------------------------------------------
// ±âÁ¸Å×ÀÌºíÀ» ¸ð¼­¸®°¡ µÕ±Ù Å×ÀÌºí·Î ÀüÈ¯ script
// p4nda
//----------------------------------------------------



// ½½¶óÀÌµù ¸Þ´º ½ºÅ©¸³Æ®
function allblur() {
  for (i = 0; i < document.links.length; i++)
    document.links[i].onfocus = document.links[i].blur;
}

function toggleMenu(currMenu) { 
  if (document.all) { 
    if (currMenu == "menu1") { 
      eval(document.all.menu1.style).display = "block" 
      eval(document.all.menu2.style).display = "none"                                             
      eval(document.all.menu3.style).display = "none"
      eval(document.all.menu4.style).display = "none"
      eval(document.all.menu5.style).display = "none"
      eval(document.all.menu6.style).display = "none"
      eval(document.all.menu7.style).display = "none"     
    } else if(currMenu == "menu2") { 
      eval(document.all.menu1.style).display = "none" 
      eval(document.all.menu2.style).display = "block"                                             
      eval(document.all.menu3.style).display = "none" 
      eval(document.all.menu4.style).display = "none"
      eval(document.all.menu5.style).display = "none"
      eval(document.all.menu6.style).display = "none"
      eval(document.all.menu7.style).display = "none" 
    } else if(currMenu == "menu3") { 
      eval(document.all.menu1.style).display = "none" 
      eval(document.all.menu2.style).display = "none"                                             
      eval(document.all.menu3.style).display = "block" 
      eval(document.all.menu4.style).display = "none"
      eval(document.all.menu5.style).display = "none"
      eval(document.all.menu6.style).display = "none"
      eval(document.all.menu7.style).display = "none" 
    } else if(currMenu == "menu4") { 
      eval(document.all.menu1.style).display = "none" 
      eval(document.all.menu2.style).display = "none"                                             
      eval(document.all.menu3.style).display = "none" 
      eval(document.all.menu4.style).display = "block"
      eval(document.all.menu5.style).display = "none"
      eval(document.all.menu6.style).display = "none"
      eval(document.all.menu7.style).display = "none" 
    } else if(currMenu == "menu5") { 
      eval(document.all.menu1.style).display = "none" 
      eval(document.all.menu2.style).display = "none"                                             
      eval(document.all.menu3.style).display = "none" 
      eval(document.all.menu4.style).display = "none"
      eval(document.all.menu5.style).display = "block"
      eval(document.all.menu6.style).display = "none"
      eval(document.all.menu7.style).display = "none" 
    } else if(currMenu == "menu6") { 
      eval(document.all.menu1.style).display = "none" 
      eval(document.all.menu2.style).display = "none"                                             
      eval(document.all.menu3.style).display = "none" 
      eval(document.all.menu4.style).display = "none"
      eval(document.all.menu5.style).display = "none"
      eval(document.all.menu6.style).display = "block"
      eval(document.all.menu7.style).display = "none" 
    } else if(currMenu == "menu7") { 
      eval(document.all.menu1.style).display = "none" 
      eval(document.all.menu2.style).display = "none"                                             
      eval(document.all.menu3.style).display = "none" 
      eval(document.all.menu4.style).display = "none"
      eval(document.all.menu5.style).display = "none"
      eval(document.all.menu6.style).display = "none"
      eval(document.all.menu7.style).display = "block"    
    }       
    return false 
  } else { 
    return true 
  } 
} 

function _checkBoardAdmin(id) {
  location.href="../board/board.php?mode=admin&id=" + id;
}

function _openNews(url) {
  window.open(url, "newswin", "scrollbars=yes,toolbar=yes,status=yes,menubar=yes,location=yes,width=800,height=600,left=0,top=0");
}

// °Ë»ö
function _checkSearch(f) {
  if (f.search_key.value == "" && f.search_field.value != "reset") {
    alert("\n°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿À.    ");
    f.search_key.focus();
    return;
  }
  f.submit();
}

function _checkSearchNull(f) {
  f.submit();
}

// ¿ìÆí¹øÈ£Ã£±â
function _openPostcode(fname, flag) {
  window.open("../include/zipcode.php?target_form=" + fname + "&flag=" + flag, "postwin", "scrollbars=yes,width=430,height=330");
}

// ¾ÆÀÌµðºÐ½Ç
function _popupFindid() {
  window.open("../member/popupFindid.php", "findid", "scrollbars=no, width=430, height=330");
}
// ºñ¹Ð¹øÈ£ºÐ½Ç
function _popupFindpw() {
  window.open("../member/popupFindpw.php", "findpw", "scrollbars=no, width=430, height=330");
}
// °¡ÀÔÇØÁö
function _popupMemberout() {
  window.open("../member/popupMemberout.php", "del", "scrollbars=no, width=430, height=330");
}

// »èÁ¦
function _checkDelete(deleteurl) {
  if (confirm("\nÁ¤¸»·Î »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?    "))
    location.href = deleteurl;
}

// Æ÷Ä¿½ºÀÚµ¿º¯°æ
function _moveFocus(obj, f, next_obj, limit) {
  var next_focus = eval(f + "." + next_obj);
  if (obj.value.length >= limit) {  
    next_focus.focus();
    return;
  }
}

// ÇÑ±Û ÀÔ·Â °Ë»ö
function _checkKorean(word) {
  var str="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-";
  
  for (i=0; i< word.length; i ++) {
    idcheck = word.charAt(i);
  
    for ( j = 0 ;  j < str.length ; j ++) {
      if (idcheck == str.charAt(j)) break;
      if (j+1 == str.length)
        return false;
    }
  }
  return true;
}

// ÇÑ±Û ÀÔ·Â °Ë»ö
function _checkOnlyKorean(word) {
  var str="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890- ";
  var count = 0;
  for (i=0; i< word.length; i ++) {
    idcheck = word.charAt(i);
    for ( j = 0 ;  j < str.length ; j ++) {
      if (idcheck == str.charAt(j)) {
          count ++;
          return false;
      }
      //if (j+1 == str.length) return false;
    }
  }
  if (count == 0) return true;
  else return false;
}

// ¼ýÀÚÃ¼Å©
function _checkNumber(str) {
  if (str == "") return false
  for(var i = 0; i < str.length; i++) {
    var chr = str.substr(i,1);
    if(chr < '0' || chr > '9') 
     return false;
  }
  return true;
}

// Ã¼Å©¹Ú½º ÀüÃ¼¼±ÅÃ°ú ¼±ÅÃÇØÁ¦
function SendCheckField(f) {
  var retVal = 0;
  var i = 0;
  for(i = 0; i < f.elements.length; i++) {
    tmpval = f.elements[i].value;
    if( f.elements[i].checked ) 
      retVal = 1;
  }
  return(retVal);
}

function SendCheckFieldNo(f) {
  var retVal = 0;
  var checked = 0;
  var not_checked = 0;
  var i = 0;
  for(i = 0; i < f.elements.length; i++) {
    tmpval = f.elements[i].value;

    if( f.elements[i].type == "checkbox" && f.elements[i].checked == false) 
      not_checked = 1;
    else if ( f.elements[i].type == "checkbox" && f.elements[i].checked == true) 
      checked = 1;
  }

  if (not_checked == 1 && checked == 0) {
    retVal = 3;
  } else if (not_checked == 1 && checked == 1) {
    retVal = 2;
  } else if (not_checked == 0 && checked == 1) {
    retVal = 1;
  }
  return(retVal);
}


// ÀüÃ¼¼±ÅÃ
function _allSelect(f, tmp) {
  var start, end;
  if (start == "" || start == null) start = 0;
  if (end == "" || end == null) end = f.elements.length;

  for( var i = start; i < end; i++) {
    var e = f.elements[i];
    if (tmp.checked == true) e.checked = true; else  e.checked = false;
  }
}

function _allSelect1(f, tmp) {
  var start, end;
  if (start == "" || start == null) start = 0;
  if (end == "" || end == null) end = f.elements.length;

  for( var i = start; i < end; i++) {
    var e = f.elements[i];
    if (e.checked == true) e.checked = false; else  e.checked = true;
  }
}

function _allCancel(f, tmp) {
  var start, end;
  if (start == "" || start == null) start = 0;
  if (end == "" || end == null) end = f.elements.length;

  for ( var i = start; i < end; i++) {
    var e = f.elements[i];
    if (e.checked == true) e.checked = false;
  }
}

// ÀÔ·Â ¹®ÀÚ¿­°Ë»ç
function _checkString(str, flag) {
  var i;
  if (str.length >= 1) {
     for (i = 0; i < flag.length; i++)
        if(str.indexOf(flag.charAt(i)) >= 0) {
           return false;
        }
  }
  return true;
}

// ÁÖ¹Îµî·Ï¹øÈ£ Ã¼Å©
function _checkResnumber(num1, num2) {
  var f1 = num1.substring(0, 1) 
  var f2 = num1.substring(1, 2) 
  var f3 = num1.substring(2, 3) 
  var f4 = num1.substring(3, 4) 
  var f5 = num1.substring(4, 5) 
  var f6 = num1.substring(5, 6) 
  var hap = f1 * 2 + f2 * 3 + f3 * 4 + f4 * 5 + f5 * 6 + f6*7 
  var l1 = num2.substring(0, 1) 
  var l2 = num2.substring(1, 2) 
  var l3 = num2.substring(2, 3) 
  var l4 = num2.substring(3, 4) 
  var l5 = num2.substring(4, 5) 
  var l6 = num2.substring(5, 6) 
  var l7 = num2.substring(6, 7) 
  hap = hap + l1 * 8 + l2 * 9 + l3 * 2 + l4 * 3 + l5 * 4 + l6 * 5 
  hap = hap % 11 
  hap = 11 - hap 
  hap = hap % 10
   
  if (hap != l7)
    return false; 
  else
    return true;
}

// Æû¿¡¼­ ¼ýÀÚ¸¸ ÀÔ·Â¹Þµµ·Ï
function _checkNum(obj) {
  var num = obj.value
  if (_checkNumber(num) != true) {
    obj.value = "";
    obj.focus();
    return;
  }
}

//  url °¡°ø
function _returnOnlyDomain(url_obj) {
  var url = url_obj.value;

  //  url¿¡¼­ http:// ¶Ç´Â ftp://¸¦ »èÁ¦
  var url_array = url.split('://');
  var url_count = url_array.length;
  if (url_count != 2) {
    alert("\nURLÀº http://¸¦ Æ÷ÇÔÇÑ ÀüÃ¼µµ¸ÞÀÎÁÖ¼Ò¸¦ ÀÔ·ÂÇÏ¼Å¾ßÇÕ´Ï´Ù.    ");
    url_obj.focus();
    return 0;
  }

  //  url¿¡¼­ ¸Ç³¡ÀÇ /¸¦ »èÁ¦
  var url_length = url.length;
  var f1 = url.substring(url_length - 1, url_length);
  if (f1 == '/')  url = url.substring(0, url_length - 1);

  //  urlÀÇ Å¸´ç¼º °Ë»ç
  var url_array1 = url.split('.');
  var url_count1 = url_array1.length;
  if (url_count1 < 2) {
    alert("\nURLÀº http://¿Í www.À» Æ÷ÇÔÇÑ µµ¸ÞÀÎ³×ÀÓÀÇ Çü½ÄÀ¸·Î ÀÔ·ÂÇÏ¿©ÁÖ½Ê½Ã¿À.    ");
    url_obj.focus();
    return 0;
  }

  for (var i = 0; i < url_count1; i ++) {
    if (url_array1[i].length < 2) {
      alert("\nURLÀ» ¿Ã¹Ù¸£°Ô ÀÔ·ÂÇÏ¿©ÁÖ½Ê½Ã¿À.    ");
      url_obj.focus();
      return 0;
    }
  }
  return url;
}

//FAQ Show & Hidden
obj_old = null;
function show_list(obj) {
    if(obj_old != null) {
        if(obj.id != obj_old.id) {
            change_old();
        }
    }
    if (obj.style.display == "" || obj.style.display == "show") {
        obj.style.display = "none";
    }
    else if (obj.style.display == "none") {
        obj.style.display = "";
    }
    obj_old = obj;
}
function change_old() {
    obj_old.style.display = "none";
}

//ÇÃ·¡½Ã Á¡¼± ¾È¶ß°Ô ÇÏ±â
function viewFlash(sURL, sName, sFeatures) { 

  //ÇÃ·¡½Ã ActiveX ¿ÀºêÁ§Æ®¸¦ »Ñ·ÁÁÝ´Ï´Ù. 
  var FLASHCAB = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"; 
  var FLASHCID = "CLSID:D27CDB6E-AE6D-11CF-96B8-444553540000"; 
  var FLASHVER = "8,0,0,0"; 

  var sFeature; 
  var sWidth  = "100%"; 
  var sHeight  = "100%"; 
  var pmBoolean = "false"; 
  var sTempArray; 
  var sParamTag = ""; 

  sFeature = sFeatures.split(/\s*,\s*/); 
  for (var i=0; i< sFeature.length ; i++) { 
    sTempArray = sFeature[i].split(/\s*=\s*/); 
    if (sTempArray[0].toLowerCase() == "width") { 
    //³ÐÀÌ 
    sWidth = sTempArray[1]; 
    } else if (sTempArray[0].toLowerCase() == "height") {
      //³ôÀÌ 
      sHeight = sTempArray[1]; 
    } else { 
      //±âÅ¸ ÆÄ¶ó¸ÞÅÍ Ã³¸® 
      if (sTempArray[1].toLowerCase() == "yes" || sTempArray[1] == "1" || sTempArray[1].toLowerCase() == "true") { 
        pmBoolean = "true"; 
      } else if (sTempArray[1].toLowerCase() == "no" || sTempArray[1] == "0" || sTempArray[1].toLowerCase() == "false") { 
        pmBoolean = "false"; 
      } else{ 
        pmBoolean = sTempArray[1]; 
      } 
      sParamTag = "<PARAM NAME='"+sTempArray[0]+"'VALUE='" + pmBoolean + "'>\n"+sParamTag; 
    } 
  } 

  document.write("<OBJECT ID='"+sName+"' NAME='"+sName+"' CLASSID='"+FLASHCID+"' CODEBASE='"+FLASHCAB+"#version="+FLASHVER+"' WIDTH='"+sWidth+"' HEIGHT='"+sHeight+"'>"); 
  document.write("<PARAM NAME='movie' VALUE='" + sURL + "'>"); 
  document.write("<param name='wmode' value='transparent'>");
  document.write(sParamTag); 
  document.write("<EMBED SRC='"+sURL+"' MENU='false' WIDTH='"+sWidth+"' HEIGHT='"+sHeight+"' ID='"+sName+"' NAME='"+sName+"' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer' />") 
  document.write("</OBJECT>"); 
}


// ·¹ÀÌ¾î ÆË¾÷
function pop_win(layer) {
  if(document.all[layer].style.display == "") document.all[layer].style.display = "none";
}

function notice_closeWin(layer_form, layer_value) {
  if (layer_form.Notice.value == "checked") notice_setCookie(layer_value, "done" , 1);  // 1 = ÇÏ·íµ¿¾È °øÁöÃ¢ ¿­Áö ¾ÊÀ½
  pop_win(layer_value);
}
// SET
function notice_setCookie(name, value, expiredays) {
  var todayDate = new Date();
  todayDate.setDate(todayDate.getDate() + expiredays);
  document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() +  ";"
}
// GET
function notice_getCookie(name) {
  var nameOfCookie = name + "=";
  var x = 0;
  while (x <= document.cookie.length) {
    var y = (x + nameOfCookie.length);
    if (document.cookie.substring(x, y) == nameOfCookie) {
      if ((endOfCookie = document.cookie.indexOf( ";", y )) == -1 ) endOfCookie = document.cookie.length;
      return unescape(document.cookie.substring( y, endOfCookie ));
    }
    x = document.cookie.indexOf( " ", x ) + 1;
    if (x == 0) break;
  }
  return "";
}

// ÀÌ¹ÌÁö »çÀÌÁî º¯°æ
function _changeImage(img, maxsize) {

   var on_img = eval("document." + img);
   document.photo.src = on_img.src;

   _resizeImage(on_img, maxsize);
}

function _resizeImage(srcimg, maxsize) {

   var img = new Image();
   img.src = srcimg.src;

   var limitx = maxsize;
   var limity = maxsize;
   var imgx = img.width;
   var imgy = img.height;

   var differx = imgx - limitx;
   var differy = imgy - limity;
   var differ = 1;
   var resizex = resizey = 0;
   
   if (differx > 0) {
     if (differx > differy) differ = limitx / imgx;
     else differ = limity / imgy;
   } else if (differy > 0) {
     if (differx > differy) differ = limitx / imgx;
     else differ = limity / imgy;
   } 

   resizex = imgx * differ;
   resizey = imgy * differ;
   document.photo.width = resizex;
   document.photo.height = resizey;
}

// ÀÌ¹ÌÁö »çÀÌÁî º¯°æ
function _changeImage2(img, wsize, hsize) {

   var on_img = eval("document." + img);
   document.photo.src = on_img.src;

   _resizeImage2(on_img, wsize, hsize);
}

function _resizeImage2(srcimg, wsize, hsize) {

   var img = new Image();
   img.src = srcimg.src;

   var limitx = wsize;
   var limity = hsize;
   var imgx = img.width;
   var imgy = img.height;

   var differx = imgx - limitx;
   var differy = imgy - limity;
   var differ = 1;
   var resizex = resizey = 0;
   
   if (differx > 0) {
     if (differx > differy) differ = limitx / imgx;
     else differ = limity / imgy;
   } else if (differy > 0) {
     if (differx > differy) differ = limitx / imgx;
     else differ = limity / imgy;
   } 

   resizex = imgx * differ;
   resizey = imgy * differ;
   document.photo.width = resizex;
   document.photo.height = resizey;
}

// ±ôºýÅ×±×
function doBlink() { 
   var blink = document.all.tags("BLINK") 
   for (var i=0; i < blink.length; i++) blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "" 
} 
function startBlink() { 
   if (document.all) setInterval("doBlink()",500) //  
}

//  È¸¿ø·Î±×ÀÎ Ã¼Å©
function _checkLogin(f) {
 if (f.id.value == "") {
   alert ("¾ÆÀÌµð¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
   f.id.focus();
   return false;
 }
 if (f.password.value == "") {
   alert ("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
   f.password.focus();
   return false;
 }
 f.submit();
}

// À¯È¿ÇÑ(Á¸ÀçÇÏ´Â) ¿ù(êÅ)ÀÎÁö Ã¼Å©
function isValidMonth(mm) {
   var m = parseInt(mm,10);
   return (m >= 1 && m <= 12);
}

// À¯È¿ÇÑ(Á¸ÀçÇÏ´Â) ÀÏ(ìí)ÀÎÁö Ã¼Å©
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]);
}

// À¯È¿ÇÑ(Á¸ÀçÇÏ´Â) ½Ã(ãÁ)ÀÎÁö Ã¼Å©
function isValidHour(hh) {
   var h = parseInt(hh,10);
   return (h >= 1 && h <= 24);
}

// À¯È¿ÇÑ(Á¸ÀçÇÏ´Â) ºÐ(ÝÂ)ÀÎÁö Ã¼Å©
function isValidMin(mi) {
   var m = parseInt(mi,10);
   return (m >= 1 && m <= 60);
}

// Time Çü½ÄÀÎÁö Ã¼Å©(´À½¼ÇÑ Ã¼Å©)
function isValidTimeFormat(time) {
   return (!isNaN(time) && time.length == 12);
}

// À¯È¿ÇÏ´Â(Á¸ÀçÇÏ´Â) Time ÀÎÁö Ã¼Å©
function isValidTime(time) {
   var year  = time.substring(0,4);
   var month = time.substring(4,6);
   var day   = time.substring(6,8);
   var hour  = time.substring(8,10);
   var min   = time.substring(10,12);

   if (parseInt(year,10) >= 1900  && isValidMonth(month) &&
      isValidDay(year,month,day) && isValidHour(hour)   &&
      isValidMin(min)) {
      return true;
   }
   return false;
}

// Time ½ºÆ®¸µÀ» ÀÚ¹Ù½ºÅ©¸³Æ® Date °´Ã¼·Î º¯È¯
function toTimeObject(time) { //parseTime(time)
   var year  = time.substr(0,4);
   var month = time.substr(4,2) - 1; // 1¿ù=0,12¿ù=11
   var day   = time.substr(6,2);
   var hour  = time.substr(8,2);
   var min   = time.substr(10,2);
   return new Date(year,month,day,hour,min);
}

// ÀÚ¹Ù½ºÅ©¸³Æ® Date °´Ã¼¸¦ Time ½ºÆ®¸µÀ¸·Î º¯È¯
function toTimeString(date) { //formatTime(date)
   var year  = date.getFullYear();
   var month = date.getMonth() + 1; // 1¿ù=0,12¿ù=11ÀÌ¹Ç·Î 1 ´õÇÔ
   var day   = date.getDate();
   var hour  = date.getHours();
   var min   = date.getMinutes();

   if (("" + month).length == 1) { month = "0" + month; }
   if (("" + day).length   == 1) { day   = "0" + day;   }
   if (("" + hour).length  == 1) { hour  = "0" + hour;  }
   if (("" + min).length   == 1) { min   = "0" + min;   }

   return ("" + year + month + day + hour + min)
}

// TimeÀÌ ÇöÀç½Ã°¢ ÀÌÈÄ(¹Ì·¡)ÀÎÁö Ã¼Å©
function isFutureTime(time) {
   return (toTimeObject(time) > new Date());
}

// TimeÀÌ ÇöÀç½Ã°¢ ÀÌÀü(°ú°Å)ÀÎÁö Ã¼Å©
function isPastTime(time) {
   return (toTimeObject(time) < new Date());
}

/**
 * ÁÖ¾îÁø Time °ú y³â m¿ù dÀÏ h½Ã Â÷ÀÌ³ª´Â TimeÀ» ¸®ÅÏ

 * ex) var time = form.time.value; //'20000101000'
 *     alert(shiftTime(time,0,0,-100,0));
 *     => 2000/01/01 00:00 À¸·ÎºÎÅÍ 100ÀÏ Àü Time
 */
function shiftTime(time,y,m,d,h) { //moveTime(time,y,m,d,h)
   var date = toTimeObject(time);

   date.setFullYear(date.getFullYear() + y); //y³âÀ» ´õÇÔ
   date.setMonth(date.getMonth() + m);       //m¿ùÀ» ´õÇÔ
   date.setDate(date.getDate() + d);         //dÀÏÀ» ´õÇÔ
   date.setHours(date.getHours() + h);       //h½Ã¸¦ ´õÇÔ

   return toTimeString(date);
}

// µÎ TimeÀÌ ¸î °³¿ù Â÷ÀÌ³ª´ÂÁö ±¸ÇÔ time1ÀÌ time2º¸´Ù Å©¸é(¹Ì·¡¸é) minus(-)
function getMonthInterval(time1,time2) { //measureMonthInterval(time1,time2)
   var date1 = toTimeObject(time1);
   var date2 = toTimeObject(time2);

   var years  = date2.getFullYear() - date1.getFullYear();
   var months = date2.getMonth() - date1.getMonth();
   var days   = date2.getDate() - date1.getDate();

   return (years * 12 + months + (days >= 0 ? 0 : -1) );
}

// µÎ TimeÀÌ ¸çÄ¥ Â÷ÀÌ³ª´ÂÁö ±¸ÇÔ time1ÀÌ time2º¸´Ù Å©¸é(¹Ì·¡¸é) minus(-)
function getDayInterval(time1,time2) {
   var date1 = toTimeObject(time1);
   var date2 = toTimeObject(time2);
   var day   = 1000 * 3600 * 24; //24½Ã°£

   return parseInt((date2 - date1) / day, 10);
}

// µÎ TimeÀÌ ¸î ½Ã°£ Â÷ÀÌ³ª´ÂÁö ±¸ÇÔ time1ÀÌ time2º¸´Ù Å©¸é(¹Ì·¡¸é) minus(-)
function getHourInterval(time1,time2) {
    var date1 = toTimeObject(time1);
    var date2 = toTimeObject(time2);
    var hour  = 1000 * 3600; //1½Ã°£

    return parseInt((date2 - date1) / hour, 10);
}

// ÇöÀç ½Ã°¢À» Time Çü½ÄÀ¸·Î ¸®ÅÏ
function getCurrentTime() {
    return toTimeString(new Date());
}

// ÇöÀç ½Ã°¢°ú y³â m¿ù dÀÏ h½Ã Â÷ÀÌ³ª´Â TimeÀ» ¸®ÅÏ
function getRelativeTime(y,m,d,h) {
   var date = new Date();

   date.setFullYear(date.getFullYear() + y); //y³âÀ» ´õÇÔ
   date.setMonth(date.getMonth() + m);       //m¿ùÀ» ´õÇÔ
   date.setDate(date.getDate() + d);         //dÀÏÀ» ´õÇÔ
   date.setHours(date.getHours() + h);       //h½Ã¸¦ ´õÇÔ

   return toTimeString(date);
}

// ÇöÀç Ò´À» YYYYÇü½ÄÀ¸·Î ¸®ÅÏ
function getYear() {
   var now = new Date();
   return now.getFullYear();
}

// ÇöÀç êÅÀ» MMÇü½ÄÀ¸·Î ¸®ÅÏ
function getMonth() {
   var now = new Date();
   var month = now.getMonth() + 1; // 1¿ù=0,12¿ù=11ÀÌ¹Ç·Î 1 ´õÇÔ
   if (("" + month).length == 1) { month = "0" + month; }
   return month;
}

// ÇöÀç ìíÀ» DDÇü½ÄÀ¸·Î ¸®ÅÏ
function getDay() {
   var now = new Date();

   var day = now.getDate();
   if (("" + day).length == 1) { day = "0" + day; }

   return day;
}

// ÇöÀç ãÁ¸¦ HHÇü½ÄÀ¸·Î ¸®ÅÏ
function getHour() {
    var now = new Date();

    var hour = now.getHours();
    if (("" + hour).length == 1) { hour = "0" + hour; }

    return hour;
}

/**
 * ¿À´ÃÀÌ ¹«½¼ ¿äÀÏÀÌ¾ß?

 * ex) alert('¿À´ÃÀº ' + getDayOfWeek() + '¿äÀÏÀÔ´Ï´Ù.');
 * Æ¯Á¤ ³¯Â¥ÀÇ ¿äÀÏÀ» ±¸ÇÏ·Á¸é? => ¿©·¯ºÐÀÌ Á÷Á¢ ¸¸µé¾î º¸¼¼¿ä.
 */
function getDayOfWeek() {
   var now = new Date();

   var day = now.getDay(); //ÀÏ¿äÀÏ=0,¿ù¿äÀÏ=1,...,Åä¿äÀÏ=6
   var week = new Array('ÀÏ','¿ù','È­','¼ö','¸ñ','±Ý','Åä');

   return week[day];
}
