/*******************************************************************************
* Æû À¯È¿¼º °Ë»ç¿¡ »ç¿ëµÇ´Â ÆÐÅÏ Á¤ÀÇ
*******************************************************************************/
var patterns = new Array();

patterns["num"]		= /^[0-9]+$/;
patterns["han"]		= /^[°¡-Èö]+$/;
patterns["eng"]		= /^[a-zA-Z]+$/;

patterns["eng_num"]	= /^[0-9a-zA-Z]+$/;

patterns["email"]	= /^[_a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+\.[a-zA-Z]+$/; 
patterns["url"]		= /^[\.a-zA-Z0-9-]+\.[a-zA-Z]+$/; 

patterns["img"]		= /.+(\.jpg|\.gif|\.bmp|\.png|\.jpeg)+$/gi;

// ÇöÀç¹®¼­°¡ ÇÁ·¹ÀÓ ¾È¿¡ ÀÖÁö ¾ÊÀ¸¸é
//if (parent.frames.length==0)
// ¸ÞÀÎÇÁ·¹ÀÓ ÆäÀÌÁöÀÎ index.html À¸·Î µ¹¾Æ°©´Ï´Ù
//window.location.replace('/') // ÇÁ·¹ÀÓ¼ÂÆäÀÌÁö·Î ¼³Á¤ ÇÏ¼¼¿ä


// ¿£ÅÍ¸¦ ´­·¶À»°æ¿ì Ã³¸®
function enter_event() {
	if(event.keyCode == 13 || event.keyCode == 11) {
		mLogin();
	}
}


// ÀÚ·á¿¡ °ø¹éÀÌ ÀÖ´ÂÁö Ã¼Å©
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 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) != "." ) ) {
            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; 
}



//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  
} 

//ÁÖ¹Î¹øÈ£ Ã¼Å© value
function CheckJuminNoValue(jumin1, jumin2) {

  var strresidentno1 = jumin1.value;
  var strresidentno2 = jumin2.value;

  if (strresidentno1.length < 6) {
      alert ("ÁÖ¹Îµî·Ï¹øÈ£ ±æÀÌ°¡ Á¤È®ÇÏÁö ¾Ê½À´Ï´Ù.!!");
      jumin1.focus();
      return false; 
  }

  if (strresidentno2.length < 7 ) {
      alert ("ÁÖ¹Îµî·Ï¹øÈ£ ±æÀÌ°¡ Á¤È®ÇÏÁö ¾Ê½À´Ï´Ù.!!");
      jumin2.focus();
      return false; 
  } 

  var strresidentno = jumin1.value + jumin2.value;
  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("»ý³â¿ùÀÏÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù.");
       jumin1.focus();
       return false; 
  }

  if ((strx == 1 || strx == 3 || strx == 5 || strx == 7 || strx == 8 || strx == 10 || strx == 12) && (stry > 31 || stry <= 0)) {
      alert("»ý³â¿ùÀÏÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù.");
      jumin1.focus();
      return false; 
  }

  if ((strx == 4 || strx == 6 || strx == 9 || strx == 11) && (stry > 30 || stry <= 0)) {
	  alert("»ý³â¿ùÀÏÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù.");
      jumin1.focus();
      return false; 
  }

  if (strx == 2 && (stry > yunyear || stry <= 0)) {
      alert(strz + "»ý³â¿ùÀÏÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù." + yunyear);
      jumin1.focus();
      return false;  
  }

  if (!((strG == 1) || (strG == 2) || (strG == 3) || (strG ==4))) {
	  alert("ÁÖ¹Îµî·Ï¹øÈ£ µÞÀÚ¸®ÀÇ ½ÃÀÛÀº 1 ~ 4 ÀÌ¿©¾ß ÇÕ´Ï´Ù.");
      jumin2.focus();
      return false;  
  }

  if (nCalC != strM) { 
	  alert("ÁÖ¹Îµî·Ï¹øÈ£°¡ ±ÔÄ¢¿¡ ¾î±ß³³´Ï´Ù.");
	  return false;
  }
  
  return true;
}


//ÁÖ¹Î¹øÈ£ Ã¼Å©
function CheckJuminNo() {

  var strresidentno1 = bform1.jumin1.value;
  var strresidentno2 = bform1.jumin2.value;

  if (strresidentno1.length < 6) {
      alert ("ÁÖ¹Îµî·Ï¹øÈ£ ±æÀÌ°¡ Á¤È®ÇÏÁö ¾Ê½À´Ï´Ù.!!");
      bform1.jumin1.focus();
      return false; 
  }

  if (strresidentno2.length < 7 ) {
      alert ("ÁÖ¹Îµî·Ï¹øÈ£ ±æÀÌ°¡ Á¤È®ÇÏÁö ¾Ê½À´Ï´Ù.!!");
      bform1.jumin2.focus();
      return false; 
  } 

  var strresidentno = bform1.jumin1.value + bform1.jumin2.value;
  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("»ý³â¿ùÀÏÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù.");
       bform1.jumin1.focus();
       return false; 
  }

  if ((strx == 1 || strx == 3 || strx == 5 || strx == 7 || strx == 8 || strx == 10 || strx == 12) && (stry > 31 || stry <= 0)) {
      alert("»ý³â¿ùÀÏÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù.");
      bform1.jumin1.focus();
      return false; 
  }

  if ((strx == 4 || strx == 6 || strx == 9 || strx == 11) && (stry > 30 || stry <= 0)) {
	  alert("»ý³â¿ùÀÏÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù.");
      bform1.jumin1.focus();
      return false; 
  }

  if (strx == 2 && (stry > yunyear || stry <= 0)) {
      alert(strz + "»ý³â¿ùÀÏÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù." + yunyear);
      bform1.jumin1.focus();
      return false;  
  }

  if (!((strG == 1) || (strG == 2) || (strG == 3) || (strG ==4))) {
	  alert("ÁÖ¹Îµî·Ï¹øÈ£ µÞÀÚ¸®ÀÇ ½ÃÀÛÀº 1 ~ 4 ÀÌ¿©¾ß ÇÕ´Ï´Ù.");
      bform1.jumin2.focus();
      return false;  
  }

  if (nCalC != strM) { 
	  alert("ÁÖ¹Îµî·Ï¹øÈ£°¡ ±ÔÄ¢¿¡ ¾î±ß³³´Ï´Ù.");
	  return false;
  }
  
  return true;
}



