////// messages in util.js
var MSGpreResNot6         = "¿Ã¹Ù¸¥ ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.";
var MSGpostResNot7        = "¿Ã¹Ù¸¥ ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.";
var MSGworngResNo         = "Àß¸øµÈ ÁÖ¹Îµî·Ï¹øÈ£ÀÔ´Ï´Ù.\n\n´Ù½Ã È®ÀÎÇÏ½Ã°í ÀÔ·ÂÇØ ÁÖ¼¼¿ä.";
var MSGenterYMD           = "³â¿ùÀÏÀº ÇÊ¼ö ÀÔ·ÂÇ×¸ñÀÔ´Ï´Ù.";
var MSGenterYMDorNot      = "³â¿ùÀÏÀÌ ¸ðµÎ ÀÔ·ÂµÇ°Å³ª ¸ðµÎ »ý·«µÇ¾î¾ß ÇÕ´Ï´Ù.";
var MSGenterYYYY          = "\n³âµµ¸¦ ¹Ù¸£°Ô ÀÔ·ÂÇÏ¼¼¿ä.";
var MSGenterMM            = "\n¿ùÀ» ¹Ù¸£°Ô ÀÔ·ÂÇÏ¼¼¿ä." ;
var MSGenterDD            = "\nÀÏÀÚ¸¦ ¹Ù¸£°Ô ÀÔ·ÂÇÏ¼¼¿ä.";
var MSGremoveOpt          = "JavaScrpt error : removeOption in util.js";
var MSGcantSingleQuota    = "ÀÔ·Â¶õ¿¡´Â Single Quotation( ' )À» ÀÔ·ÂÇÒ ¼ö ¾ø½À´Ï´Ù.";
var MSGcantSpaceOnly      = "ÀÔ·Â¶õ¿¡´Â °ø¹é(space)¸¸À» ÀÔ·ÂÇÒ ¼ö ¾ø½À´Ï´Ù.";
var MSGnoBlackCharFName   = "Ã·ºÎ ÆÄÀÏ ÀÌ¸§Àº, \n\n´ÙÀ½°ú °°Àº Æ¯¼ö ¹®ÀÚ¿Í, space(¶ç¾î¾²±â)À» Çã¿ëÇÏÁö ¾Ê½À´Ï´Ù.\n\n\===========================================================\n\n\!  $  (  )  &  *  ;  / \" '";
var MSGnoRelativePath     = "Ã·ºÎ ÆÄÀÏÀº Àý´ë °æ·Î·Î ÀÔ·ÂµÇ¾î¾ß ÇÕ´Ï´Ù.\n\nÃ£¾Æº¸±â... ¹öÆ°À» Å¬¸¯ÇÏ¿© Ã·ºÎÇÏ¼¼¿ä..";
var MSGnoSpaceChar        = "°ø¹éÀ» ÀÔ·ÂÇÒ ¼ö ¾ø½À´Ï´Ù.";
var MSGnoHTMLSpaceChar    = "html tag, single quotation( ' ), °ø¹éÀ» ÀÔ·ÂÇÒ ¼ö ¾ø½À´Ï´Ù.";
var MSGnoBlackChar        = "¿¡ single quotation( ' ) ¶Ç´Â html tag, Æ¯¼ö¹®ÀÚ(! - $  (  )  &  *  ;  / ' \")¸¦ ÀÔ·ÂÇÒ ¼ö ¾ø½À´Ï´Ù.";
var MSGenterYourName      = "ÀÌ¸§À» Àû¾îÁÖ¼¼¿ä.";
var MSGenterYourEmail     = "¿Ã¹Ù¸¥ E-mail ÁÖ¼Ò¸¦ ÀÔ·ÂÇÏ¼¼¿ä.";
var MSGbyteLimitExceed    = " ¹ÙÀÌÆ® ÀÌ»óÀÇ ³»¿ëÀº Àü¼ÛÇÏ½Ç¼ö ¾ø½À´Ï´Ù.";

