// JScript source code
// : Made By chan su

// table round
function roundTable(objID) {
       var obj = document.getElementById(objID);
       var Parent, objTmp, Table, TBody, TR, TD;
       var bdcolor, bgcolor, Space;
       var trIDX, tdIDX, MAX;
       var styleWidth, styleHeight;

       // get parent node
       Parent = obj.parentNode;
       objTmp = document.createElement('SPAN');
       Parent.insertBefore(objTmp, obj);
       Parent.removeChild(obj);

       // get attribute
       bdcolor = obj.getAttribute('rborder');
       bgcolor = obj.getAttribute('rbgcolor');
       radius = parseInt(obj.getAttribute('radius'));
       if (radius == null || radius < 1) radius = 1;
       else if (radius > 6) radius = 6;

       MAX = radius * 2 + 1;
       
       /*
              create table {{
       */
       Table = document.createElement('TABLE');
       TBody = document.createElement('TBODY');

       Table.cellSpacing = 0;
       Table.cellPadding = 0;

       for (trIDX=0; trIDX < MAX; trIDX++) {
              TR = document.createElement('TR');
              Space = Math.abs(trIDX - parseInt(radius));
              for (tdIDX=0; tdIDX < MAX; tdIDX++) {
                     TD = document.createElement('TD');
                     
                     styleWidth = '1px'; styleHeight = '1px';
                     if (tdIDX == 0 || tdIDX == MAX - 1) styleHeight = null;
                     else if (trIDX == 0 || trIDX == MAX - 1) styleWidth = null;
                     else if (radius > 2) {
                            if (Math.abs(tdIDX - radius) == 1) styleWidth = '2px';
                            if (Math.abs(trIDX - radius) == 1) styleHeight = '2px';
                     }

                     if (styleWidth != null) TD.style.width = styleWidth;
                     if (styleHeight != null) TD.style.height = styleHeight;

                     if (Space == tdIDX || Space == MAX - tdIDX - 1) TD.style.backgroundColor = 

bdcolor;
                     else if (tdIDX > Space && Space < MAX - tdIDX - 1)  TD.style.backgroundColor = 

bgcolor;
                     
                     if (Space == 0 && tdIDX == radius) TD.appendChild(obj);
                     TR.appendChild(TD);
              }
              TBody.appendChild(TR);
       }

       /*
              }}
       */

       Table.appendChild(TBody);
       
       // insert table and remove original table
       Parent.insertBefore(Table, objTmp);
}

   function SetNum(obj){
        val=obj.value;
        re=/[^0-9]/gi;
        obj.value=val.replace(re,"");
    }

function isNumEng(oStr){
	var offSet, Reg_ExStr;
	offSet = true;
	
	Reg_ExStr = /[^A-Za-z0-9]/;
	
	if(oStr.match(Reg_ExStr)){
		offSet = false;
	}
	return offSet;
}	


function isAlert(Target_focus, Msg_Str, Comp1, Comp2){
	if(Comp1 == Comp2){
		alert(Msg_Str);
		Target_focus.focus();
		return true;
	}
}

function isAlerts(Target_focus, Msg_Str, Comp1, Comp2){
	if(Comp1 < Comp2){
		alert(Msg_Str);
		Target_focus.value = "";
		Target_focus.focus();
		return true;
	}
}

function popOpen(url,PopName,wth,hht) {
	window.open(url,PopName,"left=0,top=0,width="+ wth +",height="+ hht +",toolbar=no,scrollbars=auto,status=yes");
}
function popOpen_SCR(url,PopName,wth,hht) {
	window.open(url,PopName,"left=0,top=0,width="+ wth +",height="+ hht +",toolbar=no,scrollbars=yes,status=yes");
}

function popOpenName(url,PopName) {
	window.open(url,PopName,"left=0,top=0,width=0,height=0,toolbar=no,scrollbars=auto,status=yes");
}