// ÁÖ¹Î¹øÈ£ Ã¼Å©2
function CheckJuminNo2() {

  var strresidentno1 = bform1.jumin3.value;
  var strresidentno2 = bform1.jumin4.value;

  if (strresidentno1.length < 6) {
      alert ("ÁÖ¹Îµî·Ï¹øÈ£ ±æÀÌ°¡ Á¤È®ÇÏÁö ¾Ê½À´Ï´Ù.!!");
      bform1.jumin1.focus();
      return false; 
  }

  if (strresidentno2.length < 7 ) {
      alert ("ÁÖ¹Îµî·Ï¹øÈ£ ±æÀÌ°¡ Á¤È®ÇÏÁö ¾Ê½À´Ï´Ù.!!");
      bform1.jumin2.focus();
      return false; 
  } 

  var strresidentno = bform1.jumin3.value + bform1.jumin4.value;
  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("»ý³â¿ùÀÏÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù.");
       bform1.jumin3.focus();
       return false; 
  }

  if ((strx == 1 || strx == 3 || strx == 5 || strx == 7 || strx == 8 || strx == 10 || strx == 12) && (stry > 31 || stry <= 0)) {
      alert("»ý³â¿ùÀÏÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù.");
      bform1.jumin3.focus();
      return false; 
  }

  if ((strx == 4 || strx == 6 || strx == 9 || strx == 11) && (stry > 30 || stry <= 0)) {
	  alert("»ý³â¿ùÀÏÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù.");
      bform1.jumin3.focus();
      return false; 
  }

  if (strx == 2 && (stry > yunyear || stry <= 0)) {
      alert(strz + "»ý³â¿ùÀÏÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù." + yunyear);
      bform1.jumin3.focus();
      return false;  
  }

  if (!((strG == 1) || (strG == 2) || (strG == 3) || (strG ==4))) {
	  alert("ÁÖ¹Îµî·Ï¹øÈ£ µÞÀÚ¸®ÀÇ ½ÃÀÛÀº 1 ~ 4 ÀÌ¿©¾ß ÇÕ´Ï´Ù.");
      bform1.jumin4.focus();
      return false;  
  }

  if (nCalC != strM) { 
	  alert("ÁÖ¹Îµî·Ï¹øÈ£°¡ ±ÔÄ¢¿¡ ¾î±ß³³´Ï´Ù.");
	  return false;
  }
  
  return true;
}



//ÁÖ¹Î¹øÈ£ Ã¹Â°ÀÚ¸® ÀÔ·Â½Ã »ý³â¿ùÀÏ Ã¤¿ì±â
function fillBirth(birth, f1,f2,f3) {
  
  if (birth.length == 6) {
	  if (birth.substring(0,2) > "10")  f1.value = "19" + birth.substring(0,2);
	  else  f1.value = "20" + birth.substring(0,2);
      f2.value = birth.substring(2,4);
      f3.value = birth.substring(4,6)
  }

}


//¿ÀÇÂÃ¢À¸·Î ÆûÀü¼Û ÀÍ½º 5.0 ÀÌ»ó ¿¡¼­ Àû¿ë
function OpenPost (obj, url, wname, top, left, width, height) {
  var winopts = "scrollbars=no,resizable=no,top="+top+",left="+left+",width="+width+",height="+height;
  window.open("", wname, winopts);
  obj.action = url;
  obj.target = wname;
  obj.submit(); 
}