////// messages in menu.js
var MSGcantMoveGroupEnd   = "´ëºÐ·ù Á¾·á ±¸ºÐÀÚ´Â °³º°ÀÌµ¿ÇÒ ¼ö ¾ø½À´Ï´Ù.";
var MSGcantEditEssential  = "ÇÊ¼ö Ç×¸ñÀº ÀÌ¸§À» º¯°æÇÒ¼ö ¾ø½À´Ï´Ù.";
var MSGenterMenuName      = "¸Þ´º ÀÌ¸§À» ÀÔ·ÂÇØÁÖ¼¼¿ä";
var MSGenterMenuName10    = "¸Þ´ºÀÇ ÀÌ¸§Àº 10ÀÚÀÌÇÏ·Î ÀÔ·ÂÇØÁÖ½Ê½Ã¿ä.";
var MSGenterMenuName25    = "¸Þ´ºÀÇ ÀÌ¸§Àº 25ÀÚÀÌÇÏ·Î ÀÔ·ÂÇØÁÖ½Ê½Ã¿ä.";
var MSGnoBlackMenuName    = "¸Þ´º¸í¿¡ Æ¯¼ö¹®ÀÚ¸¦ »ç¿ë¼ö ¾ø½À´Ï´Ù.";
var MSGMenuCntExceed      = "¸Þ´º´Â 10°³±îÁö Á¦ÇÑµÇ¾î ÀÖ½À´Ï´Ù.";
var MSGselectDelMenu      = "»èÁ¦ ÇÒ ¸Þ´º¸¦ ¼±ÅÃÇÏ½Ê½Ã¿ä.";
var MSGcantMoveEssential  = "ÇÊ¼ö Ç×¸ñÀº ÀÌµ¿ÇÒ ¼ö ¾ø½À´Ï´Ù.";

////// messages in InputCheck.js
var MSGmustEnter          = "Àº(´Â) ¹Ýµå½Ã ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù. ";
var MSGmustCheckOneMore   = "Àº(´Â) ¹Ýµå½Ã ÇÏ³ª´Â Ã¼Å© ÇÏ¼Å¾ß ÇÕ´Ï´Ù. ";
//  MSGbyteLimitExceed    = " ¹ÙÀÌÆ® ÀÌ»óÀÇ ³»¿ëÀº Àü¼ÛÇÏ½Ç¼ö ¾ø½À´Ï´Ù. ";
//  MSGworngResNo         = "Àß¸øµÈ ÁÖ¹Îµî·Ï¹øÈ£ÀÔ´Ï´Ù.\n\n´Ù½Ã È®ÀÎÇÏ½Ã°í ÀÔ·ÂÇØ ÁÖ¼¼¿ä. ";

////// messages in editor.js
var MSGcantUseInViewSrc   = "¼Ò½ºº¸±â Ã¼Å©¸¦ ÇØÁ¦ÇÏ°í »ç¿ëÇÏ¼¼¿ä.";
var MSGHTMLRemoveContinue = "htmlÈ¿°úµéÀº »ç¶óÁý´Ï´Ù. °è¼ÓÇÏ°Ú½À´Ï±î?";
var MSGenterHTTPLink      = "¼±ÅÃµÈ ºÎºÐ¿¡ °É¸± ¸µÅ© ÁÖ¼Ò(url)À» ³Ö¾îÁÖ¼¼¿ä<br>&nbsp;&nbsp;(¿¹: http://lema.rgsystem.com) - 'http://' ²À ½á¾ßÇÔ";
var MSGenterImageLink     = "ÀÎÅÍ³Ý¿¡ ¿Ã·ÁÁø ÀÌ¹ÌÁö¸¸ »ðÀÔÀÌ °¡´ÉÇÕ´Ï´Ù.<br>&nbsp;»ðÀÔÇÒ ÀÌ¹ÌÁö ÁÖ¼Ò(url)À» ³Ö¾îÁÖ¼¼¿ä<br>&nbsp;&nbsp;(¿¹: http://lema.rgsystem.com/sample.jpg) - 'http://' ²À ½á¾ßÇÔ";

