/*
' -----------------------------------------------------
'   ÆäÀÌÁö¸í : jscripts/jc_common.js
'   ÃÖÃÊÀÛ¼º : 2004-04-20
'   ¾÷µ¥ÀÌÆ® : 
'   È£Ãâ¸®½ºÆ® : 
'   ÆäÀÌÁö¼³¸í : °øÅëÀûÀ¸·Î »ç¿ëÇÏ´Â ÇÔ¼ö ¸ðÀ½
' -----------------------------------------------------
*/
var gs_url_path = "/wt_board";

var d = navigator.userAgent.toLowerCase();

var gs_agent = "";

if (d.indexOf('msie') > -1)
{
   gs_agent = "ms";
}
else
{
   gs_agent = "fx";
}



/*
' ------------------------------------------------------------------
' Function    : 
' Description : Dynamic ½ºÅ©¸³Æ® »ç¿ëÀ» À§ÇÑ ÄÁÆ®·Ñ »ðÀÔ
' Argument    : 
' Return      : 
' ------------------------------------------------------------------
*/
document.writeln("<script language=\"javascript\" id=\"j_dynamic\"><\/script>");




var gbn_over_check = false; // Áßº¹Ã¼Å©½Ã ÇÊ¿äÇÑ global º¯¼ö
var gs_server_time = "";    // ¼­¹ö½Ã°£

/*
' ------------------------------------------------------------------
' Function    : fc_number_format(ari_number)
' Description : ¼ýÀÚ¸¦ ¹Þ¾Æ¼­ ,¸¦ Âï¾îÁØ´Ù.(µ¿ÀûÀ¸·Î º¯Çü½ÃÅ³¶§´Â fc_coma¸¦ »ç¿ëÇÒ°Í)
' Argument    : Integer Ä¡È¯ÇÒ ¼ýÀÚ
' Return      : String ,ÂïÀº ¼ýÀÚ
' ------------------------------------------------------------------
*/
function fc_number_format(ari_number)
{
   // ¹ÞÀº ¼ýÀÚ¸¦ ¹®ÀÚ·Î º¯È¯ÇØÁØ´Ù.
   var ls_number = String(ari_number);
   
   // Á¤±ÔÇ¥Çö½Ä
   var lo_reg = /(\d+)(\d{3})($|\..*)/;
   
   if (lo_reg.test(ls_number))
      return ls_number.replace(lo_reg,function(str,p1,p2,p3) { return fc_number_format(p1) + "," + p2 + p3; });
   else
      return ls_number;
}

/*
' ------------------------------------------------------------------
' Function    : fc_obj_coma(aro_name)
' Description : ÇØ´ç¿ÀºêÁ§Æ®¿¡ ÄÄ¸¶¸¦ ºÙ¿©ÁØ´Ù.fc_coma(ars_number)¿Í ¼ÂÆ®
' Argument    : Integer Ä¡È¯ÇÒ ¼ýÀÚ
' Return      : String ,ÂïÀº ¼ýÀÚ
' ------------------------------------------------------------------
*/
function fc_obj_coma(aro_name)
{
   var keyCode = event.keyCode;      
   if ( ((keyCode>=48) && (keyCode <= 105)) || (keyCode==8) || (keyCode==13) || (keyCode==35) || (keyCode==46) )
   {
      //0(48)~¼ýÀÚÅ°ÆÐµå9(105), enter(13), bakspace(8), delete(46), end(35) key ÀÏ ¶§¸¸ Ã³¸®ÇÑ´Ù.
      aro_name.value = fc_coma(aro_name.value);
      
   }
}

/*
' ------------------------------------------------------------------
' Function    : fc_coma(ars_number)
' Description : 3ÀÚ¸®¸¶´Ù ÄÄ¸¶¹ÝÈ¯,fc_obj_coma(aro_name)¿Í ¼ÂÆ®·Î »ç¿ëÇÒ°Í
' Argument    : String Ä¡È¯ÇÒ ¼ýÀÚ
' Return      : String ,ÂïÀº ¼ýÀÚ
' ------------------------------------------------------------------
*/
function fc_coma(ars_number)
{
   var li_explo;
   var li_explo = ars_number.length; 
   var ls_str = "";


   for (var k = (li_explo); k >= 0 ; k--)
   { 
      if(ars_number.substring(k-1,k) != ",")
      {
         ls_str = ars_number.substring(k-1,k) + ls_str;
      }
   }
   
   li_explo = ls_str.length; 
   
   var ls_msg = "";
   var li_no =1; 

   for (var k = (li_explo); k >= 0 ; k--)
   {
      if(li_no == 3 && k != 0)
      {
         ls_msg = ls_str.substring(k-1,k) + "," + ls_msg;
         li_no = 0;
      } 
      else
      {
         ls_msg = ls_str.substring(k-1,k) + ls_msg ; 
      }
      li_no++;
   }
   return ls_msg;
}

/*
' ------------------------------------------------------------------
' Function    : fc_input_num()
' Description : ¼ýÀÚ¸¸ ÀÔ·Â¹Þ°ÔÇÑ´Ù. onkeypressÇÒ¶§ fc_input_num()ÀÌ¶ó°í ÁöÁ¤ÇÔ
' Argument    : 
' Return      : 
' ------------------------------------------------------------------
*/
function fc_input_num()
{
   if(event.keyCode<48 || event.keyCode>57)
      event.returnValue=false;
}


/*
' ------------------------------------------------------------------
' Function    : fc_input_num()
' Description : ¼ýÀÚ¸¦ ÀÔ·Â¹ÞÀ¸¸ç ¶ÇÇÑ - µµ ÀÔ·ÂÇÒ¼ö ÀÖ°ÔÇÑ´Ù.(°èÁÂ¹øÈ£ ³ÖÀ»¶§»ç¿ë)
' Argument    : 
' Return      : 
' ------------------------------------------------------------------
*/
function fc_input_num2()
{
   if(event.keyCode !=45)
   {
      if(event.keyCode !=9)
      {
         if(event.keyCode<48 || event.keyCode>57)
            event.returnValue=false;
      }
   }
}

/*
' ------------------------------------------------------------------
' Function    : fc_auto_next_focus()
' Description : maxlength°¡ ÁöÁ¤µÇ¾î ÀÖÀ¸¸é ÀÚµ¿À¸·Î Æ÷Ä¿½º¸¦ ±×´ÙÀ½À¸·Î ÀÌµ¿ÇÑ´Ù.
'               ex) <input type=text name=txt_test maxlength=4 onkeypress=fc_auto_next_focus()>
'               Áö¼ÓÀûÀ¸·Î °íÃÄ¾ß ÇÒµí ¤Ñ¤Ñ;;
' Argument    :
' Return      : 
' ------------------------------------------------------------------
*/
function fc_auto_next_focus()
{
   // ÀÌº¥Æ®°¡ ÀÏ¾î³­ °´Ã¼¸¦ ¹Þ´Â´Ù.
   var lo_this        = window.event.srcElement;
   
   // ÇØ´ç°´Ã¼ÀÇ maxlength¸¦ ¹Þ´Â´Ù.
   var li_max_length  = lo_this.maxLength;

   // 0ÀÌ»ó 100ÀÌÇÏÀÎ°Í¸¸ Æ÷Ä¿½º¸¦ ÀÌµ¿ÇÑ´Ù.
   if(li_max_length > 0 && li_max_length < 100)
   {
      // ÀüÃ¼ ÄÁÆ®·ÑµéÀ» µ¹¸é¼­
      for (i=(document.all.length-1); i>=0; i--)
      {
         // ÇöÀç ÀÌº¥Æ®°¡ ÀÏ¾î³­ ´ÙÀ½ ÄÁÆ®·Ñ·Î Æ÷Ä¿½º¸¦ ÀÌµ¿ÇÑ´Ù.
         if(document.all[i] == lo_this)
         {
            // maxLength¸¦ Ã¼Å©ÇÑ´Ù.
            if(lo_this.value.length >= li_max_length)
            {
               // °´Ã¼°¡ Á¸ÀçÇÏ°í È÷µçÄÁÆ®·ÑÀÌ ¾Æ´Ò°æ¿ì¸¸ Æ÷Ä¿½º¸¦ ÀÌµ¿ÇÑ´Ù.
               if(document.all[i+1] != undefined && document.all[i+1].type != "HIDDEN")
               {
                  document.all[i+1].focus();
                  break;
               }
               else
               {
                  break;
               }
            }
            else
            {
               break;
            }
         }
      }
   }
}

/*
' ------------------------------------------------------------------
' Function    : fc_trim(ars_value)
' Description : °ø¹éÀ» ¸ðµÎ³¯¸²
' Argument    : String Ä¡È¯ÇÒ ¹®ÀÚ
' Return      : String °ø¹éÀ» Á¦°ÅÇÑ ¹®ÀÚ
' ------------------------------------------------------------------
*/
function fc_trim(ars_value)
{
   return ars_value.replace(/\s/g,'');
}

/*
' ------------------------------------------------------------------
' Function    : fc_del_coma(ars_value)
' Description : ÄÄ¸¶¸¦ ³¯¸²
' Argument    : String Ä¡È¯ÇÒ ¹®ÀÚ
' Return      : String ÄÄ¸¶¸¦ Á¦°ÅÇÑ ¹®ÀÚ
' ------------------------------------------------------------------
*/
function fc_del_coma(ars_value)
{
   return ars_value.replace(/,/g,'');
}

// ¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á
// Begin °¢Á¾Ã¼Å© ÇÔ¼ö
// ¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á

/*
' ------------------------------------------------------------------
' Function    : fc_han_chk(ars_str)
' Description : ÇÑ±ÛÀÎÁö ¾Æ´ÑÁö Ã¼Å©ÇÑ´Ù.Á¤±ÔÇ¥Çö½ÄÀ» ÀÌ¿ëÇÑ´Ù.
' Argument    : String Ã¼Å©ÇÒ ¹®ÀÚ
' Return      : ÇÑ±ÛÀÌ¸é true ¿µ¹®ÀÌ¸é false
' ------------------------------------------------------------------
*/
function fc_han_chk(ars_str)
{
   var lo_pattern = /[°¡-Èþ]/;

   return (lo_pattern.test(ars_str)) ? true : false;
}