function popResize(offsetTable) {
	
	var thisX = document.getElementById(offsetTable).offsetWidth;
	var thisY = document.getElementById(offsetTable).offsetHeight;
	/*
	
	var maxThisX = screen.width - 50;
	var maxThisY = screen.height - 200;

	if (thisX > maxThisX) {
		window.document.body.scroll = "yes";
		thisX = maxThisX;
	}
	if (thisY > maxThisY) {
		window.document.body.scroll = "yes";
		thisX += 16;
		thisY = maxThisY;
	}
	window.resizeTo(thisX+40,thisY+29+50);
	*/

	var windowX = (screen.width - (thisX+10))/2;
	var windowY = (screen.height - (thisY))/2 - 20;	
	window.moveTo(windowX,windowY);
}


function reSize(iframe_name) {
        try{	
		var objFrame;
		var objBody;
        //objFrame = top.frames('frames_Bot').document.all(iframe_name)
        objFrame = document.all(iframe_name)
        objBody = document.frames('frames_Bot').document.frames(iframe_name).document.body;
        iframe_height = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight);
	        if (iframe_height > 490) {
	                objFrame.style.height = iframe_height
	        }else{
	                objFrame.style.height = 490;
	        }
			objFrame.style.width = "100%";			
        }catch(e){}
        setTimeout('reSize("' + iframe_name + '")',0)
}



function show_layer(layer_name)
{
	
	if (layer_name.style.display != "none"){
		layer_name.style.display = "none";
	}
	else {
		layer_name.style.display = "";	 
	}
}



function hide_layer(layer_name)
{
		layer_name.style.display = "none";
}

//¿£ÅÍÅ° ´©¸§½Ã ÀÛ¾÷
function EnterCheck() {
	var strTemp = arguments[0]; 
	var evt = arguments[1];
	if (arguments[1].keyCode==13) {
		arguments[0]();
		return (false);
	}
}


  
 //========================================
 //  Month Array »ý¼º
 //========================================
 function jmontharr(m0,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11) {
     this[0] = m0;
     this[1] = m1;
     this[2] = m2;
     this[3] = m3;
     this[4] = m4;
     this[5] = m5;
     this[6] = m6;
     this[7] = m7;
     this[8] = m8;
     this[9] = m9;
     this[10] = m10;
     this[11] = m11;
 }

 //=============================================
 // bÀÇ ¾çÂÊ °ø¹éÀ» Á¦°ÅÇØÁÖ´Â ÇÔ¼ö
 //=============================================
 function jTrim(b) {
     var i, startIdx, endIdx;
 
     if (b == null)
         return "";
 
     startIdx = 0;
     endIdx   = b.length;
 
      for(i=0; i < b.length ; i++)
         if ( b.charAt(i) != " " )
         {
             startIdx = i;
             break;
         }
 
      for(i=b.length; i >= 0 ; i--)
         if ( b.charAt(i-1) != " " )
         {
             endIdx = i;
             break;
         }
 
      return b.substring(startIdx, endIdx);
 }

  function isEmpty(toCheck) {
  var chkstr = jTrim(toCheck) + "";
  var is_Space = true ;
 
  if ( ( chkstr == "") || ( chkstr == null ) )
   return true;
 
  for ( j = 0 ; is_Space && ( j < chkstr.length ) ; j++) {
   if( chkstr.substring( j , j+1 ) != " " )
    is_Space = false ;
  }
 
  return is_Space;
 }

  //---------------------------------------------------
 //  ±â´É   : Check Integer RETURN T/F
 //---------------------------------------------------
 function isInteger(st) {
  if (!isEmpty(st)) {
   for (j=0; j<st.length; j++) {
    if (((st.substring(j, j+1) < "0") || (st.substring(j, j+1) > "9")))
      return false;
   }
  }
  else {
    return false ;
  }
   return true ;
 }

  //========================================
 //  YYYY ¸¦ checkÇÑ´Ù.
 //========================================
 function checkYYYY(toCheck) {
   return ( ( toCheck.length == 4) && ( isInteger(toCheck)  ) && ( toCheck != "0000") );
 }
 
 
 //========================================
 //  MM ¸¦ checkÇÑ´Ù.
 //========================================
 function checkMM(toCheck) {
   return ((!isEmpty(toCheck)) && (isInteger(toCheck)) && ( parseFloat(toCheck) > 0 ) && (parseFloat(toCheck) < 13));
 }
 
 
 //========================================
 //  YYYY,MM,DD¸¦ checkÇÑ´Ù.
 //========================================
 function checkDD( yyyy, mm, toCheck) {
     var isYMD   = false;
     var monthDD = new jmontharr(31,28,31,30,31,30,31,31,30,31,30,31);
     var im      = eval(mm) - 1;
 
     if ( toCheck.length == 0 )
          return false;
 
     if ( !isInteger(toCheck)  )
          return false;
 
     var dd = toCheck;
 
     if ( ( (yyyy%4 == 0) && (yyyy%100 != 0) ) || (yyyy%400 == 0) )
     {
          monthDD[1] = 29;
     }
 
     if ( (0 < dd) && (dd <= monthDD[im]) )
          isYMD = true;
 
     return isYMD;
 }

 function checkDate( dateVal ) {
   var isDate  = true ;
 
  if ( dateVal.length != 8 )  {
   isDate = false ;
  }
  else {
   var yy = dateVal.substring(0,4) +"" ;
   var mm = dateVal.substring(4,6) +"" ;
   var dd = dateVal.substring(6,8) +"" ;
 
   if (!checkYYYY(yy)) {
     isDate = false ;
   }
 
   else if (!checkMM(mm)) {
    isDate = false ;
   }
 
   else if (!checkDD(yy,mm,dd)) {
    isDate = false ;
   }
  }
  return isDate ;
 }
   