////// messages in ctrl.js
//  MSGmustEnter          = "Àº(´Â) ¹Ýµå½Ã ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.";
//  MSGmustCheckOneMore   = "Àº(´Â) ¹Ýµå½Ã ÇÏ³ª´Â Ã¼Å© ÇÏ¼Å¾ß ÇÕ´Ï´Ù.";
//  MSGbyteLimitExceed    = " ¹ÙÀÌÆ® ÀÌ»óÀÇ ³»¿ëÀº Àü¼ÛÇÏ½Ç¼ö ¾ø½À´Ï´Ù.";

////// messages in rgboard
var MSGcantFileUploadCount1 = "´õÀÌ»ó ÆÄÀÏÀ» µî·Ï ÇÒ ¼ö ¾ø½À´Ï´Ù. ÃÖ´ë(";
var MSGcantFileUploadCount2 = ")°³";

/*
//  create new window in center of screen
//  param : url   : link string
//          name  : window name
//          width,height : width,height of new window
*/
function centerNewWin(url, name, width, height) {
  var wi = screen.width - width;
  var hi = screen.height - height;

  if( wi < 0 ) wi = 0;
  if( hi < 0 ) hi = 0;

  var info = 'left=' + (wi/2) + ',top=' + (hi/2) + ',width='  + width + ',height=' + height + ',resizable=yes,scrollbars=yes,menubars=no,status=yes';
  var newwin = window.open(url, name, info);
  newwin.focus();
/*  return newwin;*/
}

function centerNewWinBar(url, name) {

  name = name + 'rglinux';

  var width = 816;
  var height = 730;
  var wi = screen.width - width;
  var hi = screen.height - height;

  if( wi < 0 ) wi = 0;
  if( hi < 0 ) hi = 0;

  var info = 'resizable=yes,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,location=yes, left=' + (wi/2) + ',top=' + (hi/3) + ',width='  + width + ',height=' + height + '';
  var newwin = window.open(url, name, info);
  newwin.focus();

  /*return newwin;*/
}

function centerNewWM(url, name, width, height) {
  var wi = screen.width - width;
  var hi = screen.height - height;

  if( wi < 0 ) wi = 0;
  if( hi < 0 ) hi = 0;

  var info = 'left=' + (wi/2) + ',top=' + (hi/2) + ',width='  + width + ',height=' + height + ',menubar=no,status=yes,resizable=yes,scrollbars=yes';
  var newwin = window.open(url, name, info);
  newwin.focus();
  //return newwin;
}
function centerNewWin1(url, name, width, height) {
  var wi = screen.width - width;
  var hi = screen.height - height;

  if( wi < 0 ) wi = 0;
  if( hi < 0 ) hi = 0;

  var info = 'left=' + (wi/2) + ',top=' + (hi/2) + ',width='  + width + ',height=' + height + ',menubar=no,status=no,resizable=no,scrollbars=yes';
  var newwin = window.open(url, name, info);
  newwin.focus();
  //return newwin;
}

function popup(url, name, width, height) {
  var wi = screen.width - width;
  var hi = screen.height - height;

  if( wi < 0 ) wi = 0;
  if( hi < 0 ) hi = 0;

  var info = 'left=' + (wi/2) + ',top=' + (hi/2) + ',width='  + width + ',height=' + height + ',menubar=no,status=no,resizable=no,scrollbars=auto';
  var newwin = window.open(url, name, info);
  newwin.focus();
  //return newwin;
}
function Newcalendar(url, name, width, height) {
  var wi = screen.width - width;
  var hi = screen.height - height;

  if( wi < 0 ) wi = 0;
  if( hi < 0 ) hi = 0;

  var info = 'left=' + (wi/2) + ',top=' + (hi/2) + ',width='  + width + ',height=' + height + ',resizable=no,scrollbars=no,menubars=no,status=no';
  var newwin = window.open(url, name, info);
  newwin.focus();
}