/*
' ------------------------------------------------------------------
' Function    : fc_name_check(ars_name)
' Description : ÀÌ¸§ À¯È¿¼ºÃ¼Å©
' Argument    : String Ã¼Å©ÇÒ ¹®ÀÚ
' Return      : Á¤»óÀûÀÎ ÀÌ¸§ÀÌ¸é true ±×¹Ü¿¡´Â false
' ------------------------------------------------------------------
*/
function fc_name_check(ars_name)
{
   var lo_pattern = /[ ^@&#$*!%\\|.,\/?0-9a-zA-Z]/;
   return (lo_pattern.test(ars_name)) ? false : true;
}

/*
' ------------------------------------------------------------------
' Function    : fc_email_check(ars_str)
' Description : ÀÌ¸ÞÀÏ Ã¼Å©ÇÔ¼ö
' Argument    : String Ã¼Å©ÇÒ ¹®ÀÚ
' Return      : Á¤»óÀûÀÌ¸é true ºñÁ¤»óÀûÀÌ¸é false
' ------------------------------------------------------------------
*/
function fc_email_check(ars_str)
{
   var lo_pattern = /^[_a-zA-Z0-9-\.]+@[\.a-zA-Z0-9-]+\.[a-zA-Z]+$/;
   return (lo_pattern.test(ars_str)) ? true : false;
}

/*
' ------------------------------------------------------------------
' Function    : fc_id_check(ars_str)
' Description : ¾ÆÀÌµð Ã¼Å©ÇÔ¼ö
' Argument    : String Ã¼Å©ÇÒ ¹®ÀÚ
' Return      : Á¤»óÀûÀÌ¸é true ºñÁ¤»óÀûÀÌ¸é false
' ------------------------------------------------------------------
*/
function fc_id_check(ars_str)
{
   // 5ÀÚÀÌ»ó 21ÀÚ ¹Ì¸¸¸¸ µî·Ï°¡´ÉÇÏµµ·Ï ÇÑ´Ù.
   // ¿µ¹®,¼ýÀÚ, _ ¹®ÀÚ¸¸ »ç¿ëÇÒ ¼ö ÀÖµµ·Ï ÇÑ´Ù.
   var lo_pattern = /^[a-zA-Z]{1}[a-zA-Z0-9_]{4,21}$/;
   return (lo_pattern.test(ars_str)) ? true : false;
}

/*
' ------------------------------------------------------------------
' Function    : fc_passwd_check(ars_str)
' Description : ÆÐ½º¿öµå Ã¼Å©ÇÔ¼ö
' Argument    : String Ã¼Å©ÇÒ ºñ¹Ð¹øÈ£
' Return      : Á¤»óÀûÀÌ¸é true ºñÁ¤»óÀûÀÌ¸é false
' ------------------------------------------------------------------
*/
function fc_passwd_check(ars_str)
{
   // 5ÀÚÀÌ»ó 33ÀÚ ¹Ì¸¸¸¸ µî·Ï°¡´ÉÇÏµµ·Ï ÇÑ´Ù.
   // ¿µ¹®,¼ýÀÚ, _ ¹®ÀÚ¸¸ »ç¿ëÇÒ ¼ö ÀÖµµ·Ï ÇÑ´Ù.
   var lo_pattern = /^[a-zA-Z]{1}[a-zA-Z0-9_]{4,33}$/;
   return (lo_pattern.test(ars_str)) ? true : false;
}

/*
' ------------------------------------------------------------------
' Function    : fc_compare_check(ars_text1,ars_text2)
' Description : °°ÀºÁö ºñ±³
' Argument    : String ºñ±³ÇÒ¹®ÀÚ1,String ºñ±³ÇÒ¹®ÀÚ2
' Return      : Á¤»óÀûÀÌ¸é true ºñÁ¤»óÀûÀÌ¸é false
' ------------------------------------------------------------------
*/
function fc_compare_check(ars_text1,ars_text2)
{
   return (ars_text1 == ars_text2)  ? true : false;
}

/*
' ------------------------------------------------------------------
' Function    : fc_alpha_check(ars_str)
' Description : ¿µ¹®ÀÚ¸¸ »ç¿ë°¡´ÉÃ¼Å©
' Argument    : String Ã¼Å©ÇÒ ¹®ÀÚ
' Return      : Á¤»óÀûÀÌ¸é true ºñÁ¤»óÀûÀÌ¸é false
' ------------------------------------------------------------------
*/
function fc_alpha_check(ars_str)
{
   var lo_pattern = /^[a-zA-Z]+$/;
   return (lo_pattern.test(ars_str)) ? true : false;
}

/*
' ------------------------------------------------------------------
' Function    : fc_num_check(ars_str)
' Description : ¼ýÀÚ¸¸ »ç¿ë°¡´É Ã¼Å©
' Argument    : String Ã¼Å©ÇÒ ¹®ÀÚ
' Return      : Á¤»óÀûÀÌ¸é true ºñÁ¤»óÀûÀÌ¸é false
' ------------------------------------------------------------------
*/
function fc_num_check(ars_str)
{
   var lo_pattern = /^[0-9]+$/;
   return (lo_pattern.test(ars_str)) ? true : false;
}

/*
' ------------------------------------------------------------------
' Function    : fc_jumin_check(ars_str)
' Description : ÁÖ¹Îµî·Ï¹øÈ£ Ã¼Å©
' Argument    : String Ã¼Å©ÇÒ ¹®ÀÚ
' Return      : Á¤»óÀûÀÌ¸é true ºñÁ¤»óÀûÀÌ¸é false
' ------------------------------------------------------------------
*/
function fc_jumin_check(ars_str)
{
   // [¼ýÀÚ 6ÀÚ¸®] ´ÙÀ½ [-] ´ÙÀ½ [¼ýÀÚ 7 ÀÚ¸®] ÀÎÁö Ã¼Å©ÇÑ´Ù.
   var lo_pattern = /^([0-9]{6})-?([0-9]{7})$/; 
   if (!lo_pattern.test(ars_str)) return false;
   
   // - Á¦¿ÜÇÑ °ªÀ» ¹Þ´Â´Ù.
   var li_num   = RegExp.$1 + RegExp.$2;

   var li_sum   = 0;
   var li_last  = li_num.charCodeAt(12) - 0x30;
   var ls_bases = "234567892345";

   for (var i=0; i<12; i++)
   {
      // ¼ýÀÚ°¡ ¾Æ´Ï¸é false
      if (isNaN(li_num.substring(i,i+1))) return false;

      // ÀüÃ¼ÇÕ°è¸¦ ³½´Ù.
      li_sum += (li_num.charCodeAt(i) - 0x30) * (ls_bases.charCodeAt(i) - 0x30);
   }
   var li_mod = li_sum % 11;
   return ((11 - li_mod) % 10 == li_last) ? true : false;
}

/*
' ------------------------------------------------------------------
' Function    : fc_busi_check(ars_str)
' Description : »ç¾÷ÀÚµî·Ï¹øÈ£ Ã¼Å©
' Argument    : String Ã¼Å©ÇÒ ¹®ÀÚ
' Return      : Á¤»óÀûÀÌ¸é true ºñÁ¤»óÀûÀÌ¸é false
' ------------------------------------------------------------------
*/
function fc_busi_check(ars_str) 
{
   // Ã¼Å©¿¹ 609-11-80753 Çü½Ä¿¡ ¸Â´ÂÁö Ã¼Å©ÇÑ´Ù.
   var lo_pattern = /([0-9]{3})-?([0-9]{2})-?([0-9]{5})/;
   if (!lo_pattern.test(ars_str)) return false; 

   // - Á¦¿ÜÇÑ °ªÀ» ¹Þ´Â´Ù.
   var li_num  = RegExp.$1 + RegExp.$2 + RegExp.$3;
   var li_cval = 0;
   
   for (var i=0; i<8; i++)
   { 
      var li_key_num = parseInt(((_tmp = i % 3) == 0) ? 1 : ( _tmp  == 1 ) ? 3 : 7);
      li_cval += (parseFloat(li_num.substring(i,i+1)) * li_key_num) % 10; 
   } 
   var ls_temp = parseFloat(li_num.substring(i,i+1)) * 5 + '0';
   li_cval += parseFloat(ls_temp.substring(0,1)) + parseFloat(ls_temp.substring(1,2));
   
   return (parseInt(li_num.substring(9,10)) == 10-(li_cval % 10)%10) ? true : false; 
}


/*
' ------------------------------------------------------------------
' Function    : fc_phone_check(ars_str)
' Description : ÀüÈ­¹øÈ£ Ã¼Å©
' Argument    : String Ã¼Å©ÇÒ ¹®ÀÚ
' Return      : Á¤»óÀûÀÌ¸é true ºñÁ¤»óÀûÀÌ¸é false
' ------------------------------------------------------------------
*/
function fc_phone_check(ars_str)
{
   var lo_pattern = /^([0]{1}[0-9]{1,2})-?([1-9]{1}[0-9]{2,3})-?([0-9]{4})$/;
   return (lo_pattern.test(ars_str)) ? true : false;   
}

// ¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á
// End °¢Á¾Ã¼Å© ÇÔ¼ö
// ¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á¡á

/*
' ------------------------------------------------------------------
' Function    : fc_form_hidden(ars_form,ars_name,ars_value)
' Description : Æû¿¡¼­ hidden ÄÁÆ®·ÑÀ» »ðÀÔÇÏ´Â ÇÔ¼ö
' Argument    : String ÆûÀÌ¸§,String »ðÀÏÇÒ °´Ã¼ÀÌ¸§,String »ðÀÔÇÒ °ª
' Return      : 
' ------------------------------------------------------------------
*/
function fc_form_hidden(ars_form,ars_name,ars_value)
{
   var ls_html = "";

   ls_html = "<input type=\"hidden\" name=\"" + ars_name  + "\">";

   eval("document.all." + ars_form ).insertAdjacentHTML("beforeEnd", ls_html);
   eval("document.all." + ars_form + "." + ars_name).value = ars_value;
}

/*
' ------------------------------------------------------------------
' Function    : fc_form_reset(aro_form)
' Description : ÆûÀ» ¸®¼Â½ÃÅ°´Â ÇÔ¼ö
' Argument    : Object Æû
' Return      : 
' ------------------------------------------------------------------
*/
function fc_form_reset(aro_form)
{
   aro_form.reset();
}

/*
' ------------------------------------------------------------------
' Function    : fc_display(ars_name)
' Description : display ¼Ó¼ºÀ» Á¦¾îÇÑ´Ù. ÇöÀç¼Ó¼ºÀ» º¸°í noneÀÏ°æ¿ì´Â º¸ÀÌ°Ô
'               ¹Ý´ëÀÏ °æ¿ì¿¡´Â noneÀ¸·Î ¾Èº¸ÀÌ°Ô Á¦¾îÇÑ´Ù.
' Argument    : Á¦¾îÇÒ °´Ã¼ÀÌ¸§
' Return      : 
' ------------------------------------------------------------------
*/
function fc_display(ars_name)
{
   var lo_name = eval("document.all." + ars_name);

   if(lo_name.style.display == "")
   {
      lo_name.style.display = "none";
   }
   else
   {
      lo_name.style.display = "";
   }
}

/*
' ------------------------------------------------------------------
' Function    : fc_querystring(ars_name)
' Description : urlÀÇ querystringÀ» ¸®ÅÏ 
' Argument    : String Ã¼Å©ÇÒ ÆÄ¶ó¸ÞÅ¸
' Return      : String ÆÄ¶ó¸ÞÅ¸ÀÇ °ª
' ------------------------------------------------------------------
*/
function fc_querystring(ars_name)
{
   var lo_result    = new Array;
   var ls_url_query = location.search; // url¿¡¼­ ? ºÎÅÍÀÇ ¹®ÀÚ¿­
   var lo_array1    = new Array; // & ·Î ºÐ¸®½ÃÅ² °ªÀÌ µé¾î°¥¹è¿­
   var lo_array2    = new Array; // = ·Î ºÐ¸®½ÃÅ² °ªÀÌ µé¾î°¥¹è¿­
   var i = 0;

   ls_url_query = ls_url_query.slice(1);      // Ã¹¹®ÀÚ ?´Â ÀÚ¸£°í
   lo_array1    = ls_url_query.split("&");    // & ¹è¿­·Î ³ª´«´Ù.

   for(i=0; i< lo_array1.length; i++)
   {
      lo_array2 = lo_array1[i].split("=");    // = ¹è¿­³ª´©±â
      lo_result[lo_array2[0]] = lo_array2[1]; // °á°ú¸¦ lo_result¿¡ ÀúÀå
   }   

   if(lo_result[ars_name] != null)
   {      
      return lo_result[ars_name];      
   }
   else
   {      
      return "";
   }
}

/*
' ------------------------------------------------------------------
' Function    : fc_color_init()
' Description : »ö±òÀ» ¼±ÅÃÇÏ´Â Layer¸¦ ÃÊ±âÈ­ÇÑ´Ù.
'               ¿¹Á¦ <input type="button" value="»ö»ó¼±ÅÃ" onclick="fc_color_init(this);">
'               fc_color_over()¿Í  fc_color_click() µîÀº ¼ÂÆ®´Ù
' Argument    : Object ÇØ´çÆûÀÇ object
' Return      : 
' ------------------------------------------------------------------
*/
// Àü¿ªº¯¼ö ¼±¾ð
var go_div_color;

function fc_color_init(aro_obj)
{
   // ÀÌº¥Æ®°¡ ÀÏ¾î³­ °´Ã¼¸¦ ¹Þ´Â´Ù.
   go_div_color = window.event.srcElement;
   var ls_color = go_div_color.style.backgroundColor;
   //alert(ls_color);

   var x,y;
   x = (document.layers) ? loc.pageX : event.clientX;
   y = (document.layers) ? loc.pageY : event.clientY;

   lo_map = new Array(9);
   lo_map[0] = new Array("black", "lime",   "#fefefe","#fefefc","#fff7f7","#fefcfc","#fffff7","#fffaf4","#f7fff7","#f4faff","#f7f7ff","#fafcfc","#f7fbff","#fff4fa","#f4fcff","#f7f7ff","#fafafc","#fffbfd","#fff4ff","#f8f0ff","#f9fdf9","#fcfaf8","#fffdf4","#f5faf9","#f8f9fc","#fcfcf1","#fef8f5","#faf0fb","#f2fcfd","#00ff80","#a4fc22");
   lo_map[1] = new Array("white", "aqua",   "#e6e6e6","#fafaf3","#ffeeee","#f8efef","#ffffe8","#fff2e6","#e8ffe8","#dfefff","#e1e1ff","#eef7f7","#e6f2ff","#ffe8f3","#e6f7ff","#e8e8ff","#eeeef7","#ffe6f2","#ffdfff","#ebd7ff","#edf8ed","#f5efeb","#fff8dd","#e6f2ee","#dfe6f0","#f3f2d3","#fbebe8","#efdaf3","#d1f4f8","#4563c9","#af6cd3");
   lo_map[2] = new Array("green", "fuchsia","#d7d7d7","#f0f0e1","#ffd7d7","#f2e6e6","#ffffd9","#ffe8d0","#d2ffd2","#cae4ff","#d2d2ff","#daeded","#cee7ff","#ffd8eb","#c8edff","#d2d2ff","#e1e1f0","#ffd2e9","#ffcaff","#ddbbff","#dff0df","#eee2db","#fef0c0","#cfe9e1","#ccd6e8","#eeecbd","#f7d9cc","#e4beeb","#b1eef3","#6a6a00","#ac67ff");
   lo_map[3] = new Array("maroon","silver", "#c3c3c3","#e1e1c4","#ffbfbf","#eddcdc","#ffffca","#ffddbb","#97ff97","#acd6ff","#b3b3ff","#bddfdf","#b3d9ff","#ffbbdd","#b0e6ff","#c1c1ff","#cbcbe4","#ffbfdf","#ffb5ff","#ce9dff","#c7e6c6","#e1cfc4","#fee89c","#b9ddd2","#b6c4de","#e9e6a9","#f2c2ae","#dba7ea","#91e7ee","#623131","#c4a2f5");
   lo_map[4] = new Array("olive", "red",    "#a8a8a8","#d1d1a5","#ffb0b0","#e6cece","#ffffb0","#ffd2a6","#60ff60","#88c4ff","#8e8eff","#9ecfcf","#95caff","#ffa4d1","#86d8ff","#aaaaff","#b9b9dd","#ffa2d0","#ff95ff","#c286ff","#aedaad","#d5baaa","#fee17e","#a9d6c8","#9cafd1","#e3df93","#eeb399","#cd87da","#6bdfe9","#ff0b0b","#12fc45");
   lo_map[5] = new Array("navy",  "blue",   "#919191","#c2c287","#ffa2a2","#debebe","#ffff95","#ffc68c","#17ff17","#66b3ff","#7777ff","#88c4c4","#71b8ff","#ff86c2","#55c8ff","#9393ff","#a6a6d2","#ff86c2","#ff6fff","#b062ff","#8cca8a","#c59e87","#fed74e","#89c7b5","#7a94c2","#dad570","#e99a78","#bf63cf","#48d8e3","#ffa244","#afafa3");
   lo_map[6] = new Array("purple","teal",   "#747474","#b1b165","#ff8e8e","#d7b0b0","#ffff75","#ffa346","#00f000","#359aff","#5353ff","#70b8b8","#4aa5ff","#ff53a9","#17b4ff","#7979ff","#8d8dc7","#ff68b4","#ff1eff","#a042ff","#6abd68","#ba8e74","#fdcb20","#71bba5","#617eb6","#d1cb4e","#e48358","#b143c5","#23d0de","#ade12f","#11ff54");
   lo_map[7] = new Array("gray",  "#076767","#616161","#a0a050","#ff6f6f","#c99292","#f0f000","#ff8e1e","#00d900","#0078f0","#1111ff","#51a2a2","#3399ff","#ff0f87","#0099e3","#5555ff","#7777bb","#ff3399","#e800e8","#850bff","#4faa4d","#ab7554","#d9a902","#5eb399","#4b6aa5","#b5ae2f","#de6632","#9733a8","#1eb9c6","#c3da45","#f3ff8c");
   lo_map[8] = new Array("yellow","#076767","#414141","#808040","#ff5b5b","#b56868","#b0b000","#dd6f00","#00ae00","#0066cc","#0000b5","#428282","#0b85ff","#c40062","#0077b0","#0b0bff","#5353a8","#ca0065","#b000b0","#6300c6","#418f3f","#8e6246","#b68d01","#499a82","#3a5381","#8c8724","#c15120","#732781","#17949d","#a600a6","#bfac54");

	var lo_div = document.getElementById("div_color");

   
   if(!lo_div)
   {      
      ls_html = "";
      ls_html = ls_html + "<div id='div_color' name='div_color' oncontextmenu='return false' ondragstart='return false' onselectstart='return false' style=\"background:buttonface; margin:5; padding:5;margin-top:2;border-top:1 solid buttonshadow;border-left: 1 solid buttonshadow;border-right: 1 solid buttonshadow;border-bottom:1 solid buttonshadow;width:160;display:none;position: absolute; z-index: 99; cursor:crosshair;\"><table border=0 cellpadding=1 cellspacing=1 width=250 bgcolor=black id=tbl_div_color><tr><td width=70 bgcolor=white align=center><p><font face=±¼¸²Ã¼ size=2>ÇöÀç»ö»ó</font></td>";
      ls_html = ls_html + "<td width=80 bgcolor='"+ls_color+"'></td>";
      ls_html = ls_html + "<td width=100 align=center><form name=frm_div_color method=get><input type=text name=txt_div_color maxlength=11 size=11 style=\"text-align:center\"></td>";
      ls_html = ls_html + "</tr></table>";
      ls_html = ls_html + "<table border=0 cellpadding=0 cellspacing=1 width=420 height = 120 bgcolor=black>";
      ls_html = ls_html + "<tr><td id='td_colors'>";

		ls_html = ls_html + "<table border=0 cellpadding=0 cellspacing=1 width=420 height = 120 bgcolor=black>";

      for(i=0; i<9; i++)
      {
         ls_html = ls_html + "</tr><tr>";
         for(j=0; j<31; j++)
         {
            ls_html = ls_html + "<TD BGCOLOR=\""+lo_map[i][j]+"\" onMouseOver=fc_color_over('"+lo_map[i][j]+"') onClick=\"fc_color_click('"+lo_map[i][j]+"', '"+aro_obj+"')\"><P></TD>";
         }
      }
      ls_html = ls_html + "</tr></table>";
      ls_html = ls_html + "</td></tr></table></div>";

      document.body.insertAdjacentHTML("beforeEnd", ls_html);
   
   }
	else {
		var lo_div = document.getElementById("td_colors");
		if(lo_div)
		{
			lo_div.innerHTML = "";
			ls_html = "";

			ls_html = ls_html + "<table border=0 cellpadding=0 cellspacing=1 width=420 height = 120 bgcolor=black>";

			for(i=0; i<9; i++)
			{
				ls_html = ls_html + "</tr><tr>";
				for(j=0; j<31; j++)
				{
					ls_html = ls_html + "<TD BGCOLOR=\""+lo_map[i][j]+"\" onMouseOver=fc_color_over('"+lo_map[i][j]+"') onClick=\"fc_color_click('"+lo_map[i][j]+"', '"+aro_obj+"')\"><P></TD>";
				}
			}
			ls_html = ls_html + "</tr></table>";
			lo_div.innerHTML = ls_html;
		}
	}

   //alert(lo_this.style.Top);
   //alert(lo_this.style.posLeft);

   document.all.div_color.style.pixelTop  = y+7;
   document.all.div_color.style.pixelLeft = x-50;
   document.all.div_color.style.display   = (document.all.div_color.style.display == "block") ? "none" : "block";
   
   // ÇØ´ç Ä®¶ó Å×ÀÌºíÀÇ µÎ¹øÂ° ¼¿ÀÇ »ö±òÀ» º¯°æÇÑ´Ù.
   tbl_div_color.rows[0].cells[1].style.backgroundColor=ls_color;
	return ls_color;
}

/*
' ------------------------------------------------------------------
' Function    : fc_color_over(ars_color)
' Description : ¸¶¿ì½º°¡ overµÇ¸é »ö»óÀ» µ¿ÀûÀ¸·Î º¯°æÇØÁØ´Ù.
' Argument    : String º¯°æÇÒ Color
' Return      : 
' ------------------------------------------------------------------
*/
function fc_color_over(ars_color)
{
   frm_div_color.txt_div_color.style.backgroundColor = ars_color;   
}

/*
' ------------------------------------------------------------------
' Function    : fc_color_click(ars_color)
' Description : ¸¶¿ì½º¸¦ Å¬¸¯ÇÏ¸é ·¹ÀÌ¾î¸¦ °¨Ãß°í ÇØ´ç»ö»óÀ» È£ÃâÇÑ ¹öÆ°ÀÇ background-color·Îº¯°æÇÑ´Ù.
' Argument    : String º¯°æÇÒ Color
' Return      : 
' ------------------------------------------------------------------
*/
function fc_color_click(ars_color, aro_obj)
{
   document.all.div_color.style.display = "none";
   // Àü¿ªº¯¼ö·Î ¼±¾ðµÈ °´Ã¼ÀÇ ¹é±×¶ó¿îµå »ö±òÀ» º¯°æÇÑ´Ù.
   go_div_color.style.backgroundColor = ars_color;
	try
	{
		f_cal_color(ars_color, aro_obj);
	}
	catch (e)
	{
	}
}

/*
' ------------------------------------------------------------------
' Function    : fc_pre_load()
' Description : ÀÌ¹ÌÁö¸¦ ¹Ì¸® ºÒ·¯¿Ã¶§ »ç¿ëÇÔ ¿¹Á¦  body onload="fc_pre_load('a.gif','b.gif'...)"
' Argument    : °¡º¯ÀûÀ¸·Î º¯ÇÑ´Ù.
' Return      : 
' ------------------------------------------------------------------
*/
function fc_pre_load()
{
   if (!document.images) return;
   var lo_array = new Array(); 
   var lo_arguments = fc_pre_load.arguments; // ¹ÞÀº ¾ÆÅ¥¸ÕÆ®¼ö
   
   for (var i = 0; i < lo_arguments.length; i++)
   {
      lo_array[i] = new Image();
      lo_array[i].src = lo_arguments[i];
  }
}

/*
' --------------------------------------------------------------------------------------------------
' Function    : fc_hour_select(ars_hour)
' Description : ½Ã°£À» ¼±ÅÃÇÑ´Ù. ½Ã°£ÀÌ ÀÖÀ¸¸é ¼±ÅÃÇØÁØ´Ù.
' Argument    : String ½Ã°£
' Return      : String ¿É¼Ç¹Ú½º
' --------------------------------------------------------------------------------------------------
*/
function fc_hour_select(ars_hour)
{
   var i,ls_option,ls_hour;

   ls_option = "";

   for(i=0; i<=24; i++)
   {
      ls_hour = i < 10 ? "0"+i : i;
      
      // ½Ã°£ÀÌ µ¿ÀÏÇÏ¸é
      if(ls_hour == ars_hour)
      {
         ls_option = ls_option + "<option value=\"" + ls_hour + "\" selected>" + ls_hour + "½Ã</option>";
      }
      else
      {
         ls_option = ls_option + "<option value=\"" + ls_hour + "\">" + ls_hour + "½Ã</option>";
      }
   }
   return ls_option;
}

/*
' --------------------------------------------------------------------------------------------------
' Function    : fc_minute_select(ars_minute)
' Description : ºÐÀ» ¼±ÅÃÇÑ´Ù. ºÐÀÌ ÀÖÀ¸¸é ¼±ÅÃÇØÁØ´Ù.
' Argument    : String ºÐ
' Return      : String ¿É¼Ç¹Ú½º
' --------------------------------------------------------------------------------------------------
*/
function fc_minute_select(ars_minute)
{
   var i,ls_option,ls_minute;

   ls_option = "";

   for(i=0; i<=59; i++)
   {
      ls_minute = i < 10 ? "0"+i : i;
      
      // ½Ã°£ÀÌ µ¿ÀÏÇÏ¸é
      if(ls_minute == ars_minute)
      {
         ls_option = ls_option + "<option value=\"" + ls_minute + "\" selected>" + ls_minute + "ºÐ</option>";
      }
      else
      {
         ls_option = ls_option + "<option value=\"" + ls_minute + "\">" + ls_minute + "ºÐ</option>";
      }
   }
   return ls_option;
}

/*
' --------------------------------------------------------------------------------------------------
' Function    : fc_zip_search(ars_return1,ars_return2,ars_return3,ars_return4)
' Description : ¿ìÆí¹øÈ£ °Ë»öÈ­¸éÀ» ¶Ù¿î´Ù.
' Argument    : String ¿ìÆí¹øÈ£1,String ¿ìÆí¹øÈ£2,String ÁÖ¼Ò,String »ó¼¼ÁÖ¼Ò
' Return      : 
' --------------------------------------------------------------------------------------------------
*/
function fc_zip_search(ars_return1,ars_return2,ars_return3,ars_return4)
{
   var ls_url = "";
   
   ls_url = ls_url + gs_url_path + "/common/pc_zip_search.php";
   ls_url = ls_url + "?return1=" + ars_return1;
   ls_url = ls_url + "&return2=" + ars_return2;
   ls_url = ls_url + "&return3=" + ars_return3;
   ls_url = ls_url + "&return4=" + ars_return4;

   window.open(ls_url,'','width=436,height=300,scrollbars=yes');
}

/*
' --------------------------------------------------------------------------------------------------
' Function    : fc_dong_check(aro_form)
' Description : ¿ìÆí¹øÈ£ °Ë»ö½Ã °Ë»ö¾î°¡ Á¸ÀçÇÏÁö ¾ÊÀ» °æ¿ì Ã¼Å©
' Argument    : Object Æû
' Return      : 
' --------------------------------------------------------------------------------------------------
*/
function fc_dong_check(aro_form)
{
  if (aro_form.txt_dong.value=="")
  {
    alert("Ã£À» µ¿ÀÌ °ø¹éÀÔ´Ï´Ù. \n\n È®ÀÎÇÏ¿© ÁÖ¼¼¿ä.");
    aro_form.txt_dong.focus();
    return false;
  }
}

/*
' --------------------------------------------------------------------------------------------------
' Function    : fc_zip_send(ars_zipcode1,ars_zipcode2,ars_addr,ars_return1,ars_return2,ars_return3,ars_return4)
' Description : È£ÃâÇÑ °÷À¸·Î ¿ìÆí¹øÈ£ ¹× »ó¼¼ÁÖ¼Ò¸¦ Àü¼ÛÇÏ°í Ã¢À» ´Ý´Â´Ù.
' Argument    : Object Æû
' Return      : 
' --------------------------------------------------------------------------------------------------
*/
function fc_zip_send(ars_zipcode1,ars_zipcode2,ars_addr,ars_return1,ars_return2,ars_return3,ars_return4)
{
  eval("opener.top.document.all." + ars_return1).value = ars_zipcode1;
  eval("opener.top.document.all." + ars_return2).value = ars_zipcode2;
  eval("opener.top.document.all." + ars_return3).value = ars_addr;
  eval("opener.top.document.all." + ars_return4).focus();
  self.close();  
}


/*
' --------------------------------------------------------------------------------------------------
' Function    : fc_over_check(ars_table,ars_field,ars_value,ars_name,ars_string)
' Description : ÇØ´çÅ×ÀÌºíÀÇ ÇÊµå°ªÀÌ Áßº¹µÇ¾ú´ÂÁö Ã¼Å©ÇÑ´Ù.
' Argument    : String Å×ÀÌºí¸í,ÇÊµå,°ª,ÀÌ¸§,¸®ÅÏ°ª
' Return      : 
' --------------------------------------------------------------------------------------------------
*/
function fc_over_check(ars_table,ars_field,ars_value,ars_name,ars_string)
{
   var ls_arg= "";   

   if(eval("document.all." + ars_name).value == "")
   {
      alert("[ " + ars_string + " ] ÀÌ(°¡) °ø¹éÀÔ´Ï´Ù. \n\n È®ÀÎÇÏ¿© ÁÖ¼¼¿ä.");      
      eval("document.all." + ars_name).focus();
   }
   else
   {
      ls_arg = ls_arg + gs_url_path + "/common/ac_overlap_check.asp";
      ls_arg = ls_arg + "?table=" + ars_table;
      ls_arg = ls_arg + "&field=" + ars_field;
      ls_arg = ls_arg + "&value=" + ars_value;
      ls_arg = ls_arg + "&name=" + ars_name;
      ls_arg = ls_arg + "&string=" + ars_string;
      j_dynamic.src = ls_arg;
      //fc_dynamic_chk(ls_arg);
   }
}


/*
' --------------------------------------------------------------------------------------------------
' Function    : fc_keycode()
' Description : Å°ÄÚµå¸¦ È®ÀÎÇÒ¶§ »ç¿ëÇÏ´Â ÇÔ¼ö
'               »ç¿ë¹ý fc_keycode() ÇÔ¼ö¸¦ È£ÃâÇÏ¸é ÇØ´çÃ¢ÀÌ ¶ä..
' Argument    : 
' Return      : 
' --------------------------------------------------------------------------------------------------
*/
function fc_keycode()
{
   var ls_html = "";
   var lo_win;

   ls_html = ls_html + "<html>\n";
   ls_html = ls_html + "<head>\n";
   ls_html = ls_html + "<title>Press Any Key</title>\n";
   ls_html = ls_html + "</head>\n";
   ls_html = ls_html + "<body onkeydown=\"alert('The keyCode is ' + window.event.keyCode)\" style=\"font-family: verdana; font-size: 12px; background-color: buttonface; border: 0; color: buttontext; text-align: center;\" scroll=\"no\">\n";
   ls_html = ls_html + "Press Any Key\n";
   ls_html = ls_html + "</body>\n";
   ls_html = ls_html + "<script>\n";
   ls_html = ls_html + "window.resizeTo(200,100);\n";
   ls_html = ls_html + "<\/script>\n";
   ls_html = ls_html + "</html>\n";

   lo_win = window.open("","win_keycode","width=200,height=100");

   lo_win.document.write(ls_html);
}

/*
' --------------------------------------------------------------------------------------------------
' Function    : fc_all_blur()
' Description : Å¬¸¯ÇÒ¶§ ÀÚ±¹À» ¾ø¾Ø´Ù.
' Argument    : 
' Return      : 
' --------------------------------------------------------------------------------------------------
*/
function fc_all_blur()
{
   for (i = 0; i < document.links.length; i++) document.links[i].onfocus = document.links[i].blur;
}
// document.onfocusin = fc_all_blur;


/*
' --------------------------------------------------------------------------------------------------
' Function    : fc_get_x(aro_name)
' Description : ¿ÀºêÁ§Æ®ÀÇ x À§Ä¡¸¦ ¾Ë¾Æ³½´Ù.
' Argument    : Object ÀÌ¸§
' Return      : 
' --------------------------------------------------------------------------------------------------
*/
function fc_get_x(aro_name)
{
   return (!aro_name||aro_name==document.body) ? 0 : aro_name.offsetLeft + fc_get_x(aro_name.offsetParent);
}

/*
' --------------------------------------------------------------------------------------------------
' Function    : fc_get_y(aro_name)
' Description : ¿ÀºêÁ§Æ®ÀÇ y À§Ä¡¸¦ ¾Ë¾Æ³½´Ù.
' Argument    : Object ÀÌ¸§
' Return      : 
' --------------------------------------------------------------------------------------------------
*/
function fc_get_y(aro_name)
{
   return (!aro_name||aro_name==document.body) ? 0 : aro_name.offsetTop + fc_get_y(aro_name.offsetParent);
}

/*
' --------------------------------------------------------------------------------------------------
' Function    : fc_server_time()
' Description : ¼­¹ö½Ã°£À» °¡Á®¿Â´Ù.
' Argument    : 
' Return      : 
' --------------------------------------------------------------------------------------------------
*/
function fc_server_time()
{
   // »õ·Ó°Ô º¯°æµÈ ³»¿ëÀ» °¡Áö°í ¿À±â À§ÇØ¼­
   // randomÇÑ ¼ýÀÚ¸¦ »ý¼ºÇØ¼­ °°ÀÌ ³Ñ°ÜÁØ´Ù.
   var ls_arg = Math.random();

   return fc_http_get(gs_url_path + "/common/ac_get_time.asp?arg=" + ls_arg);
}

/*
' --------------------------------------------------------------------------------------------------
' Function    : fc_http_get(ls_url)
' Description : xmlhttp¸¦ ÀÌ¿ëÇÑ µ¥ÀÌÅÍ °¡Á®¿À±â
' Argument    : String µ¥ÀÌÅÍ¸¦ °¡Á®¿Ã url
' Return      : 
' --------------------------------------------------------------------------------------------------
*/
function fc_http_get(ls_url)
{
   // --------------------------------------------------------------------------------------------------
   // Begin xmlhttp¸¦ ÀÌ¿ëÇÑ µ¥ÀÌÅÍ Ã³¸®
   // 2003-12-02 ±¸ÇüÁø
   // xmlhttp¸¦ ÀÌ¿ëÇÏ¿© µ¥ÀÌÅÍ¸¦ ½Ç½Ã°£À¸·Î Ã³¸®ÇÑ´Ù.
   // --------------------------------------------------------------------------------------------------   

   var lo_http = new ActiveXObject("MSXML2.XMLHTTP");
   lo_http.open("GET",ls_url,false);    
   lo_http.setRequestHeader("Content-type:","text/html");
   //lo_http.setRequestHeader("Content-Encoding:","utf-8");
   //lo_http.setRequestHeader( "Content-type:", "application/x-www-form-urlencoded");
   lo_http.setRequestHeader("Content-Encoding:", "euc-kr");

   
   //lo_http.onreadystatechange = fc_http_complete;
   
   lo_http.send();

   if (lo_http.status > 200)
   {
      alert("200 Error");
      return false;
   }
   else
   {
      return lo_http.responseText;
   }
}

/*
' --------------------------------------------------------------------------------------------------
' Function    : fc_http_complete()
' Description : µ¥ÀÌÅÍ°¡ µµÂøÇÏ¸é µ¥ÀÌÅÍ¸¦ Ã³¸®ÇÏ´Â ÇÔ¼ö
' Argument    : 
' Return      : 
' --------------------------------------------------------------------------------------------------
*/
function fc_http_complete()
{
   if (lo_http.readyState == 4)
   {
      lo_http.onreadystatechange = fc_http_noop;
      // ¼­¹ö½Ã°£À» ¼³Á¤ÇØÁØ´Ù.
      //return lo_http.responseText;
   }
}

/*
' --------------------------------------------------------------------------------------------------
' Function    : fc_http_noop()
' Description : flase°ªÀ» ¸®ÅÏÇÑ´Ù.
' Argument    : 
' Return      : 
' --------------------------------------------------------------------------------------------------
*/
function fc_http_noop()
{
   return false; 
}
// --------------------------------------------------------------------------------------------------
// End xmlhttp¸¦ ÀÌ¿ëÇÑ µ¥ÀÌÅÍ Ã³¸®
// 2003-12-02 ±¸ÇüÁø
// xmlhttp¸¦ ÀÌ¿ëÇÏ¿© µ¥ÀÌÅÍ¸¦ ½Ç½Ã°£À¸·Î Ã³¸®ÇÑ´Ù.
// --------------------------------------------------------------------------------------------------

/*
' --------------------------------------------------------------------------------------------------
' Function    : fc_zero(ari_num)
' Description : 10º¸´Ù ÀÛÀ»°æ¿ì´Â ¾Õ¿¡ 0À» ºÙ¿©¼­ ¸®ÅÏÇÑ´Ù.
' Argument    : Integer º¯È¯ÇÒ¼ýÀÚ
' Return      : 
' --------------------------------------------------------------------------------------------------
*/
function fc_zero(ari_num)
{
   return (parseInt(ari_num) < 10) ? "0" + String(ari_num) : ari_num;
}

/*
' --------------------------------------------------------------------------------------------------
' Function    : fc_dynamic_chk(ars_url)
' Description : µ¿ÀûÀ¸·Î °ªÀ» ¹ÝÈ¯ÇÏ´Â ±¸¹®Ã¼Å©
' Argument    : String Ã¼Å©ÇÒurl
' Return      : 
' --------------------------------------------------------------------------------------------------
*/
function fc_dynamic_chk(ars_url)
{
   
   var ls_html = "";

   ls_html += "<a href=\"" + ars_url + "\">" + ars_url + "</a><br><br>";
   ls_html += fc_http_get(ars_url);  

   try
   {
      var lo_div_sql = document.getElementById("div_sql");
      lo_div_sql.innerHTML = ls_html;
   }
   catch(e)
   {
      document.body.insertAdjacentHTML("afterBegin","<div id=div_sql></div>");
      var lo_div_sql = document.getElementById("div_sql");
      lo_div_sql.innerHTML = ls_html;
   }
}


/*
' ------------------------------------------------------------------
' Function    : fc_chk_byte(aro_name)
' Description : ÀÔ·ÂÇÑ ±ÛÀÚ¼ö¸¦ Ã¼Å©
' Argument    : Object Name(±ÛÀÚ¼ö¸¦ Á¦ÇÑÇÒ ÄÁÆ®·Ñ)
' Return      : 
' ------------------------------------------------------------------
*/
function fc_chk_byte(aro_name)
{

   var ls_str     = aro_name.value; // ÀÌº¥Æ®°¡ ÀÏ¾î³­ ÄÁÆ®·ÑÀÇ value °ª
   var li_str_len = ls_str.length;  // ÀüÃ¼±æÀÌ

   // º¯¼öÃÊ±âÈ­
   var li_max      = 10; // Á¦ÇÑÇÒ ±ÛÀÚ¼ö Å©±â
   var i           = 0;  // for¹®¿¡ »ç¿ë
   var li_byte     = 0;  // ÇÑ±ÛÀÏ°æ¿ì´Â 2 ±×¹Ü¿¡´Â 1À» ´õÇÔ
   var li_len      = 0;  // substringÇÏ±â À§ÇØ¼­ »ç¿ë
   var ls_one_char = ""; // ÇÑ±ÛÀÚ¾¿ °Ë»çÇÑ´Ù
   var ls_str2     = ""; // ±ÛÀÚ¼ö¸¦ ÃÊ°úÇÏ¸é Á¦ÇÑÇÒ¼ö ±ÛÀÚÀü±îÁö¸¸ º¸¿©ÁØ´Ù.

   for(i=0; i< li_str_len; i++)
   {
      // ÇÑ±ÛÀÚÃßÃâ
      ls_one_char = ls_str.charAt(i);

      // ÇÑ±ÛÀÌ¸é 2¸¦ ´õÇÑ´Ù.
      if (escape(ls_one_char).length > 4)
      {
         li_byte += 2;
      }
      // ±×¹ÜÀÇ °æ¿ì´Â 1À» ´õÇÑ´Ù.
      else
      {
         li_byte++;
      }

      // ÀüÃ¼ Å©±â°¡ li_max¸¦ ³ÑÁö¾ÊÀ¸¸é
      if(li_byte <= li_max)
      {
         li_len = i + 1;
      }
   }
   
   // ÀüÃ¼±æÀÌ¸¦ ÃÊ°úÇÏ¸é
   if(li_byte > li_max)
   {
      alert( li_max + " ÀÌ»óÀÇ  ±ÛÀÚ¸¦ ÀÔ·ÂÇÒ¼ö ¾ø½À´Ï´Ù. \n ÃÊ°úµÈ ³»¿ëÀº ÀÚµ¿À¸·Î »èÁ¦ µË´Ï´Ù. ");
      ls_str2 = ls_str.substr(0, li_len);
      aro_name.value = ls_str2;
      
   }
   aro_name.focus();   
}

function fc_chk_byte2(ars_value,ari_length)
{

   var ls_str     = ars_value;
   var li_str_len = ls_str.length;  // ÀüÃ¼±æÀÌ

   // º¯¼öÃÊ±âÈ­
   var li_max      = ari_length; // Á¦ÇÑÇÒ ±ÛÀÚ¼ö Å©±â
   var i           = 0;  // for¹®¿¡ »ç¿ë
   var li_byte     = 0;  // ÇÑ±ÛÀÏ°æ¿ì´Â 2 ±×¹Ü¿¡´Â 1À» ´õÇÔ
   var li_len      = 0;  // substringÇÏ±â À§ÇØ¼­ »ç¿ë
   var ls_one_char = ""; // ÇÑ±ÛÀÚ¾¿ °Ë»çÇÑ´Ù
   var ls_str2     = ""; // ±ÛÀÚ¼ö¸¦ ÃÊ°úÇÏ¸é Á¦ÇÑÇÒ¼ö ±ÛÀÚÀü±îÁö¸¸ º¸¿©ÁØ´Ù.

   for(i=0; i< li_str_len; i++)
   {
      // ÇÑ±ÛÀÚÃßÃâ
      ls_one_char = ls_str.charAt(i);

      // ÇÑ±ÛÀÌ¸é 2¸¦ ´õÇÑ´Ù.
      if (escape(ls_one_char).length > 4)
      {
         li_byte += 2;
      }
      // ±×¹ÜÀÇ °æ¿ì´Â 1À» ´õÇÑ´Ù.
      else
      {
         li_byte++;
      }

      // ÀüÃ¼ Å©±â°¡ li_max¸¦ ³ÑÁö¾ÊÀ¸¸é
      if(li_byte <= li_max)
      {
         li_len = i + 1;
      }
   }

   if(li_byte >= li_max)
   {
      return true;
   }
   else
   {
      return false;
   }
}

/*
' ------------------------------------------------------------------
' Function    : fc_ifr_resize()
' Description : iframe Å©±â°¡ resizeµÉ¶§ iframeÀÇ widht¿Í height¸¦ º¯°æ
' Argument    : 
' Return      : 
' ------------------------------------------------------------------
*/
function fc_ifr_resize()
{
   var lo_iframe   = ifr_resize.document.body;   // resizeÇÒ IframeÀÇ body¸¦ ÁöÁ¤
   var lo_iframe2  = document.all["ifr_resize"]; // Iframe °´Ã¼¸¦ ÁöÁ¤ÇÔ

   // IframeÀÇ bodyÀÇ scrollHeight¿Í scrollWidth¸¦ ¹Þ¾Æ¼­
   // IframeÀ» resizeÇÑ´Ù.
   lo_iframe2.style.height = lo_iframe.scrollHeight + (lo_iframe.offsetHeight - lo_iframe.clientHeight);
   lo_iframe2.style.width  = lo_iframe.scrollWidth  + (lo_iframe.offsetWidth - lo_iframe.clientWidth);
}

/*
' ------------------------------------------------------------------
' Function    : fc_ifr_init()
' Description : parentÀÇ fc_ifr_resize¸¦ È£ÃâÇÏ¿© ÇöÀç ¹®¼­ÀÇ Å©±â¸¦ resizeÇÔ
' Argument    : 
' Return      : 
' ------------------------------------------------------------------
*/
function fc_ifr_init()
{
   parent.fc_ifr_resize();
}


/*
' ------------------------------------------------------------------
' Function    : fc_top_mnu_control()
' Description : ÇöÀçURL°ú ºñ±³ÈÄ µð½ºÇÃ·¹ÀÌ¼³Á¤
' Argument    : 
' Return      : 
' ------------------------------------------------------------------
*/
function fc_top_mnu_control()
{
   try
   {
      var lo_mnu   = document.all.tbl_main_mnu;
      var lo_cells;
      
      for(j=0; j < lo_mnu.length; j++)
      {
         lo_cells = lo_mnu[j].rows[0].cells[0];

         // A ÅÂ±×¸¦ µ¹¸é¼­ ÇöÀçURL°ú µ¿ÀÏÇÏ¸é ¸Þ´º¸¦ º¸¿©ÁØ´Ù.
         for(i=0; i < lo_cells.children.length; i++)
         {
            if(document.URL.indexOf(lo_cells.children(i).href) != -1)
            {
               lo_cells.children(i).style.fontWeight ="bold";
               //lo_cells.children(i).style.color ="#0080C0";
               lo_mnu[j].style.display = "";
               break;
            }
         }
      }
   }
   catch(e)
   {}   
}
/*
' ------------------------------------------------------------------
' Function    : fc_top_menu(ari_idx)
' Description : ¸Þ´ºÀÇ µð½ºÇÃ·¹ÀÌ¸¦ ¼³Á¤ÇÑ´Ù.
' Argument    : 
' Return      : 
' ------------------------------------------------------------------
*/
function fc_top_menu(ari_idx)
{
   var lo_main_mnu = document.all.tbl_main_mnu;

   for(i=0; i< lo_main_mnu.length; i++) lo_main_mnu[i].style.display = "none";

   lo_main_mnu[ari_idx].style.display = "";
}

function f_sub_mnu(ari_idx)
{
   var lo_main_mnu = document.all.div_menu;

   for(i=0; i< lo_main_mnu.length; i++) lo_main_mnu[i].style.display = "none";

   lo_main_mnu[ari_idx].style.display = "";
}
function f_go(ars_url)
{
   document.location.href = ars_url;
}

function f_over()
{
   var lo_this = window.event.srcElement;
   var ls_type = window.event.type;

   if(ls_type == "mouseover")
   {
      lo_this.bgColor = "#4A7DD6";
      lo_this.style.color="white";
   }
   else
   {
      lo_this.bgColor = "white";
      lo_this.style.color="black";
   }
}


/*
' ------------------------------------------------------------------
' Function    : fc_cur_url()
' Description : ÇöÀçURLÀ» ¹ÝÈ¯ÇÏ´Â ÇÔ¼ö.
' Argument    : 
' Return      : 
' ------------------------------------------------------------------
*/
function fc_cur_url()
{
   var ls_domain  = "http://" + document.domain; // µµ¸ÞÀÎÁ¤º¸
   var ls_c_url   = document.URL.replace("#none","");    // URL Á¤º¸
   var lo_split   = ls_c_url.split("?");
   var ls_url     = lo_split[0].replace(ls_domain,"")
   return ls_url;
}

// 2007-03-12 Ãß°¡
var gs_split_string1 = "";
var gs_split_string2 = "";
/*
' ------------------------------------------------------------------
' Function    : fc_split_data(ars_data)
' Description : ¹ÞÀºµ¥ÀÌÅÍ¸¦ ÀÌÂ÷¿ø ¹è¿­¿¡ ³Ö¾îÁØ´Ù.
'               2¹øÂ° ¿ä¼ÒÀÇ Å©±â´Â Àü¿ªº¯¼ö¿¡ ³Ö¾îÁØ´Ù.
'               gi_col_length
' Argument    : 
' Return      : Array 2Â÷¿ø¹è¿­
' ------------------------------------------------------------------
*/
var gi_col_length = 0;

function fc_split_data(ars_data)
{
   var lo_row     = new Array;
   var lo_col     = new Array;
   var lo_return  = new Array;

   // row¸¦ ºÐ¸®ÇÑ´Ù.
   if(gs_split_string2 == "") {
	   lo_row = ars_data.split("\r");
   } else {
	   lo_row = ars_data.split(gs_split_string2);
   }
   

   for(var i=0; i<lo_row.length; i++)
   {
      // col´ÜÀ§·Î ºÐ¸®ÇÑ´Ù.
	  if(gs_split_string1 == "") {
		  lo_col = lo_row[i].split("\t");
	  } else {
		  lo_col = lo_row[i].split(gs_split_string1);
	  }
      

      // Àü¿ªº¯¼ö¿¡ ÇØ´ç colÀÇ Å©±â¸¦ ±â¾ï½ÃÅ²´Ù.
      if(i==0) gi_col_length = lo_col.length;

      lo_return[i] = new Array(lo_row.length);

      for(var j=0; j<lo_col.length; j++)
      {
         // 2Â÷¿ø ¹è¿­¿¡ ÇØ´ç ³»¿ëÀ» ³Ö¾îÁØ´Ù.
         lo_return[i][j] = lo_col[j];         
      }
   }
   return lo_return;
}

/*
' -----------------------------------------------------------------------------
' Function    : fc_center_win(ars_url,ars_win_name,ari_width,ari_height)
' Description : °¡¿îµ¥ À©µµ¿ì ¿­±â
' CreateDate  : 2004-03-22
' Argument    : 
' Return      : 
' -----------------------------------------------------------------------------
*/
function fc_center_win(ars_url,ars_win_name,ari_width,ari_height, ari_scroll)
{
	try
	{
		window.name = "scott_webthink";
	}
	catch (e)
	{
	}
   var li_width  = (screen.width  - ari_width)  / 2;
   var li_height = (screen.height - ari_height) / 2;
	if(!ari_scroll) ari_scroll = 0;
   var lo_win = window.open(ars_url,ars_win_name,'status=yes,menubar=0,locationbar=0,toolbar=0,scrollbars='+ari_scroll+',resizable=0,left='+li_width+',top='+li_height+',width='+ari_width+',height='+ari_height);

   return lo_win;
}

function fc_win(ars_url,ars_win_name,ari_width,ari_height, ari_scroll)
{
	try
	{
		window.name = "scott_webthink";
	}
	catch (e)
	{
	}
	if(!ari_scroll) ari_scroll = 0;
   var lo_win = window.open(ars_url,ars_win_name,'status=yes,menubar=0,locationbar=0,toolbar=0,scrollbars='+ari_scroll+',resizable=0,left=5,top=10,width='+ari_width+',height='+ari_height);

   return lo_win;
}

/*
' -----------------------------------------------------------------------------
' Function    : fc_center_win2(ars_url,ars_win_name,ari_width,ari_height)
' Description : °¡¿îµ¥ À©µµ¿ì ¿­±â(½ºÅ©·Ñ¹Ù)
' CreateDate  : 2004-03-22
' Argument    : 
' Return      : 
' -----------------------------------------------------------------------------
*/
function fc_center_win2(ars_url,ars_win_name,ari_width,ari_height)
{
   var li_width  = (screen.width  - ari_width)  / 2;
   var li_height = (screen.height - ari_height) / 2;
   var lo_win = window.open(ars_url,ars_win_name,'menubar=0,locationbar=0,toolbar=0,scrollbars=1,resizable=0,left='+li_width+',top='+li_height+',width='+ari_width+',height='+ari_height);

   return lo_win;
}
// 2004-02-27 css¸¦ ¼³Á¤ÇÑ´Ù.
// °£·«ÇÑ ¼³¸íÀ» º¸¿©ÁØ´Ù.
function fc_tool_tip(ari_no)
{
   // ÁÂÃøÀ§Ä¡
   var li_left = event.x - 200;
   
   // »ó´ÜÀ§Ä¡
   var li_top = event.y - 10;

   var lo_div = eval("document.all.div_" + ari_no);

   // º¸ÀÌ¸é ¾Èº¸ÀÌ°Ô
   if(lo_div.style.display == "")
   {
      lo_div.style.display = "none";
   }
   else
   {
      lo_div.style.left = li_left;
      lo_div.style.top = li_top;
      lo_div.style.display = "";      
   }
}

function fc_tool_tip2(ari_no)
{
   // ÁÂÃøÀ§Ä¡
   var li_left = event.x - 200;
   
   // »ó´ÜÀ§Ä¡
   var li_top = event.y + 20;

   var lo_div = eval("document.all.div_" + ari_no);

   // º¸ÀÌ¸é ¾Èº¸ÀÌ°Ô
   if(lo_div.style.display == "")
   {
      lo_div.style.display = "none";
   }
   else
   {
      lo_div.style.left = li_left;
      lo_div.style.top = li_top;
      lo_div.style.display = "";      
   }
}
function fc_tool_tip3(ari_no)
{
   // ÁÂÃøÀ§Ä¡
   var li_left = event.x - 300;
   
   // »ó´ÜÀ§Ä¡
   var li_top = event.y + 10;

   var lo_div = eval("document.all.div_" + ari_no);

   // º¸ÀÌ¸é ¾Èº¸ÀÌ°Ô
   if(lo_div.style.display == "")
   {
      lo_div.style.display = "none";
   }
   else
   {
      lo_div.style.left = li_left;
      lo_div.style.top = li_top;
      lo_div.style.display = "";      
   }
}
/*
' ------------------------------------------------------------------
' Function    : fc_td_select(ari_num)
' Description : tdºÎºÐÀ» ¼±ÅÃÇÑ´Ù.
' Argument    : 
' Return      : 
' ------------------------------------------------------------------
*/
function fc_td_select(ari_num,ars_mode)
{
   var lo_this  = window.event.srcElement;
   var lo_table = lo_this.parentNode.parentNode.parentNode.parentNode;
   var ls_text  = "";
   var lo_temp  = document.getElementById("div_temp");
   var li_x     = fc_get_x(lo_this);
   var li_y     = fc_get_y(lo_this);

   //alert(lo_this.rowIndex);

   var li_height  = 0;
   var li_width   = lo_table.rows[0].cells[ari_num].width;
   
   for(var i=1; i < lo_table.rows.length; i++)
   {
      if(i+1 > lo_table.rows.length)
      {
         ls_text += lo_table.rows[i].cells[ari_num].innerText;
      }
      else
      {
         ls_text += lo_table.rows[i].cells[ari_num].innerText + "\n";
      }
      
      li_height += 16;
   }

   if(!lo_temp)
   {
      document.body.insertAdjacentHTML("beforeEnd","<div id=\"div_temp\" style=\"position: absolute; z-index: 99;display:none;\"><textarea name=\"tar_temp\"></textarea></div>");
   }
   
   if(div_temp.style.display != "none")
   {
      div_temp.style.display = "none";
   }
   else
   {
      div_temp.style.display = "";      
      div_temp.style.pixelLeft = li_x + 20;
      div_temp.style.pixelTop  = li_y + 25;

      var lo_tar_temp = document.all.tar_temp;
      
      lo_tar_temp.style.border = 0;
      lo_tar_temp.style.backgroundColor = "transparent"; // ¹è°æÀ» Åõ¸íÇÏ°Ô
      lo_tar_temp.style.overflow = "hidden"; // ½ºÅ©·Ñ¹Ù¸¦ ¾ø¾Ö±â À§ÇØ¼­
      lo_tar_temp.style.width  = li_width;
      lo_tar_temp.style.height = li_height;

      lo_tar_temp.value = ls_text;

      lo_tar_temp.select();
      document.execCommand('copy'); // º¹»ç¸í·É
      setTimeout("document.body.removeChild(div_temp)",500);
      //div_temp.style.display = "none";
   }
}

/*
' -----------------------------------------------------------------------------
' Function    : fc_chk_all(arb_type,ars_list)
' Description : ¸®½ºÆ®¿¡¼­ Ã¼Å©¹Ú½º¸¦ ¼±ÅÃÇÑ´Ù.
' CreateDate  : 2004-04-20
' Argument    : arb_type --> ¼±ÅÃÇüÅÂ
'                            true = ¼±ÅÃ,false = ¼±ÅÃÇØÁ¦, other=Ã¼Å©¹Ú½º¿¡¼­ ¼±ÅÃ
' Return      : 
' -----------------------------------------------------------------------------
*/
function fc_chk_all(arb_type,ars_list)
{
   // ¸ñ·Ï Å×ÀÌºí ÁöÁ¤
   var lo_table    = document.getElementById(ars_list);
   var lb_checked  = arb_type;

   // Ã¼Å©¹Ú½º¿¡¼­ Å¬¸¯ÇÏ¸é ÇöÀç»óÅÂ¸¦ º¸°í º¯È¯ÇØÁØ´Ù.
   if(lb_checked == "other")
   {
      //alert(lo_table.rows[0].cells[0].childNodes(0).checked);
      if(lo_table.rows[0].cells[0].childNodes(0).checked == true)
      {
         lb_checked = true;
      }
      else
      {
         lb_checked = false;
      }
   }

   var li_rows = lo_table.rows.length;
   var lo_child;
   
   // Ã¼Å©¹Ú½º ¼±ÅÃ
   for(var i=0; i < li_rows; i++)
   {
      lo_child = lo_table.rows[i].cells[0].childNodes(0);

      lo_child.checked = lb_checked;
   }
}

/*
' ------------------------------------------------------------------
' Function    : fc_o_by(ars_ocolumn,ars_otype)
' Description : ÇöÀçÆû¿¡¼­ arg_ocolumn°ú arg_otypeÀÇ °ªÀ» º¯°æÇØ¼­
'               Order By ±¸¹®À» º¯°æÇÑ´Ù.
' Argument    : 
' Return      : 
' ------------------------------------------------------------------
*/
function fc_o_by(ars_ocolumn,ars_otype,ars_form)
{   
   var lo_form = eval("document.forms['" + ars_form + "']");

   try
   {
      lo_form.hid_ocolumn.value = ars_ocolumn;
      lo_form.hid_otype.value   = ars_otype;
   }
   catch(e)
   {
      lo_form.arg_ocolumn.value = ars_ocolumn;
      lo_form.arg_otype.value   = ars_otype;
   }

   
   lo_form.submit();
}

var go_function = new Array;

function fc_push(ars_text)
{  

   go_function[parseFloat(go_function.length)+1] = ars_text;
}

function fc_pop()
{
   for(var i=0; i<go_function.length; i++)
   {
      if(go_function[i])
      {
         eval(go_function[i]);
      }
   }
}
// ----------------------------------------------------------
// ÀüÃ¼È­¸éÀ¸·Î ¿­±â
// ----------------------------------------------------------
function full_screen(strUrl,strWinName)
{
  var w_width = window.screen.width - 10;
  var w_height = window.screen.height - 53;
  
  window.open(strUrl, strWinName , "width=" + w_width + ",height=" + w_height + ",top=0,left=0");
}

function m1(aro_obj)
{
   var lo_this = aro_obj;

   var lo_over = new Image();
   var ls_src  = lo_this.src;
   lo_over.src = ls_src.replace(/out/gi,"over");

   lo_this.style.cursor = "pointer";
   lo_this.style.padding = 0;
   lo_this.style.margin = 0;

   lo_this.onmouseover = function anonymous() { lo_this.src = ls_src.replace(/out/gi,"over"); };
   lo_this.onmouseout = function anonymous() { lo_this.src = ls_src.replace(/over/gi,"out"); };
}

gs_css_set  = "";
gs_css_set += "<link href=\"" + gs_url_path + "/css/style.css\" rel=\"stylesheet\">";
gs_css_set += "<style type=\"text/css\">";
gs_css_set += "table.default {behavior:url(" + gs_url_path + "/css/cc_t_default.htc)}"; /* TABLE CSS */
gs_css_set += "img.m1 {behavior:url(" + gs_url_path + "/css/cc_roll_over.htc)}";/* IMAGE & ROLL OVER */
gs_css_set += "</style>";
document.writeln(gs_css_set);

var curMenu = "";

function openMenu(menuID) 
{
	closeMenu();
	
	var button = getMenuButton(menuID);
    var menu = getMenu(menuID);
    
    button.src = button.getAttribute("overSrc");
    menu.style.display = "block";
    
	curMenu = menuID;
}

function closeMenu() 
{
    if (curMenu != "")
    {
        var button = getMenuButton(curMenu);
        var menu = getMenu(curMenu);
        
        button.src = button.getAttribute("outSrc");
        menu.style.display = "none";
        
        curMenu = "";
    }
}

function getMenuButton(id)
{
    return document.getElementById(id);
}

function getMenu(id)
{
    return document.getElementById(id + "_menuItem");
}


function MenuOver(aro_obj,ars_cate)
{
   var lo_img = document.getElementById("img_mnu_" + ars_cate);
   var i = 10;

   
   lo_img.src = lo_img.src.replace(/out/gi,"over"); 

   var li_x = fc_get_x(lo_img);
   var li_y = fc_get_y(lo_img);

   if(parseInt(ars_cate) == 17) li_x -= 25;
   if(parseInt(ars_cate) == 18) li_x -= 65;

   for(i=10; i<=18; i++)
   {
      lo_tmp_div = document.getElementById("div_mnu_" + i);
      lo_tmp_div.style.display = "none";
   }

   var lo_div = document.getElementById("div_mnu_" + ars_cate);

   lo_div.style.display = "";
   lo_div.style.left = li_x;
   lo_div.style.top = li_y + 39;
   
   /*
   if(gs_agent == "ms")
   {
      lo_div.style.filter = "progid:DXImageTransform.Microsoft.Alpha(50)";
   }
   */

}

function ClearMenu()
{
   var lo_tmp_div = null;
   var lo_tmp_img = null;

   for(var i=10; i<=18; i++)
   {
      lo_tmp_div = document.getElementById("div_mnu_" + i);
      lo_tmp_div.style.display = "none";
      lo_tmp_img = document.getElementById("img_mnu_" + i);
      lo_tmp_img.src = lo_tmp_img.src.replace(/over/gi,"out"); 
   }
}

function MenuOut(aro_obj,ars_cate)
{
   var lo_img = document.getElementById("img_mnu_" + ars_cate);

   lo_img.src = lo_img.src.replace(/over/gi,"out"); 

   var lo_div = document.getElementById("div_mnu_" + ars_cate);
   lo_div.style.display = "none";
}

/*
function f_sub_mnu(aro_obj,ars_cate)
{
   var lo_this = aro_obj;

   var lo_over = new Image();
   var ls_src  = lo_this.src;
   lo_over.src = ls_src.replace(/out/gi,"over");

   lo_this.style.cursor = "pointer";
   lo_this.style.padding = 0;
   lo_this.style.margin = 0;

   var li_x = fc_get_x(aro_obj);
   var li_y = fc_get_y(aro_obj);

   lo_this.onmouseover = function anonymous() 
                         { 
                            lo_this.src = ls_src.replace(/out/gi,"over"); 

                            var i = 0;
                            var lo_tmp_div = null;
                           
                            for(i=10; i<=18; i++)
                            {
                               lo_tmp_div = document.getElementById("div_mnu_" + i);
                               lo_tmp_div.style.display = "none";
                            }

                            var lo_div = document.getElementById("div_mnu_" + ars_cate);
                            lo_div.style.display = "";
                            lo_div.style.left = li_x;
                            lo_div.style.top = li_y + 40;
                         };
   lo_this.onmouseout = function anonymous() 
                        { 
                           lo_this.src = ls_src.replace(/over/gi,"out"); 
                           //var lo_div = document.getElementById("div_mnu_" + ars_cate);
                           //lo_div.style.display = "none";
                        };
}
*/


// Ie ¼³°èº¯°æ¿¡ µû¸¥ ÆÐÄ¡ 2006-03-02
// s: source url
// d: flash id
// w: source width
// h: source height
// t: wmode ("" for none, transparent, opaque ...)
function FlashW(s,d,w,h,t)
{
   document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width="+w+" height="+h+" id="+d+"><param name=wmode value="+t+" /><param name=movie value="+s+" /><param name=quality value=high /><embed src="+s+" quality=high wmode="+t+" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash\" width="+w+" height="+h+"></embed></object>");
}

