/*
¼Ò½º¼³¸í : °øÅëÀ¸·Î »ç¿ë ÇÏ´Â ÀÚ¹Ù½ºÅ©¸³Æ® ÇÔ¼ö ¸ðÀ½
ÀÛ¼ºÀÚ : ¾Èº´±Ç
ÀÛ¼ºÀÏ : 2006.10.30 (¿ù)
°³Á¤ÀÏÀÚ : 2006.10.30 (¿ù) ÃÖÃÊ ÀÛ¼º.
*/



// ÀÚ·á¿¡ °ø¹éÀÌ ÀÖ´ÂÁö Ã¼Å©

function IsEmpty(data) {
  for (var i=0;i<data.length;i++) { if (data.substring(i,i+1) != " ") return false;  }   
  return true; 
}



// ÇØ´ç ¹®ÀÚ°¡ ÀÖ´ÂÁö Ã¼Å©

function chk_string(str, word) {
  var chk = str.indexOf(word);
  if (chk > -1) return true;              
  else  return false; 
}



// ÀÚ·á°¡ ¿µ¹®,¼ýÀÚ·Î¸¸ ÀÌ·ç¾î Á³´ÂÁö Ã¼Å©

function IsAlphaNumeric(checkStr) {
  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789";
  for (i = 0; i < checkStr.length; i++ ) {
	ch = checkStr.charAt(i);
	for (j = 0; j < checkOK.length; j++)  if (ch == checkOK.charAt(j)) break;
 	if (j == checkOK.length) { 
	    return false;
		break;
	}
  }
  return true; 
}



// ÀÚ·á°¡ ¿µ¹® ·Î¸¸ ÀÌ·ç¾î Á³´ÂÁö Ã¼Å©

function IsAlpha(checkStr) {
  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
  for (i = 0; i < checkStr.length; i++ ) {
	ch = checkStr.charAt(i);
	for (j = 0; j < checkOK.length; j++)  if (ch == checkOK.charAt(j)) break;
 	if (j == checkOK.length) { 
	    return false;
		break;
	}
  }
  return true; 
}



// ÀÚ·á°¡ ¿µ¹®,ÇÑ±Û ·Î¸¸ ÀÌ·ç¾î Á³´ÂÁö Ã¼Å©

function IsAlphaHangul(checkStr) {
  
  for (i=0; i < checkStr.length; i++) {
	
	ch = checkStr.charAt(i);    
	if ( (ch >= '0' && ch <= '9') || !((ch >= 'a' && ch <='z') || (ch == '_') || (ch < 255) || (ch > 0) || (ch >= '°¡' && ch <= 'ÆR')) ) {
	    return false;
		break;     
    }
  }
  
  return true;
}



// ÀÚ·á°¡ ¼ýÀÚÀÎÁö Ã¼Å©

function checkDigit(tocheck) {
  var isnum = true;
  if ((tocheck ==null) || (tocheck == "")) {
       isnum = false;
       return isnum; 
  }

  for (var j= 0 ; j< tocheck.length; j++ ) {
       if ( ( tocheck.substring(j,j+1) != "0" ) &&
            ( tocheck.substring(j,j+1) != "1" ) &&
            ( tocheck.substring(j,j+1) != "2" ) &&
            ( tocheck.substring(j,j+1) != "3" ) &&
            ( tocheck.substring(j,j+1) != "4" ) &&
            ( tocheck.substring(j,j+1) != "5" ) &&
            ( tocheck.substring(j,j+1) != "6" ) &&
            ( tocheck.substring(j,j+1) != "7" ) &&
            ( tocheck.substring(j,j+1) != "8" ) &&
            ( tocheck.substring(j,j+1) != "9" ) ) {
            isnum = false; }  
   }
   return isnum; 
}



// ÀÚ·á°¡ ¼ýÀÚ, ¼Ò¼öÁ¡ - ÀÎÁö Ã¼Å©

function checkDigit_point(tocheck) {
  var isnum = true;
  if ((tocheck ==null) || (tocheck == "")) {
       isnum = false;
       return isnum; 
  }

  for (var j= 0 ; j< tocheck.length; j++ ) {
       if ( ( tocheck.substring(j,j+1) != "0" ) &&
            ( tocheck.substring(j,j+1) != "1" ) &&
            ( tocheck.substring(j,j+1) != "2" ) &&
            ( tocheck.substring(j,j+1) != "3" ) &&
            ( tocheck.substring(j,j+1) != "4" ) &&
            ( tocheck.substring(j,j+1) != "5" ) &&
            ( tocheck.substring(j,j+1) != "6" ) &&
            ( tocheck.substring(j,j+1) != "7" ) &&
            ( tocheck.substring(j,j+1) != "8" ) &&
            ( tocheck.substring(j,j+1) != "9" ) &&
            ( tocheck.substring(j,j+1) != "-" ) &&
            ( tocheck.substring(j,j+1) != "." ) ) {
            isnum = false; }  
   }
   return isnum; 
}



// ÀÚ·á°¡ ¼ýÀÚ, ÄÞ¸¶ ÀÎÁö Ã¼Å©

function checkDigit_comma(tocheck) {
  var isnum = true;
  if ((tocheck ==null) || (tocheck == "")) {
       isnum = false;
       return isnum; 
  }

  for (var j= 0 ; j< tocheck.length; j++ ) {
       if ( ( tocheck.substring(j,j+1) != "0" ) &&
            ( tocheck.substring(j,j+1) != "1" ) &&
            ( tocheck.substring(j,j+1) != "2" ) &&
            ( tocheck.substring(j,j+1) != "3" ) &&
            ( tocheck.substring(j,j+1) != "4" ) &&
            ( tocheck.substring(j,j+1) != "5" ) &&
            ( tocheck.substring(j,j+1) != "6" ) &&
            ( tocheck.substring(j,j+1) != "7" ) &&
            ( tocheck.substring(j,j+1) != "8" ) &&
            ( tocheck.substring(j,j+1) != "9" ) &&
            ( tocheck.substring(j,j+1) != "," ) ) {
            isnum = false; }  
   }
   return isnum; 
}



// ÀÚ·á°¡ ¼ýÀÚ, ¼Ò¼öÁ¡, ÄÞ¸¶ ÀÎÁö Ã¼Å©

function checkDigit_point_comma(tocheck) {
  var isnum = true;
  if ((tocheck ==null) || (tocheck == "")) {
       isnum = false;
       return isnum; 
  }

  for (var j= 0 ; j< tocheck.length; j++ ) {
       if ( ( tocheck.substring(j,j+1) != "0" ) &&
            ( tocheck.substring(j,j+1) != "1" ) &&
            ( tocheck.substring(j,j+1) != "2" ) &&
            ( tocheck.substring(j,j+1) != "3" ) &&
            ( tocheck.substring(j,j+1) != "4" ) &&
            ( tocheck.substring(j,j+1) != "5" ) &&
            ( tocheck.substring(j,j+1) != "6" ) &&
            ( tocheck.substring(j,j+1) != "7" ) &&
            ( tocheck.substring(j,j+1) != "8" ) &&
            ( tocheck.substring(j,j+1) != "9" ) &&
            ( tocheck.substring(j,j+1) != "." ) &&
            ( tocheck.substring(j,j+1) != "," ) ) {
            isnum = false; }  
   }
   return isnum; 
}