function Newcalendar1(url, name, width, height) {
  var wi = screen.width - width;
  var hi = screen.height - height;

  if( wi < 0 ) wi = 0;
  if( hi < 0 ) hi = 0;

  var info = 'left=' + (wi/2) + ',top=' + (hi/2) + ',width='  + width + ',height=' + height + ',resizable=no,scrollbars=no,menubars=no,toolbar=no, location=no';
  var newwin = window.open(url, name, info);
  newwin.focus();
}

/*************************************************************************
  create new window in right-top of screen
  param : url   : link string
          name  : window name
          width,height : width,height of new window
*************************************************************************/
function rightNewWin(url,winName, width,height) {
  var wi = screen.width - width - 10;
  var hi = 10;

  if( wi < 0 ) wi = 0;
  if( hi < 0 ) hi = 0;

  var info = 'left=' + wi + ',top=' + hi + ',width='  + width + ',height=' + height + ',resizable=yes,scrollbars=yes,menubars=no,status=yes';
  var newwin = window.open(url, name,info);
  newwin.focus();
}

/*************************************************************************
  create new window in left-top of screen
  param : url   : link string
          name  : window name
          width,height : width,height of new window
*************************************************************************/
function leftNewWin(url, winName, width, height) {
  var wi = 10;
  var hi = 10;

  var info = 'left=' + wi + ',top=' + hi + ',width='  + width + ',height=' + height + ',resizable=yes,scrollbars=yes,menubars=no';
  var newwin = window.open(url,'new',info);
  newwin.focus();
}


/************************************************************************************
  check if is only number enterd in input
  event : onkeypress
************************************************************************************/
function isNumber(){
 	if ((event.keyCode<48)||(event.keyCode>57)){
  		event.returnValue=false;
 	}
}

/***********************************************************************************
  move focus to next input when thisTabSize characters enterd
  param : thisTab : object has focus
          nextTab : next object to have focus
          thisTabSize : length of string can enter
  event : onKeyPress
***********************************************************************************/
function tabOrder(thisTab,nextTab, thisTabSize) {
    if (thisTab.value.length == thisTabSize) {
        nextTab.select();
        nextTab.focus();
        return;
     }
}



/*********************************************************************************
   ÄÚµå¸¦ ¼öÁ¤ÇÏ¸é ÀÚµ¿À¸·Î ÄÚµå¸íÀÌ ÃÊ±â ºó »óÅÂ·Î µÇ¾î¾ß ÇÑ´Ù.
   ÀÌ¸¦ À§ÇÑ ÇÔ¼ö ÀÌ´Ù.
   ÀÔ·Â Ç×¸ñ
          - cdObj : ÄÚµå°ªÀ» ÀÔ·ÂÇÑ input °´Ã¼
          - nmObj: ÄÚµå¸íÀ» Ãâ·ÂÇÑ input °´Ã¼
          - cdLength :  ÄÚµå ±æÀÌ
      ÄÚµå±æÀÌ °¡  ÇöÀç ÀÔ·ÂÇÑ ÄÚµå°ªÀÇ ±æÀÌ¿Í °°Áö ¾ÊÀ¸¸é ÄÚµå¸íÀ» Áö¿î´Ù.
   °ü·ÃÀÌº¥Æ® : onKeyUp
*********************************************************************************/
function isFullCode(cdObj, nmObj ,cdLength) {
  if(cdObj.value.length != cdLength) {
    nmObj.value="";
  }
}

