
// ÀÚ·á¿¡ °ø¹éÀÌ ÀÖ´ÂÁö Ã¼Å©

function IsEmpty(data) {
  for (var i=0;i<data.length;i++) { if (data.substring(i,i+1) != " ") return false;  }   
  return true; 
}
//¹Ì¸®º¸±â
	function new_view_all() {
					  bform2.action = "/kr/previous/exproduct_list_cview.asp?id=<%=cookies_val(1)%>&ck_Db=2006";
					  bform2.target = "_new";
					  bform2.submit();
					}

// ÇØ´ç ¹®ÀÚ°¡ ÀÖ´ÂÁö Ã¼Å©

function chk_string(str, word) {
  var chk = str.indexOf(word);
  if (chk > -1) return true;              
  else  return false; 
}


//textarea ±ÛÀÚ¼ö Á¦ÇÑÇÏ±â
function CheckStrLen(maxlen,field)
 {
   var temp; //µé¾î¿À´Â ¹®ÀÚ°ª...
   var msglen;
   msglen = maxlen*2;
   var value= field.value;
   
   l =  field.value.length; 
   tmpstr = "" ;

   if (l == 0)
   {
    value = maxlen*2;
   }
   else 
   {
    for(k=0;k<l;k++)
    {
     temp =value.charAt(k);

     if (escape(temp).length > 4)
   msglen -= 2;
     else
   msglen--;
    
     if(msglen < 0) 
     {
   alert("ÃÑ ¿µ¹® "+(maxlen*2)+"ÀÚ ÇÑ±Û " + maxlen + "ÀÚ ±îÁö º¸³»½Ç¼ö ÀÖ½À´Ï´Ù.");
    field.value= tmpstr;
   break;
     }
     else 
     {
   tmpstr += temp;
     }
    }
   }
 }


// ÀÚ·á°¡ ¿µ¹®,¼ýÀÚ·Î¸¸ ÀÌ·ç¾î Á³´ÂÁö Ã¼Å©

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; 
}



//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() {

  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;
}



// ÁÖ¹Î¹øÈ£ Ã¹Â°ÀÚ¸® ÀÔ·Â½Ã »ý³â¿ùÀÏ ¸ÂÃß±â

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);
     f1.value = tyear;
     f2.value = birth.substring(2,4);
     f3.value = 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 fillaccount(f1, f2) {

  if (f1.value != '') {
      if (f2.value.toLowerCase() == "hanmail.net") {
			 alert('ÇÑ¸ÞÀÏÀº ¿Â¶óÀÎ ¿ìÇ¥Á¦ ½ÃÇàÀ¸·Î »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.');
			 f2.value = '';
			 f2.focus();
      }

      f2.value = f1.value;  
		f2.reaOnly = true;
		f2.style.backgroundColor = '#F4F4F4';
  }
  else {
		f2.reaOnly = false;
		f2.style.backgroundColor = '#ffffff';
  }

}


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;

}


// ¿ÀÇÂÃ¢À¸·Î ÆûÀü¼Û ÀÍ½º 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 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 - 370) / 2;
  var intTop  = (screenHeight - 302) / 2

  window.open('/post_list.asp?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=370,height=302'));

} 
// ¼öÁ¤¶§¹®¿¡ 
function findPost2(tmp_a, tmp_b, tmp_c, tmp_d) {

  var screenWidth  = screen.availwidth;
  var screenHeight = screen.availheight;

  var intLeft = (screenWidth - 370) / 2;
  var intTop  = (screenHeight - 302) / 2

  window.open('/post_list2.asp?tmp_a='+tmp_a+'&tmp_b='+tmp_b+'&tmp_c='+tmp_c+'&tmp_d='+tmp_d, 'post_list2', ('scrollbars=no,resizable=no,top='+intTop+',left='+intLeft+',width=370,height=302'));

} 


// ¾ÆÀÌµð, ºñ¹Ð¹øÈ£ ºÐ½Ç

function findMem() {

  window.open('/join/find_info.php', 'find_info', ('scrollbars=no,resizable=yes,width=585,height=283,left=100,top=100'));

} 



// ³¯Â¥°Ë»öÀÌ ÀÖ´Â °Ë»ö¹®

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, 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);
}


function init_iframe(height) {
  reSize(height);
  setTimeout('init_iframe('+height+')', 500)
}


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) {}
}



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 + "\" allowTransparency='true'></iframe>\n"

  document.getElementById(posid).innerHTML = str;

}




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));

}









// ³¯Â¥º° 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 makeArray(n) {
  
  this.length = n;
  for(var i=1; i <= n; i++) this[i] = "";
  return this;

}



// Ã·ºÎÆÄÀÏ ¾÷·Îµå Ã³¸®¿ë Å¸ÀÔ Å¬·¡½º
// 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) {

}



// ajax ¿¡¼­ escape ·Î ÀÎÄÚµù½Ã + ¹®ÀÚ ¹®Á¦ÇØ°á

escape: function(value) {
  return escape(value).replace(/\+/g, '%2B');
}




// ³¯Â¥°Ë»ö Ã³¸®

function sel_search_day(f1, f2, val_a, val_b) {

  f1.value = val_a;
  f2.value = val_b;

}



function toggleMenu(currMenu) {
  
  if (document.all) {
      thisMenu = eval("document.all." + currMenu + ".style");
      if (thisMenu.display == "block")  thisMenu.display = "none";
      else                              thisMenu.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;
  } 
}

 

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() {
  var frm = document.bform1;

  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;

} 




// ¼±ÅÃÇÑ °´Ã¼ÀÇ Àý´ëÀ§Ä¡ 
// o Å¬·¡½º ¾ÆÀÌµð

function getRealOffsetLeft(o) { 
  
  return o ? o.offsetLeft + getRealOffsetLeft(o.offsetParent) : 0; 

} 

function getRealOffsetTop(o) { 

  return o ? o.offsetTop + getRealOffsetTop(o.offsetParent) : 0; 

} 




// ¿À´Ã³¯Â¥

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 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;
		}
	};
	
}




// ÀÌ¹ÌÁö 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 r_show_pic(num, img_url) {
  document.images["pic"+num].style.display = "block";
  document.images["pic"+num].src = img_url;
}


function show_pic(f, num) {
  document.images["pic"+num].style.display = "block";
  document.images["pic"+num].src = f.value;
}



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); 



function post() {
  window.open('zipcode.asp', 'zipcode', ('scrollbars=no, resizable=yes, width=540, height=325, left=100, top=100'));
}

function DisplayMenu(index) {

	for (i=1; i<=2; i++)
		if (index == i) {
			thisMenu = eval("menu" + index + ".style");
			thisMenu.display = "";
		}
		else {
			otherMenu = eval("menu" + i + ".style");
			otherMenu.display = "none";
		}
}