//ÆÄÀÏ»çÀÌÁî
function f_getFileSize(bt , type)
{
	if (type == "M")
	{
		var btn = parseInt(bt)/(1024*1024);
		if(btn > 1)
		{
			var bt_split = btn.toString().split('.');
			var subnum = bt_split[1] ? '.' + bt_split[1].substring(0,2) : '';
			var bt_num   = f_commaSplit(bt_split[0]) + '.' + subnum;
			return  bt_num + "M";
		}
		else {
			type = "K";
		}
	}
	if (type == "K")
	{
		var btn = parseInt(bt)/1024;
		if(btn > 1)
		{
			var bt_split = btn.toString().split('.');
			var subnum = bt_split[1] ? '.' + bt_split[1].substring(0,2) : '';
			var bt_num   = f_commaSplit(bt_split[0]) + subnum;
			return  bt_num + "K";
		}
		else {
			type = "B";
		}
	}
	if (type == "B")
	{
		return f_commaSplit(bt) + "B";
	}
}

//ÄÞ¸¶»ðÀÔ (number_format)
function f_commaSplit(srcNumber) 
{ 
	var txtNumber = '' + srcNumber; 

	var rxSplit = new RegExp('([0-9])([0-9][0-9][0-9][,.])'); 
	var arrNumber = txtNumber.split('.'); 
	arrNumber[0] += '.'; 
	do { 
		arrNumber[0] = arrNumber[0].replace(rxSplit, '$1,$2'); 
	} 
	while (rxSplit.test(arrNumber[0])); 
	if (arrNumber.length > 1) { 
		return arrNumber.join(''); 
	} 
	else { 
		return arrNumber[0].split('.')[0]; 
	} 
}