function move_focus(src, count, target)
{
if (src.value.length == count)
target.focus();
}
////////ÁÖ¹Îµî·Ï¹øÈ£ Ã¼Å© ///
function juminCheck(jumin1,jumin2,form)
{
	frm = form;
 var strRegNo1 = jumin1.value;
 var strRegNo2 = jumin2.value;

 if (id_no_chk(frm.jumin1, frm.jumin2) == false)
 {
  alert( "±ÍÇÏ²²¼­ ÀÔ·ÂÇÏ½Å ÁÖ¹Îµî·Ï¹øÈ£´Â Á¤»óÀûÀÎ Ã¼°è°¡ ¾Æ´Ï¹Ç·Î °¡ÀÔÀ» À§ÇØ¼­´Â °ü¸®ÀÚ¿¡°Ô (e-mail@domain.com) ¹®ÀÇÇÏ¿© ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù." );
  frm.jumin1.value="";
  frm.jumin2.value="";
  frm.jumin1.focus();  
  //return false;
  return;
 } else {
  			frm.action = "member_join.asp"
			frm.submit();
 }
}

function id_no_chk(obj1,obj2) 
{
 // CheckSum Ã¼Å©
 if (chksumID(obj1,obj2) == false)
  return false;
  
 // »ý¼º±â·Î ¸¸µç°Ô ¾Æ´Ñ°¡ »ý³â¿ùÀÏ°ú ³²³àÇÊµå Ã¼Å©
 if (ValidRegNo(obj1,obj2) == false)
  return false;
 
 // YYMMDD°¡ ¸Â´ÂÁö È®ÀÎÇÑ´Ù.
 if (ValidRegNo2(obj1) == false)
  return false;
}

function ValidRegNo(obj1,obj2) 
{
    strReg1 = obj1.value;
    strReg2 = obj2.value;
    sGender = strReg2.substring(0,1);
    sYear = strReg1.substring(0,2);
    
    // µÎ¹øÂ° ´Ü¶ô Ã¹¹øÂ° ¼ýÀÚ´Â 4º¸´Ù Å¬ ¼ö ¾ø´Ù.
 if (sGender > 6) {
  return false;
 }
 
    // 2000³âµµ ÀÌÀüÀº ³²ÀÚ´Â 1, ¿©ÀÚ´Â 2
    // 2000³âµµ ÀÌÈÄ´Â ³²ÀÚ´Â 3, ¿©ÀÚ´Â 4
/*    
 if (sYear != '00') {
  if ((sGender != '1') && (sGender != '2')) {
   return false;
  }
 }
*/    
    return true;
}