//¿ÀÇÂÃ¢À¸·Î ¿¢¼¿Àü¼Û Àû¿ë
function openPostExcel (url, wname, top, left, width, height) {
  var winopts = "scrollbars=no,resizable=yes,top="+top+",left="+left+",width="+width+",height="+height;
  window.open("", wname, winopts);
  document.bform1.action = url;
  document.bform1.target = wname;
  document.bform1.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 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 day_jsend() {
  var syear = document.all.sday1.value;
  var smon  = document.all.sday2.value;
  var sday  = document.all.sday3.value;
  var eyear = document.all.eday1.value;
  var emon  = document.all.eday2.value;
  var eday  = document.all.eday3.value;

  if (syear == '' && smon == '' && sday == '' && eyear == '' && emon == '' && eday == '')       {  }
  else if (syear != '' && smon == '' && sday == '' && eyear == '' && emon == '' && eday == '')  {  }
  else if (syear == '' && smon != '' && sday == '' && eyear == '' && emon == '' && eday == '')  {  }
  else if (syear == '' && smon == '' && sday != '' && eyear == '' && emon == '' && eday == '')  {  }
  else if (syear != '' && smon != '' && sday == '' && eyear == '' && emon == '' && eday == '')  {  }
  else if (syear == '' && smon != '' && sday != '' && eyear == '' && emon == '' && eday == '')  {  }
  else if (syear != '' && smon != '' && sday != '' && eyear == '' && emon == '' && eday == '')  {  }
  else if (syear != '' && smon == '' && sday == '' && eyear != '' && emon == '' && eday == '')  {  }
  else if (syear != '' && smon != '' && sday == '' && eyear != '' && emon != '' && eday == '')  {  }
  else if (syear == '' && smon != '' && sday != '' && eyear == '' && emon != '' && eday != '')  {  }  
  else if (syear != '' && smon != '' && sday != '' && eyear != '' && emon != '' && eday != '')  {  }
  else {
	alert('³¯Â¥°Ë»ö ÁöÁ¤ÀÌ Àß¸øµÇ¾î ÀÖ½À´Ï´Ù.\n³¯Â¥ °Ë»ö¹æ¹ýÀ» Âü°í ÇÏ¼Å¿ä.');
    return false;
  } 
    
  bform1.submit();
}



//¿øµµ¿ì Ã¢ ¿ÀÇÂ
function winOpen (doc, wname, resize, top, left, width, height) {
  return window.open(doc, wname, 'scrollbars=no,resizable='+resize+',top='+top+',left='+left+',width='+width+',height='+height);
}

//¿øµµ¿ì Ã¢ ¿ÀÇÂ
function winOpen2 (doc, data1, data2, data3, data4, data5, top, left, width, height) {
  window.open(doc, data1, data2, data3, data4, data5, 'scrollbars=no,resizable=yes,top='+top+',left='+left+',width='+width+',height='+height);
}

function winOpen3 () {
url = "http://www.ccmbell.com/award.html" ;
window.open(url,'','toolbar=yes,menubar=yes,location=yes,directions=yes, scrollbars=yes,status=yes,width=1024,height=768');
}
// ÄíÅ° ±Á±â
/*
function setCookie(name, value, expiredays) {
  var todayDate = new Date();
  todayDate.setDate(todayDate.getDate() + expiredays);   
  document.cookie = name + "=" + escape(value) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
*/
//ÆË¾÷Ã¢ ¿ÀÇÂ  no ÇØ´ç ·¹ÄÚµå
function show_popup (no, top, left, width, height) {
  window.open('/mypopup.asp?no='+no, 'mypopup_'+no, 'scrollbars=no,resizable=yes,top='+top+',left='+left+',width='+width+',height='+height);
}

//ÀÌ¹ÌÁö ¹Ì¸®º¸±â  -------------------------------------------------------------------------

function r_show_pic(url, num) {
  document.images["pic"+num].style.display = "block";
  document.images["pic"+num].src = url;
}


function show_pic(f, num) {
  document.images["pic"+num].style.display = "block";
  document.images["pic"+num].src = f.value;
}


function show_pic2(pic) {
  window.open('show_pic.asp?fname='+pic, 'show_pic', ('scrollbars=no, resizable=no, top=80,left=80,width=1,height=1'));
}


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) {}
}

//ÀÌ¹ÌÁö ¹Ì¸®º¸±â  -----------------------------------------------------------------------



//³¯Â¥º° select ¹Ù ¼³Á¤
function tdaySetChk(tyear, tmon, tday) {

  if (bform1.term[0].checked == true || bform1.term[1].checked == true)  {

	  setSelect(bform1.sday1, tyear);   //³âµµ¼³Á¤
	  setSelect(bform1.sday2, tmon);    //¿ù¼³Á¤
	  setSelect(bform1.sday3, tday);    //ÀÏ¼³Á¤

	  setSelect(bform1.eday1, '');      //³âµµ¼³Á¤
	  setSelect(bform1.eday2, '');      //¿ù¼³Á¤
	  setSelect(bform1.eday3, '');      //ÀÏ¼³Á¤
  
  }

}


//ÀÌ¹øÁÖ, Áö³­ÁÖº°·Î select ¹Ù ¼³Á¤
function tweekSetChk(sday1, sday2, sday3, eday1, eday2, eday3) {

  if (bform1.term[2].checked == true || bform1.term[3].checked == true)  {

      setSelect(bform1.sday1, sday1);   //³âµµ¼³Á¤
      setSelect(bform1.sday2, sday2);   //¿ù¼³Á¤
      setSelect(bform1.sday3, sday3);   //ÀÏ¼³Á¤

      setSelect(bform1.eday1, eday1);   //³âµµ¼³Á¤
      setSelect(bform1.eday2, eday2);   //¿ù¼³Á¤
      setSelect(bform1.eday3, eday3);   //ÀÏ¼³Á¤

  }

}



//¿ùº°·Î select ¹Ù ¼³Á¤
function tmonSetChk(sday1, sday2) {

  if (bform1.term[4].checked == true)  {

      setSelect(bform1.sday1, sday1);   //³âµµ¼³Á¤
      setSelect(bform1.sday2, sday2);   //¿ù¼³Á¤
      setSelect(bform1.sday3, '');      //ÀÏ¼³Á¤

	  setSelect(bform1.eday1, '');      //³âµµ¼³Á¤
	  setSelect(bform1.eday2, '');      //¿ù¼³Á¤
	  setSelect(bform1.eday3, '');      //ÀÏ¼³Á¤

  }

}


//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;

}


// ·Î±×¾Æ¿ô Ã³¸®
function LogOut() {
  //window.location.href='/09_member/LogOut.asp';
} 


// ÀÚ¹Ù½ºÅ©¸³Æ® Ã¼Å©
function chkjava(str) {
  var chk = str.indexOf("<javascript");
  if (chk > -1) return true;              
  else  return false; 
}

// ³¯Â¥¿Í ½Ã°£À» °¡Á®¿À´Â ÇÔ¼ö
function GetTimeStamp() {

  var sStamp = "";

  TDate = new Date();

  CurYear  = TDate.getYear();
  CurMonth = TDate.getMonth();
  CurDay   = TDate.getDate();

  CurHour  = TDate.getHours();
  CurMin   = TDate.getMinutes();
  CurSec   = TDate.getSeconds();

  sStamp += ""+CurYear + CurMonth + CurDay + CurHour + CurMin + CurSec;

    return sStamp;
}

/* ---------------------------------------------------------------------- */
/*******************************************************************************
* ÀÌ¹ÌÁö Ã¼Å©
*******************************************************************************/
function isImg(str)
{
	if(str.match(patterns["img"]))
		return true;
	else
		return false;
}