//ÄÞ¸¶Á¦°Å
function f_filterNum(str) 
{ 
	re = /^\$|,/g; 
	return str.replace(re, ""); 
}

// Ie ¼³°èº¯°æ¿¡ µû¸¥ ÆÐÄ¡ 2006-03-02
// s: source url
// d: flash id
// w: source width
// h: source height
// t: wmode ("" for none, transparent, opaque ...)
// FlashW(s,d,w,h,t)

function f_extHTML(ars_val, ars_ext, ari_w, ari_h, ars_mode, ars_align, ars_start) 
{
//	try
//	{
		if(!ars_val) return false;
		if(!ars_ext) return false;
		var w = 100;
		var h = 80;
		if(ari_w) 
		{
			w = ari_w;
			ari_w = " width=\""+ari_w+"\"";
		}
		else {
			ari_w = "";
		}
		if(ari_h) 
		{
			h = ari_h;
			ari_h = " height=\""+ari_h+"\"";
		}
		else {
			ari_h = "";
		}
		var ls_align = "";
		if(ars_align == 2) ls_align = "  align=\"left\" ";
		var str = "";
		if(!ars_start) ars_start = false;		//	ÀÚµ¿ÇÃ·¹ÀÌ ¸·À½
		switch (ars_ext) {
			// flash
			case "swf":
				str = "<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\"";
				if(ari_w) str += ari_w;
				if(ari_h) str += ari_h;
				str += ">";
				str += "<PARAM NAME=\"movie\" VALUE=\""+ars_val+"\">";
				str += "<PARAM NAME=\"Src\" VALUE=\""+ars_val+"\">";
				str += "<EMBED src=\""+ars_val+"\" quality=high TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\"";
				if(ari_w) str += ari_w;
				if(ari_h) str += ari_h;
				str += "></EMBED>";;
				str += "</OBJECT>";
				break;
			// mp3
			case "mp3":
				str = "<OBJECT classid=\"CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6\"  "+ari_w+" "+ari_h+">";
				str += "<PARAM NAME=URL VALUE=\""+ars_val+"\">";
				str += "<PARAM NAME=autoStart VALUE=\""+ars_start+"\">";
				str += "<PARAM NAME=uiMode VALUE=none>";
				str += "<EMBED type=\"application/x-mplayer2\" pluginspage = \"http://www.microsoft.com/Windows/MediaPlayer/\" SRC=\""+ars_val+"\"  "+ari_w+" "+ari_h+" AutoStart=\""+ars_start+"\">";
				str += "</EMBED>";
				str += "</OBJECT>";
				break;
			// quicktime
			case "mov":
				str = "<embed src=\""+ars_val+"\" type=video/quicktime autoplay=\""+ars_start+"\" controller=\"TRUE\" width=\"480\" height=\"288\" border=\"0\" cache=\"FALSE\" pluginspage=\"http://www.apple.com/quicktime/download/indext.html\"  "+ari_w+" "+ari_h+"></embed>";
				break;
			// window media player
			case "asf":
				str = "<EMBED src=\""+ars_val+"\" "+ari_w+" "+ari_h+" autoplay=\""+ars_start+"\" ></EMBED>";
			case "asx":
				str = "<EMBED src=\""+ars_val+"\" "+ari_w+" "+ari_h+" autoplay=\""+ars_start+"\" ></EMBED>";
			case "mpg":
				str = "<EMBED src=\""+ars_val+"\" "+ari_w+" "+ari_h+" autoplay=\""+ars_start+"\" ></EMBED>";
			case "mpeg":
				str = "<EMBED src=\""+ars_val+"\" "+ari_w+" "+ari_h+" autoplay=\""+ars_start+"\" ></EMBED>";
			case "wmv":
				str = "<EMBED src=\""+ars_val+"\" "+ari_w+" "+ari_h+" autoplay=\""+ars_start+"\" ></EMBED>";
			case "avi":
				str = "<OBJECT classid=\"CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6\"  "+ari_w+" "+ari_h+">";
				str += "<PARAM NAME=URL VALUE=\""+ars_val+"\">";
				str += "<PARAM NAME=autoStart VALUE=\""+ars_start+"\">";
				str += "<PARAM NAME=uiMode VALUE=full>";
				str += "<EMBED type=\"application/x-mplayer2\" pluginspage=\"http://www.microsoft.com/Windows/MediaPlayer/\" SRC=\""+ars_val+"\" autoplay=\""+ars_start+"\" "+ari_w+" "+ari_h+">";
				str += "</EMBED>";
				str += "</OBJECT>";
				break;
			case "gif":
				str = "<img src=\""+ars_val+"\" "+ari_w+ari_h+ls_align+" onClick=\"f_previews(this.src,'¹Ì¸®º¸±â');\">";
				break;
			case "jpg":
				str = "<img src=\""+ars_val+"\" "+ari_w+" "+ari_h+ls_align+" onClick=\"f_previews(this.src,'¹Ì¸®º¸±â');\">";
				break;
			case "pnp":
				str = "<img src=\""+ars_val+"\" "+ari_w+" "+ari_h+ls_align+" onClick=\"f_previews(this.src,'¹Ì¸®º¸±â');\">";
				break;
			case "bmp":
				str = "<img src=\""+ars_val+"\" "+ari_w+" "+ari_h+ls_align+" onClick=\"f_previews(this.src,'¹Ì¸®º¸±â');\">";
				break;

			default:
		}
		
		if(ars_mode == "write")
		{
			document.write(str);
		}
		else {
			return str;
		}
//	}
//	catch (e){}
}