// YYMMDD°¡ ¸Â´ÂÁö È®ÀÎÇÑ´Ù.
function ValidRegNo2(obj1) 
{
    strReg1 = obj1.value;

 a = new String(strReg1);

 if(a == '') return false;
 if(a.length != 6 ) return false;

 intYear = parseInt(a.substring(0,2) , 10);
 intMonth = parseInt(a.substring(2,4) , 10);
 intDay = parseInt(a.substring(4,6) , 10);
 
 if(intMonth < 0 || intMonth > 12){ 
  return false;
 }
  
 switch(intMonth){
  case 2 :
   if (intYear %4 == 0)  {
    if(intDay < 0 || intDay > 29){
     return false;
     breake;
    }
   } else { 
    if(intDay < 0 || intDay > 28){
     return false;
     breake;
    }
   }
  case 4 :
   if(intDay < 0 || intDay > 30){
    return false;
    breake;
   }
  case 6 :
   if(intDay < 0 || intDay > 30){
    return false;
    breake;
   }
  case 9 :
   if(intDay < 0 || intDay > 30){
    return false;
    breake;
   }
  case 11 :
   if(intDay < 0 || intDay > 30){
    return false;
    breake;
   }
  default :
   if(intDay < 0 || intDay > 31){
    return false;
    breake;
   }
 }
    
    return true;
}

function jsCheckEnterKey(frm)
{
 if ( event.keyCode == 13 )
 {  
  if ( frm.cid_f.value.length != 6 )
  {
   frm.cid_f.focus();
   return;
  }  
  if ( frm.cid_r.value.length != 7 )
  {
   frm.cid_r.focus();
   return;   
  }
  chkcid();
 }
 else return;
}

function chksumID(obj1,obj2) 
{
    str1 = obj1.value;
    str2 = obj2.value;
    var li_lastid,li_mod,li_minus,li_last;
    var value0,value1,value2,value3,value4,value5,value6;
    var value7,value8,value9,value10,value11,value12;
    
    if (IsInteger(str1) &&  IsInteger(str2)) {
        li_lastid    = parseFloat(str2.substring(6,7));
        value0  = parseFloat(str1.substring(0,1))  * 2;
        value1  = parseFloat(str1.substring(1,2))  * 3;
        value2  = parseFloat(str1.substring(2,3))  * 4;
        value3  = parseFloat(str1.substring(3,4))  * 5;
        value4  = parseFloat(str1.substring(4,5))  * 6;
        value5  = parseFloat(str1.substring(5,6))  * 7;
        value6  = parseFloat(str2.substring(0,1))  * 8;
        value7  = parseFloat(str2.substring(1,2))  * 9;
        value8  = parseFloat(str2.substring(2,3))  * 2;
        value9  = parseFloat(str2.substring(3,4))  * 3;
        value10 = parseFloat(str2.substring(4,5))  * 4;
        value11 = parseFloat(str2.substring(5,6))  * 5;
        value12 = 0;
        
        value12 = value0+value1+value2+value3+value4+value5+value6+value7+value8+value9+value10+value11+value12 ;
        
        li_mod = value12 %11;
        li_minus = 11 - li_mod;
        li_last = li_minus % 10;
        if (li_last != li_lastid){
            obj2.select();
            obj2.focus();
            return false;
        } else
            return true;
 } else
    obj2.select();
    obj2.focus();
    return false;
}

// ÁÖ¾îÁø ¹®ÀÚ¿­ÀÌ ¼ýÀÚ·Î¸¸ ÀÌ·ç¾îÁ®ÀÖ´ÂÁö °Ë»çÇÑ´Ù.
function IsInteger(st)
{
 if (!IsEmpty(st)) {
  for (j = 0; j < st.length; j++)
   if (((st.substring(j, j+1) < "0") || (st.substring(j, j+1) > "9")))
    return false;
 }
 else
  return false;

 return true;
}

// ÁÖ¾îÁø ¹®ÀÚ¿­ÀÌ ºñ¾îÀÖ´ÂÁö °Ë»çÇÑ´Ù.
function IsEmpty(toCheck)
{
 var chkstr = toCheck + "";
 var is_Space = true;

 if (( chkstr == "") || (chkstr == null))
  return false;

 for (j = 0; is_Space && j < chkstr.length; j++) {
  if (chkstr.substring(j, j+1) != " ")
   is_Space = false ;
 }

 return is_Space;
}