/*********************************************************************************
   ÄÚµå¸¦ ¼öÁ¤ÇÏ¸é ÀÚµ¿À¸·Î ÄÚµå¸íÀÌ ÃÊ±â ºó »óÅÂ·Î µÇ¾î¾ß ÇÑ´Ù.
   ÀÌ¸¦ À§ÇÑ ÇÔ¼ö ÀÌ´Ù.
   ÀÔ·Â Ç×¸ñ
          - cdObj : ÄÚµå°ªÀ» ÀÔ·ÂÇÑ input °´Ã¼
          - nmObj: ÄÚµå¸íÀ» Ãâ·ÂÇÑ input °´Ã¼ÀÇ ½ºÆ®¸µ ÀÌ¸§(','·Î ºÐ¸®µÈ´Ù.)
          - cdLength :  ÄÚµå ±æÀÌ
      ÄÚµå±æÀÌ °¡  ÇöÀç ÀÔ·ÂÇÑ ÄÚµå°ªÀÇ ±æÀÌ¿Í °°Áö ¾ÊÀ¸¸é ÄÚµå¸íÀ» Áö¿î´Ù.
   °ü·ÃÀÌº¥Æ® : onKeyUp
*********************************************************************************/
function isFullCode2(cdObj, nmObj ,cdLength) {

  if(cdObj.value.length != cdLength) {
    var nmObjs = nmObj.split(",");
    for(var i = 0; i < nmObjs.length; i++) {
      eval(nmObjs[i]).value="";
    }
  }
}

/***************************************************************************
   Input type="Text"¸¦ µ·¿¡ °ü·ÃµÈ ³»¿ëÀ¸·Î »ç¿ë
   µ·¿¡ '100,000'°ú °°ÀÌ ','À» Ãß°¡ ½ÃÄÑÁØ´Ù.

   Event Handlers : onBlur
   °ü·Ã ÇÔ¼ö : removeFormattedMoney(), isNumber(), util.js::reverse()
   »ç¿ë ¹æ¹ý : onBlur="formattedMoney(this)"
***************************************************************************/
function formattedMoney(v) {
  var format = "";
  var money = v.value;

  money = reverse(money);
  for(var i = money.length-1; i > -1; i--) {
    if((i+1)%3 == 0 && money.length-1 != i) format += ",";
    format += money.charAt(i);
  }
  v.value = format;
  return v.value;
}


/*************************************************************************
   Input type="Text"¸¦ µ·¿¡ °ü·ÃµÈ ³»¿ëÀ¸·Î »ç¿ë
   formattedMoney¿¡¼­ »ç¿ëµÈ ','À» Á¦°Å ½ÃÄÑÁØ´Ù.

   Event Handlers : onFocus
   °ü·ÃÅ¸ÀÔ : text
   °ü·ÃÇÔ¼ö : formattedMoney(), isNumber()
   ¿¹Á¦¹æ¹ý :  onFocus="removeFormattedMoney(this)"
**************************************************************************/
function removeFormattedMoney(v) {
  var unformat = "";
  var money = v.value;
  var arr = money.split(",");
  for(var i = 0; i < arr.length; i++) {
    unformat += arr[i];
  }
  v.value = unformat;
  return v.value;
}


/**********************************************************************************
  ÀÌÇÁ·Î±×·¥Àº ¸®½ºÆ®ÀÇ »ö»ó°ú Ä¿¼­¸¦ º¯Çü½ÃÅ°´Â ±â´ÉÀ» ´ã´çÇÏ°í ÀÖ´Ù.

  °ü·ÃÀÌº¥Æ® : onMouseOver, onMouseOut, onClick

  ex) <tr> ÅÂ±×³ª <td> ÅÂ±×¿¡ ´ÙÀ½°ú °°ÀÌ »ç¿ëÇÒ ¼ö ÀÖ´Ù.
      onClick½Ã Æ¯º°ÇÑ Çàµ¿À» ÇÏ±âÀ§ÇØ¼­´Â onClick ¿¡ Ãß°¡ÀûÀ¸·Î ÇÔ¼ö¸¦ È£ÃâÇÏ¸é µÈ´Ù.
      <td onMouseOver='mouseOverCell(this)'
          onMouseOut='mouseOutCell(this)'
          onClick='selectedCell(this)'>Ç×¸ñ</td>
***********************************************************************************/
var prevObj;
var defaultColor    = '#FFFFFF';
var onMouseColor    = '#e9fad4';
var selecctedColor  = '#b9caa4';

function selectedCell(obj) {
  if( prevObj == null ) {
    prevObj = obj;
    prevObj.style.background = selecctedColor;
  }
  else {
    prevObj.style.background = defaultColor;
    obj.style.background = selecctedColor;
    prevObj = obj;
  }
}