/*******************************************************************************
* ¼ýÀÚ Ã¼Å©
*******************************************************************************/
function isNum(str)
{
	if(str.match(patterns["num"]))
		return true;
	else
		return false;
}

/*******************************************************************************
* ÇÑ±Û Ã¼Å©
*******************************************************************************/
function isHan(str)
{
	if(str.match(patterns["han"]))
		return true;
	else
		return false;
}

/*******************************************************************************
* ¿µ¹® Ã¼Å©
*******************************************************************************/
function isEng(str)
{
	if(str.match(patterns["eng"]))
		return true;
	else
		return false;
}

/*******************************************************************************
* ¿µ¹®¼ýÀÚ Ã¼Å©
*******************************************************************************/
function isEngNum(str)
{
	if(str.match(patterns["eng_num"]))
		return true;
	else
		return false;
}

/*******************************************************************************
* ¸ÞÀÏ Ã¼Å©
*******************************************************************************/
function isEmail(str)
{
	if(str.match(patterns["email"]))
		return true;
	else
		return false;
}

/*******************************************************************************
* URL Ã¼Å©
*******************************************************************************/
function isUrl(str)
{
	if(str.match(patterns["url"]))
		return true;
	else
		return false;
}

/*******************************************************************************
* °ø¹éÀÎÁö
*******************************************************************************/
function isEmpty(str)
{
	if(getLength(trim(str)) <= 0)
		return true;
	else
		return false;
}

/*******************************************************************************
* °ø¹éÁ¦°Å
*******************************************************************************/
function trim(str)
{
	return str.replace(/^\s+|\s+$/g, '');
}

/*******************************************************************************
* ¼ýÀÚ¸¸ °¡´É
*******************************************************************************/
function delChar(obj)
{
	obj.value = obj.value.replace(/[^0-9]+/g, "");
}

/*******************************************************************************
* Ã¼Å©¹Ú½º ¼±ÅÃ
*******************************************************************************/
var checkall_flag = false;

function checkAll(form, obj_name)
{
	var length = form.elements.length;

	for (var i = 0; i < length; i++)
	{
		if(form.elements[i].name == obj_name)
			form.elements[i].checked = !checkall_flag;
	}

	checkall_flag = !checkall_flag;
}

function checkEx(form, obj_name)
{
	var length = form.elements.length;

	for (var i = 0; i < length; i++)
	{
		if(form.elements[i].name == obj_name)
			form.elements[i].checked = !form.elements[i].checked;
	}
}


/*******************************************************************************
* Ã¼Å©¹Ú½º ¼±ÅÃµÇ¾î ÀÖ´ÂÁö
*******************************************************************************/
function isChecked(form, obj_name)
{
	var is_checked_flag = false;
	var length = form.elements.length;

	for (var i = 0; i < length; i++)
	{
		if(form.elements[i].name == obj_name && form.elements[i].checked == true)
		{
			is_checked_flag = true;
			break;
		}
	}

	return is_checked_flag;
}

/*******************************************************************************
* ¸Þ¼¼Áö ¹Ú½º ÃÊ±âÈ­
*******************************************************************************/
function checkMsg(obj)
{
	if(trim(obj.value) == "¿©±â¿¡ ¸Þ¼¼Áö¸¦ ÀÔ·ÂÇÏ¼¼¿ä.")
	{
		obj.value = "";											
	}
}

/*******************************************************************************
* ¹ÙÀÌÆ® Ã¼Å© 80bytes ÀÌ»ó
*******************************************************************************/
function checkBytes(form)
{
	var page = 0;
	var body_length = getLength(form.memo.value);
	
	form.bytes.value = body_length;
	
	if(body_length)
		page = parseInt(body_length / 80);

	if(body_length % 80)
		page += 1;

	if(typeof(form.page) != "undefined")
		form.page.value = page;
}

/*******************************************************************************
* ¹ÙÀÌÆ® Ã¼Å© 80bytes ±îÁö
*******************************************************************************/
function checkBytes2(form, max_length)
{
	var page = 0;
	var body_length = getLength(form.memo.value);
	
	if(body_length > max_length)
	{
		alert(max_length + "bytes ÀÌ»ó ÀÔ·ÂÇÒ ¼ö ¾ø½À´Ï´Ù.");
		form.body.value	= stringCut(form.memo.value, max_length);
		body_length		= getLength(form.memo.value);
	}

	if(body_length)
		page = parseInt(body_length / 80);

	if(body_length % 80)
		page += 1;

	if(typeof(form.page) != "undefined")
		form.page.value = page;

	form.bytes.value = body_length;
}

/*******************************************************************************
* MMS ¹ÙÀÌÆ® Ã¼Å© 
*******************************************************************************/
function checkMMSBytes(form, max_length)
{
	var body_length = getLength(form.msg.value);
	
	if(body_length > max_length)
	{
		alert(max_length + "bytes ÀÌ»ó ÀÔ·ÂÇÒ ¼ö ¾ø½À´Ï´Ù.");
		form.msg.value	= stringCut(form.msg.value, max_length);
		body_length		= getLength(form.msg.value);
	}

	form.msg_size.value = body_length;
}

/*******************************************************************************
* 80bytes¾¿.. Àß¶ó ¸®ÅÏ..
*******************************************************************************/
function getParseBodys(str)
{
	var bodys		= new Array();
	var length		= 0;
	var start_idx	= 0;

	for(var i = 0; i < str.length; i++)
	{
		if(escape(str.charAt(i)).length >= 4)
			length += 2;
		else
			if(escape(str.charAt(i)) != "%0D")
				length++;

		if(length >= 80 || i == str.length - 1)
		{
			if(length > 80)
				i--;

			bodys[bodys.length] = str.substring(start_idx, i + 1);
	
			length = 0;
			start_idx = i + 1;
		}
	}

	return bodys;
}