// ¼ýÀÚ¸¸ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.

function selnumber(f) {

  if (IsEmpty(f.value) == true)  return  false;
	 
  if (!checkDigit(f.value) == true) { 
      alert("¼ýÀÚ¸¸ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
	   f.value = '0';
      f.focus();
      return false; 
  }

}



//3ÀÚ¸® ´ÜÀ§·Î ÄÞ¸¶ »ðÀÔÇÏ±âÀü Æû°ª Ã¼Å©
//onblur="comma(ÆûÀÌ¸§.ÆûÇÊµå)" ½ÄÀ¸·Î input Çü½Ä¿¡ »ðÀÔ

function comma(f) {

  if (IsEmpty(f.value) == true)  return  false;
	 
  if (!checkDigit_comma(f.value) == true) { 
      alert("¼ýÀÚ¸¸ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
	  f.value = '';
      f.focus();
      return false; 
  }

  var price, tmp;
  price = f.value;
  tmp = price.replace(/,/g, "");
  f.value = commaNum(tmp);  

}


//3ÀÚ¸® ´ÜÀ§·Î ÄÞ¸¶ »ðÀÔÇÏ±â

function commaNum(num) {  
  if (num < 0) { num *= -1; var minus = true} 
  else var minus = false 
         
  var dotPos = (num+"").split(".") 
  var dotU = dotPos[0] 
  var dotD = dotPos[1] 
  var commaFlag = dotU.length%3 

  if (commaFlag) { 
      var out = dotU.substring(0, commaFlag)  
      if (dotU.length > 3) out += "," 
  } 
  else var out = "" 

  for (var i=commaFlag; i < dotU.length; i+=3) { 
       out += dotU.substring(i, i+3)  
       if( i < dotU.length-3) out += "," 
  } 

  if (minus) out = "-" + out 
  if (dotD) return out + "." + dotD 
  else return out  
} 


// ÁÖ¹Î¹øÈ£ Ã¹Â°ÀÚ¸® 6ÀÚ¸® ÀÔ·Â½Ã ´ÙÀ½À¸·Î Æ÷Ä¿½º ÀÌµ¿ ½ÃÅ°±â

function juminNextFocus (f1,f2) {
  
  if (f1.value.length == 6)  f2.focus();

}


// ÁÖ¹Î¹øÈ£ Ã¼Å©

function CheckJuminNo(f1, f2) {

  var strresidentno1 = f1.value;
  var strresidentno2 = f2.value;

  if (strresidentno1.length < 6) {
      alert ("ÁÖ¹Îµî·Ï¹øÈ£ ±æÀÌ°¡ Á¤È® ÇÏÁö ¾Ê½À´Ï´Ù.");
      f1.focus();
      return false; 
  }

  if (strresidentno2.length < 7 ) {
      alert ("ÁÖ¹Îµî·Ï¹øÈ£ ±æÀÌ°¡ Á¤È® ÇÏÁö ¾Ê½À´Ï´Ù.");
      f2.focus();
      return false; 
  } 

  var strresidentno = strresidentno1 + strresidentno2;
  var strA, strB, strC, strD, strE, strF, strG, strH, strI, strJ, strK, strL, strM, strN, strO;
  var nCalA, nCalB, nCalC; 

  strA = strresidentno.substr(0, 1);
  strB = strresidentno.substr(1, 1);
  strC = strresidentno.substr(2, 1);
  strD = strresidentno.substr(3, 1);
  strE = strresidentno.substr(4, 1);
  strF = strresidentno.substr(5, 1);
  strG = strresidentno.substr(6, 1);
  strH = strresidentno.substr(7, 1);
  strI = strresidentno.substr(8, 1);
  strJ = strresidentno.substr(9, 1); 
  strK = strresidentno.substr(10, 1);
  strL = strresidentno.substr(11, 1);
  strM = strresidentno.substr(12, 1);            

  strO = strA*2 + strB*3 + strC*4 + strD*5 + strE*6 + strF*7 + strG*8 + strH*9 + strI*2 + strJ*3 + strK*4 + strL*5;

  nCalA = eval(strO);
  nCalB = nCalA % 11;
  nCalC = 11 - nCalB;
  nCalC = nCalC % 10; 

  strv = '19';
  strw = strresidentno.substr(0, 2);
  strx = strresidentno.substr(2, 2);
  stry = strresidentno.substr(4, 2);      	

  strz = strv + strw;

  if ((strz % 4 == 0) && (strz % 100 != 0) || (strz % 400 == 0)) {	yunyear = 29;  }
  else yunyear = 28;       	

  if ((strx <= 0) || (strx > 12)) {
       alert("»ý³â¿ùÀÏÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù.");
       f1.focus();
       return false; 
  }

  if ((strx == 1 || strx == 3 || strx == 5 || strx == 7 || strx == 8 || strx == 10 || strx == 12) && (stry > 31 || stry <= 0)) {
      alert("»ý³â¿ùÀÏÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù.");
      f1.focus();
      return false; 
  }

  if ((strx == 4 || strx == 6 || strx == 9 || strx == 11) && (stry > 30 || stry <= 0)) {
	  alert("»ý³â¿ùÀÏÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù.");
      f1.focus();
      return false; 
  }

  if (strx == 2 && (stry > yunyear || stry <= 0)) {
      alert(strz + "»ý³â¿ùÀÏÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù." + yunyear);
      f1.focus();
      return false;  
  }

  if (!((strG == 1) || (strG == 2) || (strG == 3) || (strG ==4))) {
	  alert("ÁÖ¹Îµî·Ï¹øÈ£ µÞÀÚ¸®ÀÇ ½ÃÀÛÀº 1 ~ 4 ÀÌ¿©¾ß ÇÕ´Ï´Ù.");
      f2.focus();
      return false;  
  }

  if (nCalC != strM) { 
	  alert("ÁÖ¹Îµî·Ï¹øÈ£°¡ ±ÔÄ¢¿¡ ¾î±ß ³³´Ï´Ù.");
	  f1.focus();
	  return false;
  }
  
  return true;
}



// ÁÖ¹Î¹øÈ£ Ã¹Â°ÀÚ¸® ÀÔ·Â½Ã »ý³â¿ùÀÏ ¸ÂÃß±â

function fillBirth(birth,f1,f2,f3) {
  
  var tyear = '';
  var tmon = '';
  var tday = '';

  if (birth.length == 6) {
	  if (birth.substring(0,2) > "10")  tyear = "19" + birth.substring(0,2);
	  else  tyear = "20" + birth.substring(0,2);

     setSelect(f1, tyear);
     setSelect(f2, birth.substring(2,4));
     setSelect(f3, birth.substring(4,6));
  }

}



// ÁÖ¹Î¹øÈ£ µÎÂ°ÀÚ¸® ÀÔ·Â½Ã ¼ºº° Ã¤¿ì±â

function fillSex(jumin2, sexF) {

  if (jumin2.substring(0,1) == '1' || jumin2.substring(0,1) == '3')      sexF[0].checked = true;
  else if (jumin2.substring(0,1) == '2' || jumin2.substring(0,1) == '4') sexF[1].checked = true;

}


// Æ¯¼ö¹®ÀÚ Ã³¸®

function chspecial_char(mystr) { 
  
  var re, sq, bs, dq;

  mystr = mystr.replace("/cR_/g", "\r\n");		
  mystr = mystr.replace("/sQ_/g", "'");
  mystr = mystr.replace("/bS_/g", "\\");
  mystr = mystr.replace("/dQ_/g", "\"");

  return mystr;

}


// ¸Þ½ÃÁö Ãâ·ÂÈÄ È®ÀÎ Å¬¸¯½Ã ÁöÁ¤µÈ ÆäÀÌÁö·Î ÀÌµ¿

function ask_movePage (msg, page) { 
  
  result = confirm(msg);

  if (result == true) {   
      window.location.href = page;
  }

}




// ¼±ÅÃÇÑ ÆäÀÌÁö ÁÖ¼Ò°¡ ÀÖÀ¸¸é ÇØ´ç ÆäÀÌÁö·Î ÀÌµ¿

function select_onchage_js (myurl) { 
  
  if (IsEmpty(myurl) == false) window.location.href = myurl;

}




 // ´Þ·Â _ text

function openCal(obj) {

  var top = event.clientY - 120;
  var left = event.clientX - 120;

  calLayer_show('/include/mycalendar.jsp?obj='+obj,top,left);
  
}




/*** ´Þ·Â ·¹ÀÌ¾î ÆË¾÷Ã¢ ¶ç¿ì±â ***/

function calLayer_show(url, po_top, po_lef) {
	w = 210;
	h = 160;

	var pixelBorder = 3;
	var titleHeight = 25;
	w += pixelBorder * 2;
	h += pixelBorder * 2 + titleHeight;

	var bodyW = document.body.clientWidth;
	var bodyH = document.body.clientHeight;

	var posX = (bodyW - w) / 2;
	var posY = (bodyH - h) / 2;

	calhiddenselect('hidden');

	// ¹é±×¶ó¿îµå 
	var obj = document.createElement("div");
	with (obj.style){
		position = "absolute";
		left = 0;
		top = 0;
		width = "100%";
		height = document.body.scrollHeight;
		//backgroundColor = "#000000";
		filter = "Alpha(Opacity=50)";
	}
	obj.id = "objPopupLayerBg";
	document.body.appendChild(obj);

	// ³»¿ëÇÁ·¹ÀÓ
	var obj = document.createElement("div");
	with (obj.style){
		position = "absolute";
		left = po_lef;
		top = po_top;
		width = w;
		height = h;
		border = "3px solid #5BB9CE";
	}
	obj.id = "objPopupLayer";
	document.body.appendChild(obj);

	// close ¹Ù ·¹ÀÌ¾î 
	var bottom = document.createElement("div");
	
	with (bottom.style){
		position = "absolute";
		width = w - pixelBorder * 2;
		height = titleHeight + 3;		
		left = 0;
		top = h - titleHeight - pixelBorder * 3;	
		padding = "7px 0 0 0";
		textAlign = "right";
		backgroundColor = "#EBEBEB";
		font = "bold 12px µ¸¿ò";
	}
	
	bottom.innerHTML = "<a href='javascript:calcloselayer()'><font color='#000000'>close</font></a>";
	obj.appendChild(bottom);

	// ¾ÆÀÌÇÁ·¹ÀÓ
	var ifrm = document.createElement("iframe");
	with (ifrm.style){
		width = w - 6;
		height = h - pixelBorder * 2 - titleHeight - 3;		
	}
	ifrm.frameBorder = 0;
	ifrm.marginwidth = 0;
	ifrm.marginheight = 0;
	ifrm.scrolling="no";
	ifrm.src = url;   // ¾ÆÀÌÇÁ·¹ÀÓ °æ·Î
	obj.appendChild(ifrm);
}


function calcloselayer() {
	calhiddenselect('visible');
	document.getElementById('objPopupLayer').removeNode(true);
	document.getElementById('objPopupLayerBg').removeNode(true);
}

function calhiddenselect(mode) {
	var obj = document.getElementsByTagName('select');
	for (i=0;i<obj.length;i++){
		obj[i].style.visibility = mode;
	}
}






// ¿ÀÇÂÃ¢À¸·Î ÆûÀü¼Û ÀÍ½º 5.0 ÀÌ»ó ¿¡¼­ Àû¿ë

function OpenPost (obj, url, wname, width, height) {

  var screenWidth  = screen.availwidth;
  var screenHeight = screen.availheight;

  var intLeft = (screenWidth - width) / 2;
  var intTop  = (screenHeight - height) / 2 
  
  var winopts = "scrollbars=no,resizable=no,top="+intTop+",left="+intLeft+",width="+width+",height="+height;
  window.open("", wname, winopts);
  obj.action = url;
  obj.target = wname;
  obj.submit(); 

}



// ÀüÀÚ¿ìÆí Ã¼Å©

function emailcheck(str){

  var i;
  var strEmail = str;
  var strCheck1 = false;
  var strCheck2 = false;
  var result = true;

  for (i=0; i < strEmail.length; i++) {
    if ((strEmail.substring(i,i+1) == "~") || (strEmail.substring(i,i+1) == ".") ||
        (strEmail.substring(i,i+1) == "_") || (strEmail.substring(i,i+1) == "-") ||
        ((strEmail.substring(i,i+1) >= "0") && (strEmail.substring(i,i+1) <= "9")) ||
        ((strEmail.substring(i,i+1) >= "@") && (strEmail.substring(i,i+1) <= "Z")) ||
        ((strEmail.substring(i,i+1) >= "a") && (strEmail.substring(i,i+1) <= "z"))) {
        if (strEmail.substring(i,i+1) == ".")  strCheck1 = true;
	    if (strEmail.substring(i,i+1) == "@")  strCheck2 = true;  
    }
    else {
        result = false;  
	    break;
    }
  }

  if ((strCheck1 == false) || (strCheck2 == false)) {
        result = false;  
  }

  return result;
}


// »ç¾÷ÀÚ¹øÈ£ ÀÔ·Â½Ã ´ÙÀ½À¸·Î Æ÷Ä¿½º ÀÌµ¿ ½ÃÅ°±â

function cnumNextFocus_a () {
  
  if (bform1.cnum1.value.length == 3)  bform1.cnum2.focus();

}

function cnumNextFocus_b () {
  
  if (bform1.cnum2.value.length == 2)  bform1.cnum3.focus();

}



// »ç¾÷ÀÚ¹øÈ£ Ã¼Å© Çü½Ä

function cnum_check(ThisVal1, ThisVal2, ThisVal3){
  var chkRule = "137137135";

  var strCorpNum = ThisVal1 + ThisVal2 + ThisVal3; // »ç¾÷ÀÚ¹øÈ£ 10ÀÚ¸®
  var step1, step2, step3, step4, step5, step6, step7;

  step1 = 0;			// ÃÊ±âÈ­

  for (i=0; i<7; i++) {
    step1 = step1 + (strCorpNum.substring(i, i+1) * chkRule.substring(i, i+1));
  }

  step2 = step1 % 10;
  step3 = (strCorpNum.substring(7, 8) * chkRule.substring(7, 8))% 10;
  step4 = strCorpNum.substring(8, 9) * chkRule.substring(8, 9);
  step5 = Math.round(step4 / 10 - 0.5);
  step6 = step4 - (step5 * 10);
  step7 = (10 - ((step2 + step3 + step5 + step6) % 10)) % 10;

  if (strCorpNum.substring(9, 10) != step7) return false;
  else return true;
}



// ¿ìÆí¹øÈ£ ¼±ÅÃÃ¢

function findPost(tmp_a, tmp_b, tmp_c, tmp_d) {

  var screenWidth  = screen.availwidth;
  var screenHeight = screen.availheight;

  var intLeft = (screenWidth - 380) / 2;
  var intTop  = (screenHeight - 417) / 2;

  window.open('/post_list.jsp?tmp_a='+tmp_a+'&tmp_b='+tmp_b+'&tmp_c='+tmp_c+'&tmp_d='+tmp_d, 'post_list', ('scrollbars=no,resizable=no,top='+intTop+',left='+intLeft+',width=380,height=417'));

} 



// Å¬¸³º¸µå¿¡ º¹»ç Ã³¸®

function copy_clipBoard(str) {
  window.clipboardData.setData('Text', str);
  window.alert("º¹»ç µÇ¾ú½À´Ï´Ù.");
}



// ¸ÞÀÎ ·Î±×ÀÎ Ã³¸®

function mainLogin() {

  if (IsEmpty(logForm.cid.value) == true) {
      alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
      logForm.cid.focus();
      return false;  
  }

  if (IsEmpty(logForm.pwd.value) == true) {
      alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
      logForm.pwd.focus();
      return false;  
  }

  show_wait_showLog();

  var params  = "cid=" + escape(logForm.cid.value) + "&pwd=" + escape(logForm.pwd.value)
	   params += "&saveId=" + logForm.saveId.value + "&ifsuper=N";
  new ajax.xhr.Request("/ajax_script/loginProcess.asp", params, loginResult, "POST");

  return false; 
 
} 





function loginResult(req) {

  if (req.readyState == 4) {
	  if (req.status == 200) {
			
			show_wait_hide();                
			 
			var docXML = req.responseXML;
			var code = docXML.getElementsByTagName("code").item(0).firstChild.nodeValue;   // ¿¡·¯ÄÚµå 
			

			if (code == '10') {
             window.alert('¾ÆÀÌµð ¶Ç´Â ºñ¹Ð¹øÈ£À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.');
         }
			else if (code == '20') {
             window.alert('ºñ¹Ð¹øÈ£°¡ ¸ÂÁö ¾Ê½À´Ï´Ù.');
				 logForm.pwd.value = '';
         }
			else if (code == '30') {
             window.alert('Å»ÅðµÈ È¸¿ø Á¤º¸ ÀÔ´Ï´Ù.');
				 logForm.pwd.value = '';
         }
			else if (code == '40') {
             window.alert('ÀÔ·ÂÇÑ »çÇ×ÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù.\n¾ÆÀÌµð ¶Ç´Â ºñ¹Ð¹øÈ£¸¦ È®ÀÎÇØ ÁÖ¼¼¿ä.');
				 logForm.cid.value = '';
				 logForm.pwd.value = '';
         }
			else if (code == '70') {
             window.alert('¿î¿µÀÚ ±ÇÇÑÀÌ ¾ø½À´Ï´Ù.');
				 logForm.cid.value = '';
				 logForm.pwd.value = '';
         }
			else if (code == '90') {
             
				 var returnUrl = docXML.getElementsByTagName("returnUrl").item(0).firstChild.nodeValue;   // ¸®ÅÏÁÖ¼Ò
				 parent.window.location.href = returnUrl;

         }
			else {
             window.alert('·Î±×ÀÎ ½ÇÆÐ! Àá½ÃÈÄ ÀÌ¿ëÇØ ÁÖ¼¼¿ä.');
         }			

     }
  }

}






// È¸¿øÀü¿ë ÆäÀÌÁö¸¦ ºñÈ¸¿øÀÌ Å¬¸¯ÇÒ¶§ Ã³¸®

function onlymember() {

  result = confirm('È¸¿øÀü¿ë¸Þ´º ÀÔ´Ï´Ù.\n·Î±×ÀÎ ÇÏ½Ã°Ú½À´Ï±î ?');

  if (result == true) { 
	  goLoginForm.submit();
  }

}




// ¸ÞÀÎ ·Î±×¾Æ¿ô Ã³¸®

function mainLogOut() {

  //result = confirm('·Î±×¾Æ¿ô ÇÏ½Ã°Ú½À´Ï±î?');

  //if (result == true) {   
      new ajax.xhr.Request("/ajax_script/LogOut.asp", null, logOutResult, "POST");
  //}

}


function directLogOut() {

  new ajax.xhr.Request("/ajax_script/LogOut.asp", null, logOutResult, "POST");

}


function logOutResult(req) {

  if (req.readyState == 4) {
	  if (req.status == 200) {

			var docXML = req.responseXML;
			var code = docXML.getElementsByTagName("code").item(0).firstChild.nodeValue;      // ¿¡·¯ÄÚµå        

         if (code == '99') {
				 top.window.location.href='/';
         }

     }
  }

}

// Ã¼Å©µÈ È¸¿ø¿¡°Ô ¸ÞÀÏ Àü¼Û

function c_semail () {

  var cnum = 0;
  cnum = ch_count();

  if (cnum < 1) {
      alert("¸ÞÀÏÀü¼ÛÇÒ È¸¿øÀ» ÇÑ¸í ÀÌ»ó ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
      return; 
  }
  
  show_wait_show();
  bform2.s_gubun.value = 'b';
  bform2.target = "_self";
  bform2.action = 'mail_send.php';
  bform2.submit();

}


// °Ë»öµÈ È¸¿ø¿¡°Ô ¸ÞÀÏ Àü¼Û

function s_semail() {
 
  show_wait_show();
  bform2.s_gubun.value = 'c';
  bform2.target = "_self";
  bform2.action = 'mail_send.php';
  bform2.submit();

}



// ¿øµµ¿ì Ã¢ ¿ÀÇÂ

function winOpen (doc, wname, top, left, width, height) {
  window.open(doc, wname, 'scrollbars=no,resizable=no,top='+top+',left='+left+',width='+width+',height='+height);
}


// ¿øµµ¿ì ÃÖ´ëÃ¢ ¿ÀÇÂ

function winOpenMax (doc, wname) {
  window.open(doc, wname, 'scrollbars=yes,toolbar=yes,location=yes,resizable=yes,status=yes,menubar=yes,resizable=yes,fullscreen=no');
}


// ¿øµµ¿ì Ã¢ ¿ÀÇÂ (ÇØ»óµµ¿¡ µû¶ó °¡¿îµ¥·Î ¿­±â)

function winOpenCenter (doc, wname, width, height) {

  var screenWidth  = screen.availwidth;
  var screenHeight = screen.availheight;

  var intLeft = (screenWidth - width) / 2;
  var intTop  = (screenHeight - height) / 2

  window.open(doc, wname, 'scrollbars=no,resizable=no,top='+intTop+',left='+intLeft+',width='+width+',height='+height);
}


// ¿øµµ¿ì Ã¢ ¿ÀÇÂ (½ºÅ©·Ñ, ÇØ»óµµ¿¡ µû¶ó °¡¿îµ¥·Î ¿­±â)

function winOpenCenterB (doc, wname, width, height) {

  var screenWidth  = screen.availwidth;
  var screenHeight = screen.availheight;

  var intLeft = (screenWidth - width) / 2;
  var intTop  = (screenHeight - height) / 2;

  window.open(doc, wname, 'scrollbars=yes,resizable=no,top='+intTop+',left='+intLeft+',width='+width+',height='+height);

}


// ¿ÀÇÂÃ¢À¸·Î ÆûÀü¼Û ÀÍ½º 5.0 ÀÌ»ó ¿¡¼­ Àû¿ë

function OpenPost (obj, url, wname, width, height) {

  var screenWidth  = screen.availwidth;
  var screenHeight = screen.availheight;

  var intLeft = (screenWidth - width) / 2;
  var intTop  = (screenHeight - height) / 2 
  
  var winopts = "scrollbars=no,resizable=no,top="+intTop+",left="+intLeft+",width="+width+",height="+height;
  window.open("", wname, winopts);
  obj.action = url;
  obj.target = wname;
  obj.submit(); 

}



function frameResize(obj) {
  
  try {
    
	 parent.document.getElementById(frames.name).style.height = this.document.body.scrollHeight;
    window.scrollTo(0,0);
  }
  catch (e) {}

}



function show_Iframe (posid, myid, width, src) {

  var str = "";

  str += "<iframe id=\"" + myid + "\" name=\"" + myid + "\" frameborder=\"0\" width=\"" + width + "\" height=\"0\" hspace=\"0\" vspace=\"0\" "
  str += "marginheight=\"0\" marginwidth=\"0\" scrolling=\"no\" onload=\"resizeIframe(this, " + myid + ")\" src=\"" + src + "\"></iframe>\n"

  document.getElementById(posid).innerHTML = str;

}



function toggle_Iframe (posid, myid, gu, src) {


    if (document.getElementById(myid) && toggleForm.gu.value == gu) {

        document.getElementById(posid).innerHTML = '';
	
	}
	else {

		 var str = "";

	    str += "<iframe id=\"" + myid + "\" name=\"" + myid + "\" frameborder=\"0\" width=\"570\" height=\"0\" hspace=\"0\" vspace=\"0\" "
	    str += "marginheight=\"0\" marginwidth=\"0\" scrolling=\"no\" onload=\"resizeIframe(this, " + myid + ")\" src=\"" + src + "\"></iframe>\n"

	    document.getElementById(posid).innerHTML = str;

    }

	toggleForm.gu.value = gu;

}



function resizeIframe(ifrm, myid) {
  obj = eval(myid);
  ifrm.setExpression('height', obj.document.body.scrollHeight);
  //ifrm.setExpression('width',myid.document.body.scrollWidth);

  //ifrm.setExpression('height',myid.document.body.scrollHeight + (myid.document.body.offsetHeight - myid.document.body.clientHeight));

}



function init_iframe(height) {
  reSize(height);
  setTimeout('init_iframe('+height+')', 200)
}


function reSize(height) {
  try {
    var objBody = ifrm.document.body;
    var objFrame = document.all["ifrm"];
    ifrmHeight = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight);

    if (ifrmHeight > height)  ifrmHeight = height;
		
    if (ifrmHeight > 0)  objFrame.style.height = ifrmHeight
    else  objFrame.style.height = 0;
    objFrame.style.width = '100%';
  }
  catch(e) {}
}



function init_iframeB(height) {
  reSizeB(height);
  setTimeout('init_iframeB('+height+')', 200)
}


function reSizeB(height) {
  try {
    var objBody = ifrm.document.body;
    var objFrame = document.all["ifrmB"];
    ifrmHeight = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight);

    if (ifrmHeight > height)  ifrmHeight = height;
		
    if (ifrmHeight > 0)  objFrame.style.height = ifrmHeight
    else  objFrame.style.height = 0;
    objFrame.style.width = '100%';
  }
  catch(e) {}
}







// ³¯Â¥º° select ¹Ù ¼³Á¤
function tdaySetChk(tyear, tmon, tday) {

  setSelect(bform1.sday_a, tyear);   //³âµµ¼³Á¤
  setSelect(bform1.sday_b, tmon);    //¿ù¼³Á¤
  setSelect(bform1.sday_c, tday);    //ÀÏ¼³Á¤

  setSelect(bform1.sday_e, "");      //³âµµ¼³Á¤
  setSelect(bform1.sday_f, "");      //¿ù¼³Á¤
  setSelect(bform1.sday_g, "");      //ÀÏ¼³Á¤

}




// ÀÌ¹øÁÖ, Áö³­ÁÖº°·Î select ¹Ù ¼³Á¤

function tweekSetChk(sday1, sday2, sday3, eday1, eday2, eday3) {

  setSelect(bform1.sday_a, sday1);   // ³âµµ¼³Á¤
  setSelect(bform1.sday_b, sday2);   // ¿ù¼³Á¤
  setSelect(bform1.sday_c, sday3);   // ÀÏ¼³Á¤

  setSelect(bform1.sday_e, eday1);   // ³âµµ¼³Á¤
  setSelect(bform1.sday_f, eday2);   // ¿ù¼³Á¤
  setSelect(bform1.sday_g, eday3);   // ÀÏ¼³Á¤

}


// ÀÌ¹øÁÖ, Áö³­ÁÖº°·Î select ¹Ù ¼³Á¤

function tweekSetChkB(sday1, sday2, sday3, eday1, eday2, eday3) {

  setSelect(bform0.sday_a, sday1);   // ³âµµ¼³Á¤
  setSelect(bform0.sday_b, sday2);   // ¿ù¼³Á¤
  setSelect(bform0.sday_c, sday3);   // ÀÏ¼³Á¤

  setSelect(bform0.sday_e, eday1);   // ³âµµ¼³Á¤
  setSelect(bform0.sday_f, eday2);   // ¿ù¼³Á¤
  setSelect(bform0.sday_g, eday3);   // ÀÏ¼³Á¤

}



// ¿ùº°·Î select ¹Ù ¼³Á¤

function tmonSetChk(sday1, sday2) {

  setSelect(bform1.sday_a, sday1);   // ³âµµ¼³Á¤
  setSelect(bform1.sday_b, sday2);   // ¿ù¼³Á¤
  setSelect(bform1.sday_c, '');      // ÀÏ¼³Á¤

  setSelect(bform1.sday_e, '');      // ³âµµ¼³Á¤
  setSelect(bform1.sday_f, '');      // ¿ù¼³Á¤
  setSelect(bform1.sday_g, '');      // ÀÏ¼³Á¤

}



// ÀüÃ¼ ³¯Â¥

function tAllDaySetChk() {

  setSelect(bform1.sday_a, '');   // ³âµµ¼³Á¤
  setSelect(bform1.sday_b, '');   // ¿ù¼³Á¤
  setSelect(bform1.sday_c, '');   // ÀÏ¼³Á¤

  setSelect(bform1.sday_e, '');   // ³âµµ¼³Á¤
  setSelect(bform1.sday_f, '');   // ¿ù¼³Á¤
  setSelect(bform1.sday_g, '');   // ÀÏ¼³Á¤

}



// select : select¿¡¼­ str°ªÀ» °¡Áø optionÀ» ¼±ÅÃµÇµµ·Ï ¼³Á¤

function setSelect(input,str) {
  
  for (i=0;i<input.options.length;i++) {
    if (input.options[i].value == str) input.options[i].selected=true;
  }

}


// select : selectÀÇ optionsµé ´Ù »èÁ¦ÇÏ´Â ¸Þ¼Òµå

function dropOptions(input)  {

  var len = input.length;
  for (var i=0; i<len; i++) input.options[0]=null;

}


// select : select¿¡¼­ ¼±ÅÃµÈ °ª ¸®ÅÏ

function getSelectedOption(obj) {
  
  var idx = obj.selectedIndex;
  var v_sel = obj.options[idx].value;
  return v_sel;

}


// radio, checkbox : str°ªÀ» °ªÀ» ¼±ÅÃµÇµµ·Ï ¼³Á¤

function setChecked (input, str) {
  
  for (i=0;i<input.length;i++) {
    if (input[i].value == str) input[i].checked = true;
  }

}


// ÀÚ¹Ù½ºÅ©¸³Æ® Ã¼Å©

function chkjava(str) {
  var chk = str.indexOf("<javascript");
  if (chk > -1) return true;              
  else  return false; 
}



// È®ÀåÀÚ Ã¼Å©

function chkExpansin(str) {
  var chk = str.indexOf(".");
  if (chk > -1) return true;              
  else  return false; 
}



function flashObj(src, w, h, id) { 

  html = '';
  html += '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"  codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0 id="'+id+'" width="'+w+'" align="center" height="'+h+'">\r\n';  
  html += '<param name="allowScriptAccess" value="alway">\r\n';  // fscommandÀû¿ëÇÃ·¡½¬ Ãß°¡ ÆÄ¶ó¹ÌÅÍ°ª
  html += '<param name="movie" value="'+src+'">\r\n'; 
  html += '<param name="quality" value="high">\r\n'; 
  html += '<param name="bgcolor" value="#ffffff">\r\n';
  html += '<param name="wmode" value="transparent">\r\n';		
  html += '<param name="menu" value="false">\r\n';  
  html += '<embed src="'+src+'" quality=high bgcolor="#ffffff" menu="false" width="'+w+'"  height="'+h+'" swliveconnect="true" id="'+id+'" name="param" align="center" allowScriptAccess="alway" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>\r\n'; 
  html += '</object>\r\n'; 
  
  document.write(html);

}



// ¹è¿­ »ý¼ºÀÚ

function makeArray(n) {
  
  this.length = n;
  for(var i=1; i <= n; i++) this[i] = "";
  return this;

}


// ¶óµð¿À ¹öÆ° °ª °¡Á®¿À±â

function get_radioValue (frm, strval) {
  
  var myval = '';

  for (var i=0; i < frm.elements.length; i++) {
    if (frm.elements[i].name == strval) {
        if (frm.elements[i].checked == true && frm.elements[i].disabled == false)  myval = frm.elements[i].value;
    }
  }

  return myval;
}





// ÀÏ·Ã¹øÈ£ ¸¸µé±â

function serialnm () {

  var today = new Date();
  var year  = today.getFullYear();
  var month = today.getMonth() + 1;
  var date  = today.getDate();
  var time  = today.getTime();

  if (parseInt(month) < 10) month = "0" + month;
 
  return year + "" + month + "" + date + "" + time;

}





// Ã·ºÎÆÄÀÏ ¾÷·Îµå Ã³¸®¿ë Å¸ÀÔ Å¬·¡½º
// flag (»èÁ¦¿©ºÎ): Á¤»ó N, »èÁ¦ D

function CItem(uid, type, folder, sfname, ofname, fsize, flag) { 
  
  this.uid = uid;
  this.type = type;
  this.folder = folder;
  this.sfname = sfname;
  this.ofname = ofname;
  this.fsize = fsize;
  this.flag = flag;

}




var FItem = new Array();

function Attack(type, folder, sfname, ofname, fsize) {

	var f = document.bform1;
	var len = FItem.length;

   FItem[len] = new CItem('', type, folder, sfname, ofname, fsize, 'N');

	addList(f.attack, ofname, len);

   show_file_size();

}



function AttackUp(uid, folder, sfname, ofname, fsize) {

	var f = document.bform1;
	var len = FItem.length;

   FItem[len] = new CItem(uid, 'F', folder, sfname, ofname, fsize, 'U');

	addList(f.attack, ofname, len);

}



function attach_delete(cnt) {
  
  var f = document.bform1;
  var idx = f.attack.selectedIndex;
	
  if (idx < 0) {
      window.alert('»èÁ¦ÇÒ ÆÄÀÏÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.');
	   return;
  }
  
  var n = eval(f.attack.options[idx].value);

  removeList(f.attack, idx);

  FItem[n].flag = "D";

  cal_upload_limit (cnt);

  show_file_size();

}



function show_file_size () {

  var totalsize = 0;

  for (var i=0; i < FItem.length; i++) {
    if (FItem[i].flag == 'N' || FItem[i].flag == 'U') totalsize += eval(FItem[i].fsize);
  }

  document.getElementById("attack_size").innerHTML = show_FileSize(totalsize);

}



// Á¦ÇÑ°¹¼ö ÀÌ»ó ¾÷·Îµå½Ã ¾÷·Îµå ÀÔ·ÂÃ¢ Á¦°Å

function cal_upload_limit (limit) {

  var cnt = 0;

  for (var i=0; i < FItem.length; i++) {
	 if (FItem[i].flag == 'N' || FItem[i].flag == 'U') cnt = cnt + 1;
  }

  if (cnt >= limit) document.getElementById("myupload").style.display = 'none';
  else document.getElementById("myupload").style.display = 'block';

}



function addList(target, text, value){

  var newOpt = document.createElement("OPTION");
  newOpt.text = text;	
  newOpt.value = value;
  target.options.add(newOpt);

}



function removeList(target, i) {
  target.remove(i);
}



// Ã·ºÎÆÄÀÏ °¹¼ö _ »èÁ¦´Â Á¦¿Ü

function upload_file_cnt () {

  var cnt = 0;

  if (FItem.length > 0) {

		for (var i=0; i < FItem.length; i++) {
        if (FItem[i].flag == "N" || FItem[i].flag == "U") cnt = cnt + 1;
		}

  }

  return cnt;

}



// ¿ë·®Ç¥½Ã

function show_FileSize (fsize) {
  
  var result = 0;

  if (eval(fsize) > 0) {
      if (eval(fsize) > 1024000) {
			 result = parseInt(Math.round((eval(fsize / 1024000) * 1000) / 1000, 2)) + " MB";
      }
		else if (eval(fsize) > 1024) {
			result = parseInt(Math.round((eval(fsize / 1024) * 10) / 10, 2)) + " KB";
      }
		else {
			result = fsize + " Byte";
      }
  }
  else {
      result = "0 Byte";
  }

  return result;

}



// Ã·ºÎÆÄÀÏ Á¤º¸ Àü¼ÛÀ§ÇØ ÅØ½ºÆ®¹Ú½º¿¡ ´ã¾Æ¼­ ¾×¼Ç ÆäÀÌÁö·Î Àü¼ÛÇÑ´Ù.

function get_upload_files () {

  if (FItem.length > 0) {

		for (var i=0; i < FItem.length; i++) {

		  var input = document.createElement('input');
		  input.type = 'hidden';
		  input.name = 'up_uid[]';
		  input.value = FItem[i].uid;
		  document.bform1.appendChild(input);

		  var input = document.createElement('input');
		  input.type = 'hidden';
		  input.name = 'up_type[]';
		  input.value = FItem[i].type;
		  document.bform1.appendChild(input);

		  var input = document.createElement('input');
		  input.type = 'hidden';
		  input.name = 'up_folder[]';
		  input.value = FItem[i].folder;
		  document.bform1.appendChild(input);

		  var input = document.createElement('input');
		  input.type = 'hidden';
		  input.name = 'up_sfname[]';
		  input.value = FItem[i].sfname;
		  document.bform1.appendChild(input);

		  var input = document.createElement('input');
		  input.type = 'hidden';
		  input.name = 'up_ofname[]';
		  input.value = FItem[i].ofname;
		  document.bform1.appendChild(input);

		  var input = document.createElement('input');
		  input.type = 'hidden';
		  input.name = 'up_fsize[]';
		  input.value = FItem[i].fsize;
		  document.bform1.appendChild(input);

		  var input = document.createElement('input');
		  input.type = 'hidden';
		  input.name = 'up_flag[]';
		  input.value = FItem[i].flag;
		  document.bform1.appendChild(input);

		}  //  for (var i=0; i

  }  //  if (FItem.length > 0) {

}




// ³¯Â¥°Ë»ö Ã³¸®

function sel_search_day(f1, f2, val_a, val_b) {

  f1.value = val_a;
  f2.value = val_b;

}



function toggleMenu(currMenu) {
  
  if (document.getElementById(currMenu)) {

      if (document.getElementById(currMenu).style.display == "block")  document.getElementById(currMenu).style.display = "none";
      else document.getElementById(currMenu).style.display = "block";

      return false;
  }
  else{ 
	   return true; 
  }

}




// ÄíÅ° ±Á±â

function setCookie(name, value, expiredays) {
  var todayDate = new Date();
  todayDate.setDate(todayDate.getDate() + expiredays);   
  document.cookie = name + "=" + escape(value) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}




// ½Ã°èÃâ·Â

function clock() {

	if (!document.layers && !document.all) return;
	
	var digital = new Date();
	var years = digital.getYear();
	var hours = digital.getHours();
	var minutes = digital.getMinutes();
	var seconds = digital.getSeconds();
	var amOrPm = "AM";
	
	if (hours > 11) amOrPm = "PM";
	if (hours > 12) hours = hours - 12;
	if (hours == 0) hours = 12;
	if (minutes <= 9) minutes = "0" + minutes;
	if (seconds <= 9) seconds = "0" + seconds;

	dispTime = hours + ":" + minutes + ":" + seconds + " " + amOrPm;
	
	if (document.layers) {
		 document.layers.pendule.document.write(dispTime);
		 document.layers.pendule.document.close();
	}
	//else if (document.all) pendule.innerHTML = digital.getYear()+ "/" + (digital.getMonth() + 1) + "/"  + digital.getDate() + " " + dispTime;
	else if (document.all) pendule.innerHTML = (digital.getMonth() + 1) + "¿ù" + digital.getDate() + "ÀÏ " + dispTime;

	setTimeout("clock()", 1000);
}




function cal_byte(aquery, f1, f2, maxStr) {

  var tmpStr;
  var temp=0;
  var onechar;
  var tcount;
  tcount = 0;
   
  if (aquery == '')  aquery = f1.value;

  tmpStr = new String(aquery);
  temp = tmpStr.length;

  for (k=0; k < temp; k++) {
    onechar = tmpStr.charAt(k);
    if (escape(onechar).length > 4) tcount += 2;
    else if (onechar != '\r')       tcount++;
  }

  f2.value = tcount;
  if (tcount > maxStr) {
      reserve = tcount - maxStr;
      alert("³»¿ëÀº "+maxStr+" ¹ÙÀÌÆ® ÀÌ»óÀº ÀÔ·Â ÇÒ ¼ö ¾ø½À´Ï´Ù.\r\nÀÔ·ÂÇÑ ³»¿ëÀº "+reserve+"¹ÙÀÌÆ®°¡ ÃÊ°úµÇ¾ú½À´Ï´Ù.\r\n ÃÊ°úµÈ ºÎºÐÀº ÀÚµ¿À¸·Î »èÁ¦µË´Ï´Ù."); 
      nets_check(f1, f2, maxStr);
      return false;
  } 

}

 

function nets_check(f1, f2, maxStr) {

  var tmpStr;
  var temp = 0;
  var onechar;
  var tcount;
  tcount = 0;
    
  tmpStr = new String(f1.value);
  temp = tmpStr.length;

  for (k=0;k<temp;k++) {
    onechar = tmpStr.charAt(k);
        
    if (escape(onechar).length > 4)  tcount += 2;
    else if (onechar != '\r')        tcount++;

  if (tcount > maxStr) {
        tmpStr = tmpStr.substring(0, k); 
        break;
    }
  }
    
  f1.value = tmpStr;
  cal_byte(tmpStr, f1, f2, maxStr);
 
  return tmpStr;

}



// trim ÇÔ¼ö 

function trim(str){
  
  // Á¤±Ô Ç¥Çö½ÄÀ» »ç¿ëÇÏ¿© È­ÀÌÆ®½ºÆäÀÌ½º¸¦ ºó¹®ÀÚ·Î ÀüÈ¯
  str = str.replace(/^\s*/,'').replace(/\s*$/, ''); 
  return str;

} 



// ÆûÀü¼ÛÀü °ø¹éÁ¦°Å 

function all_textForm_trim(frm) {

  for (var i = 0; i < frm.elements.length; i++) {
    if (frm.elements[i].type == "text") {
        frm.elements[i].value = trim(frm.elements[i].value);
	 }
  }

}


// È®ÀåÀÚ ¸®ÅÏ

function findExtension(fname) {
  
  //var s = fname.lastIndexOf("\\");
  var m = fname.lastIndexOf(".");
  var e = fname.length;
  //var filename = fname.substring(s+1,m);
  var extname = fname.substring(m+1, e);
  
  return extname;

} 


// Æ¯Á¤¿µ¿ª¸¸ ÇÁ¸°Æ®

function printDiv () {
  if (document.all && window.print) {
      window.onbeforeprint = beforeDivs;
      window.onafterprint = afterDivs; 
      window.print();
   }
}

function beforeDivs () {
  if (document.all) {
      objContents.style.display = 'none';
      objSelection.innerHTML = document.all['d1'].innerHTML;
  }
}

function afterDivs () {
  if (document.all) {
      objContents.style.display = 'block';
      objSelection.innerHTML = "";
  }
}


// ¼±ÅÃÇÑ °´Ã¼ÀÇ Àý´ëÀ§Ä¡ 
// o Å¬·¡½º ¾ÆÀÌµð

function getRealOffsetLeft(o) { 
  
  return o ? o.offsetLeft + getRealOffsetLeft(o.offsetParent) : 0; 

} 

function getRealOffsetTop(o) { 

  return o ? o.offsetTop + getRealOffsetTop(o.offsetParent) : 0; 

} 



// ¸ÞÀÏ µµ¸ÞÀÎ Ã³¸®¹× ÇÑ¸ÞÀÏ Ã³¸®

function fillaccount(f1, f2) {

  if (f1.value != '') {
      if (f2.value.toLowerCase() == "hanmail.net") {
			 alert('ÇÑ¸ÞÀÏÀº ¿Â¶óÀÎ ¿ìÇ¥Á¦ ½ÃÇàÀ¸·Î »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.');
			 f2.value = '';
			 f2.focus();
      }
		else {
          chkmyEmail();
		}

      f2.value = f1.value;  
  }
  else {
  }

}


function flashObj(src,w,h,id) { 

  html = '';
  html += '<object type="application/x-shockwave-flash"  classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"  codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0 id="'+id+'" width="'+w+'" align="center" height="'+h+'">';  
  html += '<param name="allowScriptAccess" value="alway" />';//fscommandÀû¿ëÇÃ·¡½¬ Ãß°¡ ÆÄ¶ó¹ÌÅÍ°ª
  html += '<param name="movie" value="'+src+'" />'; 
  html += '<param name="quality" value="high" />'; 
  html += '<param name="bgcolor" value="#ffffff" />';
  html += '<param name="wmode" value="transparent" />';		
  html += '<param name="menu" value="false" />';  
  html += '<embed src="'+src+'" quality=high bgcolor="#ffffff" menu="false" width="'+w+'"  height="'+h+'" swliveconnect="true" id="'+id+'" name="param" align="center" allowScriptAccess="alway" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> <\/embed>'; 
  html += '<\/object>'; 
  
  document.write(html);

}



function topbtn_layer () { 

  var screenWidth  = screen.availwidth;
  var mypos = 926
  if (screenWidth == 1152)  mypos = 1000
  else if (screenWidth == 1280)  mypos = 1056

  str = '';
  str += '<div id="topslide" style="position:absolute;left:'+mypos+'px;visibility:visible;">';  
  str += '<table width="10" border="0" cellspacing="0" cellpadding="0">';
  str += '<tr><td><a href="#" onFocus="blur();"><img class="PNG24" src="/images/main/btn_top.png"></a></td></tr>'; 
  str += '</table>'; 
  str += '</div>';
  
  document.write(str);

}



// ¿À´Ã³¯Â¥

function getToDay() {
   
  var date = new Date();
   
  var year  = date.getFullYear();
  var month = date.getMonth() + 1; // 1¿ù=0,12¿ù=11ÀÌ¹Ç·Î 1 ´õÇÔ
  var day   = date.getDate();
    
  if (("" + month).length == 1)  month = "0" + month;
  if (("" + day).length   == 1)  day   = "0" + day;
        
  return ("" + year + month + day)
    
}


function setPNG24(obj) { 
    obj.width=obj.height=1; 
    obj.className=obj.className.replace(/\bPNG24\b/i,''); 
    obj.style.filter = 
    "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');" 
    obj.src=''; 
    return ''; 
} 


// ½ºÅ©·Ñ 

function NvScroll() {
	this.version = "0.2";
	this.name = "NvScroll";
	this.divId = "list";
	this.item = new Array();
	this.itemcount = 0;
	this.currentspeed = 0;
	this.scrollspeed = 50;
	this.pausedelay = 1000;
	this.pausemouseover = false;
	this.stop = false;
	this.height = 100;
	this.width = 100;
	this.stopHeight=0;
	this.i=0;
	this.reloadData = 0;

	this.add = function () {
		var text = arguments[0];
		this.item[this.itemcount] = text;
		this.itemcount = this.itemcount + 1;
	};

	this.start = function () {
		if ( this.itemcount == 1 ) {
			this.add(this.item[0]);
		}
		this.display();
		this.currentspeed = this.scrollspeed;
		this.stop = true;
		setTimeout(this.name+'.scroll()',this.currentspeed);
		window.setTimeout(this.name+".stop = false", this.pausedelay);
	};
	
	this.display = function () {
        var htmlCode;
		htmlCode = '<div id="'+this.name+'" style="height:'+this.height+'; width:'+this.width+'; position:relative; overflow:hidden; " OnMouseOver="'+this.name+'.onmouseover(); " OnMouseOut="'+this.name+'.onmouseout(); ">';
		for(var i = 0; i < this.itemcount; i++) {
			htmlCode += '<div id="'+this.name+'item'+i+'"style="left:0px; width:'+this.width+'; position:absolute; top:'+(this.height*i)+'px; ">';
			htmlCode += this.item[i];
			htmlCode += '</div>';
		}
		htmlCode += '</div>';

        document.getElementById(this.divId).innerHTML=htmlCode;  
	};
	
	this.scroll = function () {
		if ( this.pause == true ) {
			window.setTimeout(this.name+".scroll()",this.pausedelay);
			this.pause = false;
		} else {
			this.currentspeed = this.scrollspeed;
			if ( !this.stop ) {
				for (var i = 0; i < this.itemcount; i++) {
					obj = document.getElementById(this.name+'item'+i).style;
					obj.top = parseInt(obj.top) - 1;
					if ( parseInt(obj.top) <= this.height * (-1) ) obj.top = this.height * (this.itemcount-1);
					if ( parseInt(obj.top) == 0 ) {
						this.currentspeed = this.pausedelay;
						this.i = i;
					}
				}
			}
            if( !this.stop && i == this.itemcount && parseInt(obj.top) == 0 && this.reloadData == 1 ) {
				this.reloadData = 0;
            }
            else {
				window.setTimeout(this.name+".scroll()",this.currentspeed);
            }
		}
	};
	
	this.rolling = function () {
		if ( this.stop == false  ) {
			this.next();
		}
		window.setTimeout(this.name+".rolling()",this.scrollspeed);
	}
	
	this.onmouseover = function () {
		this.stop = true;
	};
	
	this.onmouseout = function () {
		if ( this.pausemouseover ) {
			this.stop = false;
		}
	};
	
}


// ÀÌ¹ÌÁö ¸®»çÀÌÁî

function image_auto_resize(this_s,width,height){ 
 var ta_image = new Image(); 
 ta_image.src = this_s.src; 
  if(!width){this_s.removeAttribute('width'); 
  this_s.style.width='auto';} 
  else if(width < ta_image.width){ 
  this_s.width = width; 
  }else{ 
  this_s.width = ta_image.width; 
  } 
  if(!height){this_s.removeAttribute('height'); 
  this_s.style.height='auto';} 
  else if(height < ta_image.height){ 
  this_s.height = height; 
  }else{ 
  this_s.height = ta_image.height; 
  } 
} 



// ÀÌ¹ÌÁö preloading

function na_restore_img_src(name, nsdoc) {
  var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
  if (name == '')
    return;
  if (img && img.altsrc) {
    img.src    = img.altsrc;
    img.altsrc = null;
  } 
}

function na_preload_img() { 
  var img_list = na_preload_img.arguments;
  if (document.preloadlist == null) 
    document.preloadlist = new Array();
  var top = document.preloadlist.length;
  for (var i=0; i < img_list.length; i++) {
    document.preloadlist[top+i]     = new Image;
    document.preloadlist[top+i].src = img_list[i+1];
  } 
}

function na_change_img_src(name, nsdoc, rpath, preload) { 
  var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
  if (name == '')
    return;
  if (img) {
    img.altsrc = img.src;
    img.src    = rpath;
  } 
}


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_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();
}

function MM_showHideLayers() { //v6.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; 
  }
}

MM_reloadPage(true);