function mouseOverCell(obj) {
  if( prevObj != obj ) {
    obj.style.background = onMouseColor;
  }
  obj.style.cursor = 'hand';
}

function mouseOutCell(obj) {
  if( prevObj != obj ) {
    obj.style.background = defaultColor;
  }
  obj.style.cursor = 'auto';
}

/************************************************************************
   Text¿¡ ¿µ¹®ÀÚ ¼Ò¹®ÀÚ¸¦ ´ë¹®ÀÚ·Î ¹Ù²ãÁØ´Ù.
   °ü·Ã ÀÌº¥Æ® : onKeyPress

   »ç¿ë¹ý :
   <input type="text" onKeyPress="toUpperCase()">
************************************************************************/
function toUpperCase() {
  if(!(event.keyCode < 97 || event.keyCode > 122)) {
    event.keyCode -= 32;
    event.returnValue=true;
  }
}

/************************************************************************
   Text¿¡ ¿µ¹®ÀÚ ´ë¹®ÀÚ¸¦ ¼Ò¹®ÀÚ·Î ¹Ù²ãÁØ´Ù.
   °ü·Ã ÀÌº¥Æ® : onKeyPress

   »ç¿ë¹ý :
   <input type="text" onkeyPress="toLowerCase()">
************************************************************************/
function toLowerCase() {
  if(!(event.keyCode < 65 || event.keyCode > 90)) {
    event.keyCode += 32;
    event.returnValue=true;
  }
}


/*********************************************************************
   ÀÌ ÇÔ¼ö´Â ÀÔ·Â ÇÊµå È®ÀÎ½Ã »ç¿ëÇÑ´Ù. ÃÖ½Å¹öÁ¯

   Event Handlers : input, textarea, select
   °ü·Ã Å¸ÀÔ :
   Arguments : vck, title, maxLangth
   ¿¹Á¦ : <input type=text name=aaa value='' vck=1 maxLength='' title='ÀÌ¸§'>
   Áß¿ä : vck = 1 text, 2 select, 3 radio, 4 check, 5 textarea, 0 ¾øÀ½
   		  title Àº È­¸é¿¡ Ãâ·ÂµÉ ÀÌ¸§
**********************************************************************/
function formLengthCheck(oForm){
	oForm = (oForm == undefined)? "f": oForm ;
	//var T = $("form[name="+oForm+"] input:not(:hidden),textarea,select");
	//alert( T.size());
	alert($("form[name="+oForm+"] :input:not(:hidden)").size())
	$("form[name="+oForm+"] :input:not(:hidden)").disable()	 
}
function inCheck(oForm)
{
	/* vck = 1 text, 2 select, 3 radio, 4 check, 5 textarea, 0 nothing    */
	var T;
	if (oForm == null)
		T = eval("document.myform");
	else
		T = eval("document." + oForm);
	var cnt = 0;
	for (i = 0; i < T.length; i++)
	{
		var oT = eval("T.elements[" + i + "]");

		switch (oT.vck)
		{
			case '1' :	 /* text ÀÌ¸é       */
				if (oT.value.length <= 0 )
				{
					alert(oT.title + MSGmustEnter );
					oT.focus();
					return -1;
				}
			  else if(oT.value.length > oT.maxLangth ) {
			    alert(oT.maxLength + MSGbyteLimitExceed );
					oT.focus();
					return -1;
			  }
				break;
			case '2' :	 /*  select ÀÌ¸é      */
				if (oT.selectedIndex == 0)
				{
					alert(oT.title + MSGmustEnter );
					oT.focus();
					return -1;
				}
				break;
			case '3' :	 /*  radio ÀÌ¸é   */

				var oN = eval("document.myform." + oT.name);

				var nck = 0;
				for (j = 0; j < oN.length; j++)
				{
					if (oN[j].checked)
						nck++;

				}
				if (nck == 0)
				{
					alert(oT.title + MSGmustCheckOneMore );
					oT.focus();
					return -1;
				}

				break;
			case '4' :	 /*  checkbox ÀÌ¸é    */

				var N = oT.name.substring(0, oT.name.length-1);
				var oLangth = 0;
				var nck = 0;

				for (j = 0; j < T.length; j++)
				{
					if (T.elements[j].name.indexOf(N) >= 0)
						oLangth++;
				}

				for (j = 0; j < oLangth; j++)
				{
					var oN = eval("document.myform." + N + j);
					if (oN.checked)
						nck++;
				}
				if (nck == 0)
				{
					alert(oT.title + MSGmustCheckOneMore );
					oT.focus();
					return -1;
				}


				break;

			case '5' :	 /* textarea ÀÌ¸é   */
				alert(oT.title + MSGmustEnter );
				if (oT.value == '')
				{
					oT.focus();
					return -1;
				}
				break;
		}
	}
	return 0;

}
/*
    ÇÔ ¼ö : cal_byte(aquery , limit)
    ¼³ ¸í : TextAreaÀÇ Text±æÀÌ¸¦ Á¦ÇÑÇÑ´Ù.
    param : ¿øº»¹®ÀÚ¿­, Á¦ÇÑ±æÀÌ(byte)
    ¸® ÅÏ : boolean
 */