/*******************************************************************************
* ¹®ÀÚ¿­ ÀÚ¸£±â
*******************************************************************************/
function stringCut(str, max_length)
{
	var str, msg;
	var length = 0;
	var tmp;
	var count = 0;
	 
	length = str.length;

	for(var i = 0; i < length; i++)
	{
		tmp = str.charAt(i);
	
		if(escape(tmp).length > 4)
			count += 2;
		else
			if(escape(tmp) != "%0D")
				count++;

		if(count > max_length)
			break;		
	}
	
	return str.substring(0, i);
}

/*******************************************************************************
* ¹®ÀÚ¿­ ±æÀÌ¸¦ ¸®ÅÏÇÑ´Ù. 
*******************************************************************************/
function getLength(str) 
{
	var length = 0;

	for(var i = 0; i < str.length; i++)
	{
		if(escape(str.charAt(i)).length >= 4)
			length += 2;
		else
			if(escape(str.charAt(i)) != "%0D")
				length++;
	}	

	return length;
}

/*******************************************************************************
* ÄíÅ°°ª ¸®ÅÏ
* 
* name	-	ÄíÅ°¸í
*******************************************************************************/
/*function getCookie(name)
{
	var label = name + "=";
	var label_len = label.length;
	var cookie_len = document.cookie.length;
	var i = 0;

	while (i < cookie_len) 
	{
		var j = i + label_len;

		if (document.cookie.substring(i, j) == label) 
		{
			var cookie_end = document.cookie.indexOf(";", j);
			if (cookie_end == -1) 
				cookie_end = document.cookie.length;
		
			return unescape(document.cookie.substring(j, cookie_end));
		}
		i++;
	}
	return "";
}
*/
/*******************************************************************************
* ÄíÅ°¼³Á¤
* 
* name			-	ÄíÅ°¸í
* value			-	°ª
* expiredays	-	½Ã°£ (ÀÏ´ÜÀ§)
*******************************************************************************/
/*function setCookie( name, value, expiredays )
{
	var today = new Date();
	today.setDate( today.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + today.toGMTString() + ";";
}
*/
/*******************************************************************************
* ÀÌÅë»ç ¹øÈ£ Ã¼Å©
*
* str	- ÀüÈ­¹øÈ£
*******************************************************************************/
var tel = new Array("010", "011", "016", "017", "018", "019");

function isHandPhone(str)
{
	var flag = false;
	
	if(str.length > 9 && str.length < 12)
	{
		for(var i = 0; i < tel.length; i++)
		{
			if(str.substring(0, 3) == tel[i])
			{
				flag = true;
				break;
			}
		}
	}
	return flag;
}

/*******************************************************************************
* ÀÌ¸ðÆ¼ÄÜ Àû¿ë
*******************************************************************************/
function selectEmoticon(msg_no, obj)
{
	var form = document.msg_form;

	form.memo.value		= obj.value;
	form.msg_no.value	= msg_no;

	checkBytes(form);
}

function showHelpMsg(msg, top, left)
{
	document.all.show_help_msg.innerHTML = msg;

	document.all.show_help_msg.style.pixelTop	= event.y + top + document.memo.scrollTop;
	document.all.show_help_msg.style.pixelLeft	= event.x + left + document.memo.scrollLeft;
	document.all.show_help_msg.style.display = "";
}

function hideHelpMsg()
{
	document.all.show_help_msg.style.display = "none";
}

document.write("<div id='show_help_msg' style='z-index:1; position:absolute; background-color: #f5f5f5; border: 1px solid aaaaaa; padding: 5px; display:none'></div>");


/*******************************************************************************
* ³»¸Þ¼¼Áö ÀúÀåÇÔ °¡Á®¿À±â
*******************************************************************************/
function getMyMsg()
{
	var url = "/smsbox/my_msg.php";
	window.open(url, "my_msg", "top=100, left=100, width=600, height=500, scrollbars=yes");
}

function getMyMsgL()
{
	var url = "/smsbox/my_msg_long.php";
	window.open(url, "my_msg_long", "top=100, left=100, width=600, height=500, scrollbars=yes");
}

/*******************************************************************************
* ³»¸Þ¼¼Áö ÀúÀå
*******************************************************************************/
function myMsgSave()
{
	var url = "/smsbox/my_msg_save_form.php";
	window.open(url, "my_msg_save_form", "top=100, left=100, width=300, height=200, scrollbars=yes");
}

function myMsgSaveL()
{
	var url = "/smsbox/my_msg_long_save_form.php";
	window.open(url, "my_msg_long_save_form", "top=100, left=100, width=300, height=200, scrollbars=yes");
}


/*******************************************************************************
* ¸ÞÀÎ ÁÖ¼Ò·Ï °¡Á®¿À±â
*******************************************************************************/
function mainAddrPop()
{
	var url = "/address/main_addr_pop.php";
	window.open(url, "main_addr_pop", "top=100, left=100, width=600, height=500, scrollbars=yes");
}

/*******************************************************************************
* ÁÖ¼Ò·Ï °¡Á®¿À±â
*******************************************************************************/
function addrPop()
{
	var url = "/address/addr_pop.php";
	window.open(url, "addr_pop", "top=100, left=50, width=420, height=500, scrollbars=yes");
}

function addrPopPlus(type)
{
	var url = "/address/addr_pop_plus.php?type=" + type;
	window.open(url, "addr_pop_plus", "top=100, left=50, width=420, height=500, scrollbars=yes");
}

/*******************************************************************************
* °Ô½ÃÆÇ µî·Ï
*******************************************************************************/
function saveBoard()
{
	var url = "/smsboard/sms_add_form.php";
	window.open(url, "sms_add_form", "top=100, left=100, width=600, height=500, scrollbars=yes");
}