function jsAuthoFocus(thisObj, nextObj) {

 if ( thisObj == form.cid_f && thisObj.value.length == 6 ) { nextObj.focus(); }
 else if ( thisObj == form.cid_r && thisObj.value.length == 7 ) { chkcid(); }
 else { return false;}

}

/////////////////////////////

//ÆË¾÷ °¡¿îµ¥ ¶ç¿ì±â
function popup_center(url,w, h, s, r) 
{
 
 width=screen.width;
 height=screen.height;
 
 x=(width/2)-(w/2);
 y=(height/2)-(h/2);
 
 opt = "left=" + x + ", top=" + y + ", width=" + w + ", height=" + h;
 opt = opt + ", toolbar=no,location=no,directories=no,status=no,menubar=no";
 opt = opt + ",scrollbars=" + s;
 opt = opt + ",resizable=" + r;
 window.open(url, "_blank", opt);
 
}
///////////////////////

//////////////////////
//¿À¸¥ ¸¶¿ì½º ±ÝÁö
/*
function right(e) {
    if (navigator.appName == 'Netscape' &&     (e.which == 3 || e.which == 2)) {
        alert("¿À¸¥ ¸¶¿ì½º´Â »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.");
    return false;
    }
    else if (navigator.appName == 'Microsoft Internet Explorer' &&  (event.button == 2 || event.button == 3)) {
        alert("¿À¸¥ ¸¶¿ì½º´Â »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.");
    return false;
    }
return true;
}

document.onmousedown=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
window.onmousedown=right;
*/

///////////////////////////
///////////////////////

// ÀÎ¼â

  var win=null;
  function printIt(printThis)  {
    win = window.open();
    self.focus();
    win.document.open();
    win.document.write('<'+'html'+'><'+'head'+'><'+'style'+'>');
    win.document.write('body, td { font-family: Verdana; font-size: 10pt;}');
    win.document.write('<'+'/'+'style'+'><'+'/'+'head'+'><'+'body'+'>');
    win.document.write(printThis);
    win.document.write('<'+'/'+'body'+'><'+'/'+'html'+'>');
    win.document.close();
    win.print();
    win.close();
  }
// ±ÛÀÚ¼ö Á¦ÇÑ
/////////////////////////////////////////////////
function lenCheck(txtObj, maxLen){
	if(txtObj.value.length>(maxLen-1)){
//	txtObj.blur();
//	txtObj.readOnly=true;
//	txtObj.disabled=true;
	alert("±ÛÀÚ¼ö°¡ ÃÊ°ú µÇ¾ú½À´Ï´Ù.");
	return false;
	}
}
//-->
 /////////////////////////////////
 /*
===============================================================================
*  i.e patch
===============================================================================
*/


// flashWrite(ÆÄÀÏ°æ·Î, °¡·Î, ¼¼·Î, ¾ÆÀÌµð, ¹è°æ»ö, º¯¼ö, À©µµ¿ì¸ðµå) 
function flashWrite(url,w,h,id,bg,vars,win){ 

 // ÇÃ·¡½Ã ÄÚµå Á¤ÀÇ 
 var flashStr= 
 "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+ 
 "<param name='allowScriptAccess' value='always' />"+ 
 "<param name='movie' value='"+url+"' />"+ 
 "<param name='FlashVars' value='"+vars+"' />"+ 
 "<param name='wmode' value='"+win+"' />"+ 
 "<param name='menu' value='false' />"+ 
 "<param name='quality' value='high' />"+ 
 "<param name='bgcolor' value='"+bg+"' />"+ 
 "<embed src='"+url+"' FlashVars='"+vars+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+ 
 "</object>"; 

 // ÇÃ·¡½Ã ÄÚµå Ãâ·Â 
 document.write(flashStr); 

} 
//µ¿¿µ»ó 
function aviPlay(src,w,h) { 
document.write('<embed src="'+src+'" width='+w+' height='+h+'>') 
} 
////////////////////////////////////////////////
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