function f_previews(ars_file, ars_title, ars_url)
{
	try
	{
		if(ars_file)
		{
			if(!ars_url) ars_url = "/wt_board/common/pc_preview.php";
			var ls_str = ars_url + "?arg_img=" + ars_file + "&arg_title=" + ars_title;
			var lo_win = window.open(ls_str,'wt_previews','status=yes,menubar=0,locationbar=0,toolbar=0,scrollbars=0,resizable=0,left=100,top=100,width=50,height=50');
		}
	}
	catch (e){	}
}
//============================================================================
// ÀÌ¹ÌÁö ÀÚµ¿ ¸®»çÀÌÁî
//============================================================================
function image_auto_resize(this_s,width,height){
	var ta_image = new Image();
	ta_image.src = this_s.src;
	if(!width){this_s.removeAttribute('width');
		this_s.style.width='auto';
	}
	else if(width < ta_image.width){
		this_s.width = width;
	}else{
		this_s.width = ta_image.width;
	}
	if(!height){this_s.removeAttribute('height');
		this_s.style.height='auto';
	}
	else if(height < ta_image.height){
		this_s.height = height;
	}else{
		this_s.height = ta_image.height;
	} 
}

function image_auto_resize_inarea(this_s,width,height,view){ 
	//return false;
	//this_s¾ÈÀÇ ¸ðµç ÀÌ¹ÌÁö´Â ÀÚµ¿ ¸®»çÀÌÁî µÈ´Ù.
	//alert(this_s.childNodes.length);
	if(parseInt(width) < 500) return false;

	if(!view){view=true;}
	if(!this_s){return;}
	if(this_s.nodeType!=1){return;}
	for(var i=0,m=this_s.childNodes.length;i<m;i++){
		var ta = this_s.childNodes[i];
  
		if(ta.nodeName=='IMG'){
		//ta.style.border='1px solid #333333';   
		image_auto_resize(ta,width,height);

		if(view){
			 if(!ta.title){ta.title=ta.src;}
			 if(!ta.onclick){
				//ta.style.cursor='pointer';
				//ta.onclick=function(){js_image_view(this,1);}
			 }
			 if(!ta.onload) 
				ta.onload=function(){image_auto_resize(this,width,height);}
			 if(!ta.onmouseover)   
				ta.onmouseover=function(){image_auto_resize(this,width,height);}
			}
	  }
	  if(ta.childNodes.length>0){
			image_auto_resize_inarea(ta,width,height);
	  }
	}
	return;
}