/*******************************************************************************
* ÀÌ½ºÅ×ÀÌ¼Ç µî·Ï
*******************************************************************************/
function eStation(jumin, username)
{
	var url = "http://www.skybell.co.kr/sk_certify/url_index.php?to_telephone=&jumin=" + jumin + "&username=" + username;
	window.open(url, "estation", "width=620, height=500, top=0, left=0, toolbars=no, resizable=yes, scrollbars=yes, status=no");
}

function eStationCheck()
{
	var url = "http://www.skybell.co.kr/sk_certify/new/estation_chk.php";
	window.open(url, "estation", "width=620, height=500, top=0, left=0, toolbars=no, resizable=yes, scrollbars=yes, status=no");
}



function view(what) 
{ 
	var imgwin = window.open("", 'WIN', 'scrollbars=no,status=no,toolbar=no,resizable=1,location=no,menu=no,width=10,height=10'); 
	imgwin.focus(); 
	imgwin.document.open(); 
	imgwin.document.write("<html>\n"); 
	imgwin.document.write("<head>\n"); 
	imgwin.document.write("<title>ccmbell</title>\n"); 
	imgwin.document.write("<sc"+"ript>\n"); 
	imgwin.document.write("function resize() {\n"); 
	imgwin.document.write("pic = document.il;\n"); 
	imgwin.document.write("if (eval(pic).height) { var name = navigator.appName\n"); 
	imgwin.document.write("  if (name == 'Microsoft Internet Explorer') { myHeight = eval(pic).height + 40; myWidth = eval(pic).width + 12;\n"); 
	imgwin.document.write("  } else { myHeight = eval(pic).height + 9; myWidth = eval(pic).width; }\n"); 
	imgwin.document.write("  clearTimeout();\n"); 
	imgwin.document.write("  var height = screen.height;\n"); 
	imgwin.document.write("  var width = screen.width;\n"); 
	imgwin.document.write("  var leftpos = width / 2 - myWidth / 2;\n"); 
	imgwin.document.write("  var toppos = height / 2 - myHeight / 2; \n"); 
	imgwin.document.write("  self.moveTo(leftpos, toppos);\n"); 
	imgwin.document.write("  self.resizeTo(myWidth, myHeight);\n"); 
	imgwin.document.write("}else setTimeOut(resize(), 100);}\n"); 
	imgwin.document.write("</sc"+"ript>\n"); 
	imgwin.document.write("</head>\n"); 
	imgwin.document.write('<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" bgcolor="#FFFFFF">\n'); 
	imgwin.document.write("<img border=0 src="+what+" xwidth=100 xheight=9 name=il onload='resize();'>\n"); 
	imgwin.document.write("</body>\n"); 
	imgwin.document.close(); 
} 

function guide2(url)
{
	window.open("/guide/?url=" + url, "guide2", "top=100, left=100, width=400, height=400, scrollbars=yes");
}

function first_guide(url)
{
	window.open("/guide2/index.php", "first_guide", "top=100, left=100, width=600, height=452");
}

function showDDayCalc()
{
	window.open("/dday_calc.php", "dday_calc", "top=100, left=100, width=300, height=250");
}

// ¸Þ½ÃÁö º¸³»±â
function sendmessage(toid)
{
	winOpen('/mypage/memosend_writeclick.asp?toid='+toid, 'sendmessage', 'no', 0, 0, 365, 350);
}