function cal_byte(aquery , limit)
{
	var tmpStr;
	var temp=0;
	var onechar;
	var tcount;
	tcount = 0;

	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++;
		}
	}

	if(tcount > limit) {
		reserve = tcount-limit;
		alert( limit + MSGbyteLimitExceed );
		return -1;
	}
	return 0;
}

function nByte(str){
	var tmpStr;
	var temp=0;
	var onechar;
	var tcount;
	tcount = 0;

	tmpStr = new String(str);
	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++;
		}
	}
	return tcount;
}


function nByte2(str){
	var tcount=0;
	for(var i=0,cnt=str.length; i<cnt; i++){
		var nLen = escape(str.charAt(i)).length;
		tcount++;
		if( nLen > 3 ) tcount++;   
	}
	return tcount;
}


function moviePlay(url, name, width, height) {
	var wi = screen.width - width;
	var hi = screen.height - height;
	
	if( wi < 0 ) wi = 0;
	if( hi < 0 ) hi = 0;
	
	var info = 'left=' + (wi/2) + ',top=' + (hi/2) + ',width='  + width + ',height=' + height + ',resizable=no,scrollbars=no,menubars=no,status=no';
	var newwin = window.open(url, name, info);
	newwin.focus();
}

function playerPopup(f_clip_id, f_item_id, f_titleclip ) {
	moviePlay('/web/player.do?f_clip_id='+f_clip_id+'&f_item_id='+f_item_id+'&f_titleclip='+f_titleclip,'MOVIE','360','367');
}

function playerCall(f_clip_id, f_item_id, f_titleclip ) {
	moviePlay('/web/player.do?f_clip_id='+f_clip_id+'&f_item_id='+f_item_id+'&f_titleclip='+f_titleclip,'MOVIE','360','367');
}


function playerPopup2(f_clip_id, f_item_id, f_titleclip ) {
	moviePlay('/web/player.do?mode=detail&f_clip_id='+f_clip_id+'&f_item_id='+f_item_id+'&f_titleclip='+f_titleclip,'MOVIE','733','367');
}

function playerDirectPopup(vod_url ) {
	moviePlay('/web/player.do?mode=directPlayer&vod_url='+vod_url,'MOVIE', '360','367');
}
 
//TV ¿Â¶óÀÎ..
function func_tv() { 
	tvopen = moviePlay('/web/player.do?mode=onairtv','onair', '380','350');
}

//FM ¿Â¶óÀÎ..
function func_radio() { 
	fmopen = moviePlay('/web/player.do?mode=onairfm','onair', '360','157');
}

/* cut string */
String.prototype.cut = function(len) {
	var str = this;
	var l = 0;
	for (var i=0; i<str.length; i++) {
		l += (str.charCodeAt(i) > 128) ? 2 : 1;
		if (l > len) return str.substring(0,i);
	}
	return str;
}