//	À¥·Î±× »ç¿ë
function LogDetailView(ari_no)
{
	var ls_url = "";
	ls_url += "/wt_board/weblog/detail.php";
	ls_url += "?arg_no=" + ari_no;

	var lo_win = window.open(ls_url,"win_log_detail","width=616,height=400,left=0,top=0,scrollbars=1,status=1");
	lo_win.focus();
}


//	input Æû°ª Ã¼Å©ÇÏ±â	¿À¹öÁ§Æ®, ¼±ÅÃ°ª, ÆûÁ¾·ù, Ã¼Å©¹Ú½ºÀÏ °æ¿ì ¼±ÅÃÇÒ ±æÀÌ
function f_idchecked(aro_obj, ars_val, ars_mode, ars_len)
{
	try
	{
		if(aro_obj && ars_val)
		{
			var lo_id = document.getElementById(aro_obj); 
			if(lo_id)
			{
				switch(ars_mode)
				{
					case "select" :
						lo_id.value = ars_val;
						/*
						for(var i=0; i < lo_id.options.length; i++)
						{
							if(lo_id[i].value == ars_val)
							{
								lo_id[i].selected = true;
							}
						}
						*/
						break;

					case "checkbox" :
						var lo_id = document.getElementsByName(aro_obj); 
						for(var i=0; i < lo_id.length; i++)
						{
							if(ars_len)
							{
								if(lo_id[i].value.substring(0,ars_len) == ars_val)
								{
									lo_id[i].checked = true;
								}
							}
							else {
								if(lo_id[i].value == ars_val)
								{
									lo_id[i].checked = true;
								}
							}
						}
						break;

					case "radio" :
						var lo_id = document.getElementsByName(aro_obj); 
						for(var i=0; i < lo_id.length; i++)
						{
							if(lo_id[i].value == ars_val)
							{
								lo_id[i].checked = true;
							}
						}
						break;

					case "text" :
						var lo_id = document.getElementById(aro_obj); 
						lo_id.value = ars_val;
						break;
				}
			}
		}
		
	}
	catch(e){alerty(e);}
}