// ÀÌ¹ÌÁö º¸±â
function imageview(url) {
	var w = window.open(url, 'img', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=350,height=400,top=10,left=10');
	w.focus();
}

// Âò¸®½ºÆ® Ãß°¡
function cartadd(bbs, uid, gubun, board, no, zzim, cart)
{
    alert('ÄÁÅÙÃ÷ ÀÛ¾÷ÁßÀÔ´Ï´Ù.\nºü¸¥½Ã°£³» ¼­ºñ½º ÇÏ°Ú½À´Ï´Ù');
	return;
//	1:Âò, 2:¼±¹°, 3:³»Æù
	var frm;
	if (uid == '')
	{
		loginmsg();
		return;
	}
	location.href='/mypage/addcart.asp?bbs='+bbs+'&uid='+uid+'&gubun='+gubun+'&board='+board+'&no='+no+'&cart='+cart+'&zzim='+zzim;
}

function download(bbs, uid, gubun, board, no, zzim, cart)
{
}

function gourl(uid, url)
{
	if (uid == '')
	{
		loginmsg();
		return;
	}
	location.href = url;
}

// ÁÖ¼Ò·Ï ºÎ¸£±â
function showaddress(uid, sw)
{
	if (uid == '')
	{
		loginmsg();
	}
    else
    {
        var w = window.open('/popup/address.asp?sw='+sw, 'address_pop', 'scrollbars=no,resizable=no,top=20,left=20,width=750,height=500');
        w.focus();    
    }
}

// ¸¶ÀÌ¾Ù¹ü
function myalbum()
{
    var w = window.open('/popup/my_album.asp', 'my_album', 'scrollbars=no,resizable=no,top=20,left=20,width=750,height=500');
    w.focus();     
}

// ÂÊÁö
function zzim_list(no)
{
    var url = '/popup/zzim_list';
    if (no == 0)
    {
        url += '.asp';
    }
    else
    {
        url += '_' + no + '.asp';
    }
    var w = window.open(url, 'zzim_list', 'scrollbars=no,resizable=no,top=20,left=20,width=600,height=685');
    w.focus();     
}

// Âò¸®½ºÆ®
function memopop()
{
    var url = '/mypage/memo.asp';
    var w = window.open(url, 'memo_list', 'scrollbars=no,resizable=no,top=20,left=20,width=600,height=685');
    w.focus();     
}

// º§¼Ò¸® ´Ù¿î·Îµå
function bellDownWindow(theURL) 
{
    var ReUrl = '/mypage/soundplay.asp?'  + theURL;
    var woo = window.open(ReUrl, "cpdw",'width=467,height=600,toolbar=no,scrollbars=yes,location=no,directories=no,resizable=no,menubar=no,top=0,left=0');
	woo.focus();

}

function bellDownPop(theURL) 
{
    var ReUrl = '/mypage/soundplay.asp?' + theURL;
    window.open(ReUrl, "",'width=467,height=600,toolbar=no,scrollbars=yes,status=no,location=no,directories=yes,resizable=no,menubar=no,top=0,left=0');

}

// CP º§¼Ò¸® ´Ù¿î·Îµå
function cpbellDownWindow(theURL, u, n) 
{
    var ReUrl = './soundplay.asp?' + theURL ;
    var woo = window.open(ReUrl+'&cid='+u+'&cname='+n, "cpdw",'width=467,height=600,toolbar=no,scrollbars=yes,location=no,directories=no,resizable=no,status=no,menubar=no,top=0,left=0');
	woo.focus();
}

// CP º§¼Ò¸® ´Ù¿î·Îµå
function cpbellDownWindowNew(theURL, u, n) 
{
    var ReUrl = './soundplay_new.asp?' + theURL;
    var woo = window.open(ReUrl+'&cid='+u+'&cname='+n, "cpdw",'width=467,height=550,toolbar=no,scrollbars=yes,location=no,directories=no,resizable=no,status=yes,menubar=no,top=0,left=0');
	woo.focus();
}

// mp3ÇÃ·¹ÀÌ¾î
function playsount(board, no, sw)
{
    if (board == 'bell')
    {
	    window.open('/mypage/soundplay.asp?board='+board+'&no='+no+'&sw='+sw, 'playsount', 'left=0, top=0, width=389, height=250, scrollbars=0, resizable=0');
    }
    else
    {
	    getCookieccm('ccm_cookie', '/mypage/player_sound.asp?board='+board+'&no='+no+'&sw='+sw);
	}
}

// movieÇÃ·¹ÀÌ¾î
function playmovie(board, no, sw)
{
    getCookiemov('mov_cookie', '/mypage/player_mov.asp?board='+board+'&no='+no+'&sw='+sw);  
//	window.open('/mypage/player_mov.asp?board='+board+'&no='+no+'&sw='+sw, 'playsount', 'left=0, top=0, width=660, height=485, scrollbars=0, resizable=0');
}

// ÀÌ¹ÌÁö ´Ù¿î·Îµå
function imgDownWindow(theURL) 
{
    var ReUrl = '/mypage/phone_picture.asp?' + theURL;
    window.open(ReUrl,"",'width=467,height=680,toolbar=no,scrollbars=yes,location=no,directories=no,resizable=no,menubar=no,top=0,left=0');
}

// ÀúÀå¸Þ½ÃÁö ºÎ¸£±â
function popshowmessage(uid, sw)
{
	if (uid == '')
	{
		loginmsg();
	}
    else
    {
        var w = window.open('/mypage/message_inc.asp?callf='+sw, 'address_pop', 'scrollbars=no,resizable=no,top=20,left=20,width=600,height=680');
        w.focus();    
    }
}

/**
* ¹®ÀÚ¿­ ±æÀÌ¸¦ ¸®ÅÏÇÑ´Ù. 
*
* @param	string	str
* @return	int		size
*/
function getStringSize2(str) 
{
	var str,msg;
	var len = 0;
	var temp;
	var count = 0;
	 
	 //alert ( 'a' );
	//str = new String(msg);
	len = str.length;
	//alert ( str );
	for (var k=0; k<len; k++)
	{
		temp = str.charAt(k);
		if (escape(temp).length > 4) {
			count += 2;
		}
		else if (temp == '\n') { // \r\nÀÏ °æ¿ì
			//alert ( 'a' );
			count += 2;
		}
		else if (temp != '\n') {
			count++;
		}
	}
	//alert ( count );
	return count;
	
	/*var size = 0;
	var length = str.length;

	for(var i = 0; i < str.length; i++) 
	{
		if(str.charCodeAt(i) > 255)		// ÇÑ±ÛÀÌ¸é
			size += 2;
		else if(str.charCodeAt(i) != 13)
			size++;
	}
	return size;*/
}


// ÇÃ·¹ÀÌ¾î ºÎºÐ ======================================================== START
//ÄíÅ° ÀÐ°í ¾²°í Ã£°í ¸ÞÀÎÃ¢ ¶ç¿öÁÖ´Â ·çÆ¾ - Start
function setCookie(theName, theValue, theDay) {  //Cookie¿¡ µ¥ÀÌÅÍ ÀúÀå. ¼º°øÇÏ¸é true, ½ÇÆÐÇÏ¸é false¸¦ ¹ÝÈ¯
	if ((theName != null) && (theValue != null)) 
	{
   		expDay = "Wed, 01 Jan 2005 18:56:35 GMT"; //ÁöÁ¤µÇÁö ¾ÊÀº °æ¿ì´Â ¿ì¼± 2020³â
   		if (theDay !=null) {
      			theDay = eval(theDay);       //¹®ÀÚ¿­ÀÇ °æ¿ì¿¡µµ ¼ö°ªÀ¸·Î ÇÑ´Ù.
      			setDay = new Date();
			setDay.setTime(setDay.getTime()+(theDay*1000*60*60*24));
			expDay = setDay.toGMTString();
   		}
  		document.cookie = theName + "="+escape(theValue)+";expires="+expDay;
   		return true;
	}
	return false;
}

function deleteCookie(theName) {  //CookieÀÇ µ¥ÀÌÅÍ¸¦ »èÁ¦ÇÑ´Ù. Ç×»ó true¸¦ ¹ÝÈ¯ÇÑ´Ù. 
    var expireDate = new Date();
  
    expireDate.setDate( expireDate.getDate() - 1 );
    document.cookie = theName + "= " + "; expires=" + expireDate.toGMTString() + ";";
	return true;
}


// mp3
function getCookieccm(theName, ccmName) 
{  //Cookie·ÎºÎÅÍ ÁöÁ¤µÈ µ¥ÀÌÅÍ¸¦ ÃßÃâÇÑ´Ù. ¼º°øÇÏ¸é null ÀÌ¿ÜÀÇ °ªÀ», ½ÇÆÐÇÏ¸é false¸¦ ¹ÝÈ¯ÇÑ´Ù.
    var org = theName;
	theName += "=";       // = ¸¦ Ãß°¡ÇÏ¿© °Ë»öÀ» ÇÒ ¼ö ÀÖµµ·Ï ÇÑ´Ù.
	theCookie = document.cookie+";";     //°Ë»ö½Ã ¸¶Áö¸· Ç×¸ñ¿¡¼­ 01ÀÌ µÇ´Â °ÍÀ» ¹æÁö
	start = theCookie.indexOf(theName);   //ÁöÁ¤µÈ ÀÌ¸§À» °Ë»öÇÑ´Ù.
	
	if (start != -1) 
	{  //ÄíÅ°°ªÀÌ ÀÖÀ¸¸é(true)
   		end = theCookie.indexOf(";", start);
 		return unescape(theCookie.substring(start+theName.length,end));
	}
	else
	{
		ccmmain = window.open(ccmName,'ccmplayermp','left=0, top=0, width=389, height=230, scrollbars=0, resizable=0');  // player Ã¢ ¶ç¿ì°í
		writeCookie(org, ccmName);  //ÇÃ·¹ÀÌ¾î Ã¢ ÄíÅ° ÀÛ¼ºÇÑ´Ù. ÄíÅ°ÀÇ »èÁ¦´Â player Ã¢¿¡¼­ onunload() ÀÌ¹êÆ®·Î ½ÇÇà
	}
	return false;
}

// mov
function getCookiemov(theName, movName) 
{  //Cookie·ÎºÎÅÍ ÁöÁ¤µÈ µ¥ÀÌÅÍ¸¦ ÃßÃâÇÑ´Ù. ¼º°øÇÏ¸é null ÀÌ¿ÜÀÇ °ªÀ», ½ÇÆÐÇÏ¸é false¸¦ ¹ÝÈ¯ÇÑ´Ù.
    var org = theName;
	theName += "=";       // = ¸¦ Ãß°¡ÇÏ¿© °Ë»öÀ» ÇÒ ¼ö ÀÖµµ·Ï ÇÑ´Ù.
	theCookie = document.cookie+";";     //°Ë»ö½Ã ¸¶Áö¸· Ç×¸ñ¿¡¼­ 01ÀÌ µÇ´Â °ÍÀ» ¹æÁö
	start = theCookie.indexOf(theName);   //ÁöÁ¤µÈ ÀÌ¸§À» °Ë»öÇÑ´Ù.
	
/*	if (start != -1) 
	{  //ÄíÅ°°ªÀÌ ÀÖÀ¸¸é(true)
   		end = theCookie.indexOf(";", start);
 		return unescape(theCookie.substring(start+theName.length,end));
	}
	else
	{
*/	    // height=537
		movmain = window.open(movName,'movplayermo','left=0, top=0, width=365, height=425, scrollbars=0, resizable=0');  // player Ã¢ ¶ç¿ì°í
		writeCookie(org, movName);  //ÇÃ·¹ÀÌ¾î Ã¢ ÄíÅ° ÀÛ¼ºÇÑ´Ù. ÄíÅ°ÀÇ »èÁ¦´Â player Ã¢¿¡¼­ onunload() ÀÌ¹êÆ®·Î ½ÇÇà
//	}
	return false;
}

function writeCookie(theName, ccmName) {
	OS_name  = theName;  //ÄíÅ° ÀÌ¸§
	OS_Value  = ccmName;  //ÄíÅ° °ª 
	OS_exp    = 1;    //ÄíÅ° À¯È¿ ±âÇÑ
	setCookie(OS_name, OS_Value, OS_exp);
}

// ÇÃ·¹ÀÌ¾î ºÎºÐ ======================================================== END

function reloadPage(init) 
{
    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 loginmsg()
{
    alert('È¸¿øÀü¿ëÀÔ´Ï´Ù.\n\n·Î±×ÀÎ ÈÄ »ç¿ëÇÏ¼¼¿ä');
}
function jgobbs(bord, etype)
{
    gobbs.boarder.value = bord;
    if (etype == 'bell')
    {
        gobbs.action = '/bbs/list_bell_sub.asp';
        gobbs.submit();
    }
    else if (etype == 'color')
    {
        gobbs.action = '/bbs/list_ring_sub.asp';
        gobbs.submit();
    }
    else if (etype == 'msg')
    {
        gobbs.action = '/bbs/list_message_sub.asp';
        gobbs.submit();
    }
    else if (etype == 'img')
    {
        gobbs.action = '/bbs/list_phone_sub.asp';
        gobbs.submit();
    }
    else if (etype == 'mp3')
    {
        gobbs.action = '/bbs/list_ccm_sub.asp';
        gobbs.submit();
    }
    else if (etype == 'movie')
    {
        gobbs.action = '/bbs/list_movie_sub.asp';
        gobbs.submit();
    }
    else if (etype == 'bord')
    {
        gobbs.action = '/bbs/list_board_sub.asp';
        gobbs.submit();
    }
}

function newccm(bord, etype, save)
{
    var movmain;
	movmain = window.open('/bbs/new_ccm.asp?bord='+bord+'&no='+etype+'&save='+save,'newccm','left=0, top=0, width=500, height=600, scrollbars=0, resizable=0');  // player Ã¢ ¶ç¿ì°í
    movmain.focus();
}