//ÆÄ¶ó¹ÌÅÍÀÇ °ªÀ» encodeÇÕ´Ï´Ù.
function encodeURL(str){
    var s0, i, s, u;
    s0 = "";                // encoded str
    for (i = 0; i < str.length; i++){   // scan the source
        s = str.charAt(i);
        u = str.charCodeAt(i);          // get unicode of the char
        if (s == " "){s0 += "+";}       // SP should be converted to "+"
        else {
            if ( u == 0x2a || u == 0x2d || u == 0x2e || u == 0x5f || ((u >= 0x30) && (u <= 0x39)) || ((u >= 0x41) && (u <= 0x5a)) || ((u >= 0x61) && (u <= 0x7a))){       // check for escape
                s0 = s0 + s;            // don't escape
            }
            else {                  // escape
                if ((u >= 0x0) && (u <= 0x7f)){     // single byte format
                    s = "0"+u.toString(16);
                    s0 += "%"+ s.substr(s.length-2);
                }
                else if (u > 0x1fffff){     // quaternary byte format (extended)
                    s0 += "%" + (oxf0 + ((u & 0x1c0000) >> 18)).toString(16);
                    s0 += "%" + (0x80 + ((u & 0x3f000) >> 12)).toString(16);
                    s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
                    s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                }
                else if (u > 0x7ff){        // triple byte format
                    s0 += "%" + (0xe0 + ((u & 0xf000) >> 12)).toString(16);
                    s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
                    s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                }
                else {                      // double byte format
                    s0 += "%" + (0xc0 + ((u & 0x7c0) >> 6)).toString(16);
                    s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                }
            }
        }
    }

    return s0;
}

 

 

//Decode

function decodeURL(str){
	 var s0, i, j, s, ss, u, n, f;
    s0 = "";                // decoded str
    for (i = 0; i < str.length; i++){   // scan the source str
        s = str.charAt(i);
        if (s == "+"){s0 += " ";}       // "+" should be changed to SP
        else {
            if (s != "%"){s0 += s;}     // add an unescaped char
            else{               // escape sequence decoding
                u = 0;          // unicode of the character
                f = 1;          // escape flag, zero means end of this sequence
                while (true) {
                    ss = "";        // local str to parse as int
                        for (j = 0; j < 2; j++ ) {  // get two maximum hex characters for parse
                            sss = str.charAt(++i);
                            if (((sss >= "0") && (sss <= "9")) || ((sss >= "a") && (sss <= "f"))  || ((sss >= "A") && (sss <= "F"))) {
                                ss += sss;      // if hex, add the hex character
                            } else {--i; break;}    // not a hex char., exit the loop
                        }
                    n = parseInt(ss, 16);           // parse the hex str as byte
                    if (n <= 0x7f){u = n; f = 1;}   // single byte format
                    if ((n >= 0xc0) && (n <= 0xdf)){u = n & 0x1f; f = 2;}   // double byte format
                    if ((n >= 0xe0) && (n <= 0xef)){u = n & 0x0f; f = 3;}   // triple byte format
                    if ((n >= 0xf0) && (n <= 0xf7)){u = n & 0x07; f = 4;}   // quaternary byte format (extended)
                    if ((n >= 0x80) && (n <= 0xbf)){u = (u << 6) + (n & 0x3f); --f;}         // not a first, shift and add 6 lower bits
                    if (f <= 1){break;}         // end of the utf byte sequence
                    if (str.charAt(i + 1) == "%"){ i++ ;}                   // test for the next shift byte
                    else {break;}                   // abnormal, format error
                }
            s0 += String.fromCharCode(u);           // add the escaped character
            }
        }
    }

    return s0;
}

// ÇÊµå ¹Ì¸® ±Û½á³õ±â
function ClearField(field){
   if (field.value == field.defaultValue) {
      field.value = "";
   }
}

function FillField(field){
   if (!field.value) {
      field.value = field.defaultValue;
   }
}
//	¹«Á·°Ç ´ë¹®ÀÚ onkeypress="fc_upperCase();"
function fc_upperCase()
{
	var event = window.event;
	if (event.keyCode >= 97 && event.keyCode <= 122)
	{
		event.keyCode = event.keyCode - 32;
	}
}
