/*INISEAL:[hv2EvMf6kh9DwrOcFJeFLun2MEE%3D%0A]*/
/* TxMouseButton ¼Ó¼º °ª */
// Constants for enum TxMouseButton
  mbLeft    = 0;    // ¸¶¿ì½º ¿ÞÂÊ ¹öÆ°
  mbRight   = 1;    // ¸¶¿ì½º ¿À¸¥ÂÊ ¹öÆ°
  mbMiddle  = 2;    // ¸¶¿ì½º °¡¿îµ¥ ¹öÆ°

/* SetStyleProperty ÇÔ¼ö¿¡ AStyleType ÀÎÀÚ¿¡ ¼³Á¤ ÇÏ´Â °ª */
// Constants for enum TxStyle
  snBackground  = 0;  // ¹è°æ ½ºÅ¸ÀÏ
  snContent     = 1;    // Cell ¿µ¿ª ½ºÅ¸ÀÏ
  snFooter      = 2;    // Sumary Ç¥½Ã ºÎºÐ, ÇÏ´Ü ½ºÅ¸ÀÏ
  snHeader      = 3;    // ÇØ´õ ½ºÅ¸ÀÏ
  snIndicator   = 4;    // Indicator ½ºÅ¸ÀÏ
  snInactive    = 5;    // ºñÈ°¼ºÈ­½Ã ½ºÅ¸ÀÏ
  snSelection   = 6;    // ¼±ÅÃµÈ ¿µ¿ª ½ºÅ¸ÀÏ
  snContentEven = 7;  // Cell ¿µ¿ª Â¦¼ö Row ½ºÅ¸ÀÏ
  snContentOdd  = 8;  // Cell ¿µ¿ª È¦¼ö Row ½ºÅ¸ÀÏ
  snBandHeader  = 9;  // BandHeader ½ºÅ¸ÀÏ

/* SetStyleProperty ÇÔ¼ö¿¡ AProperty ÀÎÀÚ¿¡ ¼³Á¤ ÇÏ´Â °ª */
spColor       = 0;    // StyleÀÇ Color ÇÁ·ÎÆÛÆ¼
spFontColor   = 1;    // StyleÀÇ FontColor ÇÁ·ÎÆÛÆ¼
spFontHeight  = 2;    // StyleÀÇ FontHeight ÇÁ·ÎÆÛÆ¼
spFontName    = 3;    // StyleÀÇ FontName ÇÁ·ÎÆÛÆ¼
spFontSize    = 4;    // StyleÀÇ FontSize ÇÁ·ÎÆÛÆ¼
spFontStyle   = 5;    // StyleÀÇ FontStye ÇÁ·ÎÆÛÆ¼
spTag         = 6;    // StyleÀÇ Tag ÇÁ·ÎÆÛÆ¼
spTextColor   = 7;    // StyleÀÇ TextColor ÇÁ·ÎÆÛÆ¼

/* SetStyleProperty ÇÔ¼ö¿¡ APropertyÀÎÀÚ°¡  spFontStyleÀÏ¶§ °ª¿¡ ¼³Á¤ÇÏ´Â °ª(or ¿¬»êÀ¸·Î ´Ù¼öÀÇ ¼Ó¼ºÀ» ¼³Á¤) */
fsBold        = 1;
fsItalic      = 2;
fsUnderline   = 4;
fsStrikeOut   = 8;

/* LookAndFeelKind */
lfFlat      = 0;
lfStandard  = 1;
lfUltraFlat = 2;
lfOffice11  = 3;

/* ±×¸®µå Á¾·ù »ó¼ö Á¤ÀÇ */
gkSearch    = 0; //Á¶È¸¿ë±×¸®µå
gkModify    = 1; //ÆíÁý¿ë±×¸®µå(ÀÔ·Â/¼öÁ¤/»èÁ¦/Ã£±â/ÃÊ±âÈ­/ÆÄÀÏÀÐ±â/ÆÄÀÏÀúÀå/¼öÃëÀÎÁ¶È¸/Àü¼Û ¹öÆ°µîÀ» ±×¸®µå³»¿¡ ´õ ±×¸°´Ù.)

/* ÆíÁý¿ë ±×¸®µå ¿¡¼­ »ç¿ëµÉ ¹öÆ°ÀÇ Á¤·Ä */
gaLeft  = 0; //¿ÞÂÊÁ¤·Ä
gaRight = 1; //¿À¸¥ÂÊÁ¤·Ä

/* ÆíÁý¿ë ±×¸®µå ¿¡¼­ ¼öÃëÀÎÁ¶È¸¹öÆ° Visible */
gsReceiveBtnView      = 0;
gsReceiveBtnNoneView  = 1;

/* ColumnTypeÁ¤ÀÇ »ó¼ö */
//0:AHN 1:A 2:H 3:N 4:AN 5:HN 6:AH (TextColumnHeader¿¡¼­¸¸ »ç¿ë) ±âº» ctAHN
ctAHN = 0;
ctA   = 1;
ctH   = 2;
ctN   = 3;
ctAN  = 4;
ctHN  = 5;
ctAH  = 6;
ctLAN = 7;

/* OpenFileType */


// Constants for enum TxBandProperty
  bpCaption           = 3;
  bpFixedKind         = 4;
  bpHeaderAlignHorz   = 5;
  bpHeaderAlignVert   = 6;
  bpHoldOwnColumnOnly = 7;
  bpMoving            = 8;
  bpSizing            = 9;
  bpParentBandIndex   = 10;
  bpColIndex          = 11;
  bpVisible           = 12;
  bpWidth             = 13;

// Constants for enum TxNullStyle
  nsUnchecked     = 0;
  nsInactive      = 1;
  nsGrayedChecked = 2;

// Constants for enum TxAlignVert
  avTop     = 0;
  avBottom  = 1;
  avCenter  = 2;

// Constants for enum TxAlignHorz
  ahLeft    = 0;
  ahRight   = 1;
  ahCenter  = 2;

// Constants for enum TxFooterKind
  fkAverage = 0;
  fkCount   = 1;
  fkMax     = 2;
  fkMin     = 3;
  fkNone    = 4;
  fkSum     = 5;

// Constants for enum TxNullStyle
//type TxNullStyle
  nsUnchecked     = 0;
  nsInactive      = 1;
  nsGrayedChecked = 2;

// Constants for enum TxBandProperty
//type TxBandProperty
  bpCaption           = 3;
  bpFixedKind         = 4;
  bpHeaderAlignHorz   = 5;
  bpHeaderAlignVert   = 6;
  bpHoldOwnColumnOnly = 7;
  bpMoving            = 8;
  bpSizing            = 9;
  bpParentBandIndex   = 10;
  bpColIndex          = 11;
  bpVisible           = 12;
  bpWidth             = 13;

// Constants for enum TxColumnStatus
//type TxColumnStatus
  csVisible   = 1;
  csFiltering = 2;
  csSearch    = 4;
  csGroup     = 8;
  csPrint     = 16;
  csSTRING    = 256;
  csSTRINGA   = 512;
  csSTRINGH   = 768;
  csSTRINGN   = 1024;
  csSTRINGAH  = 1280;
  csSTRINGAN  = 1536;
  csSTRINGHN  = 1792;
  csSTRINGAHN = 2048;

// Constants for enum TxColumnPropertiesStatus
//type TxColumnPropertiesStatus
  psCombobox  = 0;

//MRDÆÄÀÏ ÀÎ¼â °ü·Ã »ó¼ö Á¤ÀÇ(¿ì¸®ÀºÇà)
  mrdPreview  = 0; //¹Ì¸®º¸±â
  mrdPrint    = 1; //ÀÎ¼â


/******************************************************************************
   XGrid¿¡ ÄÃ·³À» Ãß°¡ÇÏ´Â ÇÔ¼ö
 *****************************************************************************/
  /* [ AType, ACaption, AAlignDataHorz, AAlignDataVert, AAlignHeaderHorz, AAlignHeaderVert: STRING;
              AVisible, ASorting, ASizing, AVerSizing, AMoving, ACellMerging,
              ADisableEditor: WordBool; AWidth, AColIndex, ARowIndex, ALineCount,
              AParentBandIndex: integer
            ] */

/*
    function AddBandHeader(const ACaption: string;
      AHeaderAlignHorz: TxAlignHorz; AHeaderAlignVert: TxAlignVert;
      AWidth: Integer; AVisible, AMoving, ASizing,
      AHoldOwnColumnOnly: Boolean; const AFixedKind: string;
      AColIndex, AParentBandIndex: Integer): Integer; safecall;
*/

/**
 * combobox ÄÃ·³ ÀÌ °æ¿ì
 * @param grid         {Object} grid
 * @param caption      {String} Ç¥½Ã ÀÌ¸§
 * @param width        {int}    »çÀÌÁî
 * @param visible      {boolean} Ç¥½Ã¿©ºÎ
 * @param sortable     {boolean} sorting ¿©ºÎ
 * @param filterable   {boolean} filterable ¿©ºÎ
 * @param readonly     {boolean} readonly ¿©ºÎ
 * @param align        {String} Á¤·Ä °ª "center", "left", "right"
 * @param AMoving      {boolean} drag & drop ¿©ºÎ
 * @param colIndex     {int}    colIndex
 * @param ARequired    {boolean} ÇÊ¼ö Ç×¸ñ ¿©ºÎ
 * @param AMaxlength   {int}   validation ½Ã Ã¼Å© ±æÀÌ
 * @param rowIndex     {int}    rowIndex
 * @param bandindex    {int}    bandindex (¹­À½)
 */
function AppendComboColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, ARequired, AMaxlength, rowIndex, bandindex) {
  if (colIndex == undefined) colIndex = -1;
	if (rowIndex == undefined) rowIndex = -1;
	if (bandindex == undefined) bandindex = 0;
	if (sortable == undefined) sortable = false;
	if (filterable == undefined) filterable = true;
	if (readonly == undefined) readonly = true;
	if (align == undefined) align = 'center';
	if (AMoving == undefined) AMoving = true;
	//if (ASizing == undefined) ASizing = true;
	if (AMaxlength == undefined) AMaxlength = 0;
  if (ARequired == undefined) ARrequired = 0;

	var idx = grid.AddColumnHeader('combo', caption, align, 'center', 'center', 'center'
						, visible, sortable, true, false, true, false
						, readonly, width, colIndex, rowIndex, 1
						, bandindex , filterable, ARequired, AMaxlength
					    );
	var columnObj = grid.GetColumn(idx);
	columnObj.Moving = AMoving;
}


/**
 * ÅØ½ºÆ® ÄÃ·³ ÀÌ °æ¿ì
 * @param grid         {Object} grid
 * @param caption      {String} Ç¥½Ã ÀÌ¸§
 * @param width        {int}    »çÀÌÁî
 * @param visible      {boolean} Ç¥½Ã¿©ºÎ
 * @param sortable     {boolean} sorting ¿©ºÎ
 * @param filterable   {boolean} filterable ¿©ºÎ
 * @param readonly     {boolean} readonly ¿©ºÎ
 * @param align        {String} Á¤·Ä °ª "center", "left", "right"
 * @param AMoving      {boolean} drag & drop ¿©ºÎ
 * @param colIndex     {int}    colIndex
 * @param ARequired    {boolean} ÇÊ¼ö Ç×¸ñ ¿©ºÎ
 * @param AMaxlength   {int}   validation ½Ã Ã¼Å© ±æÀÌ
 * @param AColumnType  {int}   validation ½Ã ÇÑ±Û, ¿µ¹® ¿©ºÎ (ctAHN,ctA,ctH,ctN,ctAN,ctHN,ctAH,ctLAN) ´©°¡ Á¤¸® ÇØÁÖ¼¼¿ä please ÁöÄ£´Ù ÁöÃÄ..
 * @param rowIndex     {int}    rowIndex
 * @param bandindex    {int}    bandindex (¹­À½)
 */
function AppendTextColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, ARequired, AMaxlength, AColumnType, rowIndex, bandindex) {
  if (colIndex == undefined) colIndex = -1;
  if (rowIndex == undefined) rowIndex = -1;
  if (bandindex == undefined) bandindex = 0;
  if (sortable == undefined) sortable = false;
  if (filterable == undefined) filterable = true;
  if (readonly == undefined) readonly = true;
  if (align == undefined) align = 'center';
  if (AMoving == undefined) AMoving = true;
  if (ARequired == undefined) ARequired = false;
  if (AMaxlength == undefined) AMaxlength = 0;
  if (AColumnType == undefined) AColumnType = ctAHN;
  //if (AMaxLength == undefined) AMaxLength = 0;
  //if (ARequired == undefined) ARrequired = 0;

  //alert(maxlength);
  //alert(required);
                                //AType, ACaption, AAlignDataHorz, AAlignDataVert, AAlignHeaderHorz, AAlignHeaderVert
  var idx = grid.AddColumnHeader('text', caption , align         , 'center'      , 'center'        , 'center'
            //AVisible,ASorting,ASizing, AVerSizing, AMoving, ACellMerging
            , visible, sortable, true  , false     , true   , false
            //ADisableEditor, AWidth, AColIndex,ARowIndex,ALineCount
            , readonly      , width , colIndex, rowIndex, 1
            //AParentBandIndex, AFiltering
            , bandindex       , filterable, ARequired, AMaxlength, AColumnType
            );
  var columnObj = grid.GetColumn(idx);
  //SetStyleProperty(snContent, spTextColor,  RgbColor(102, 102, 102));
  columnObj.Moving = AMoving;

}

/**
 * Ã¼Å©¹Ú½º ÄÃ·³ÀÎ°æ¿ì
 * @param grid         {Object} grid
 * @param caption      {String} Ç¥½Ã ÀÌ¸§
 * @param width        {int}    »çÀÌÁî
 * @param visible      {boolean} Ç¥½Ã¿©ºÎ
 * @param sortable     {boolean} sorting ¿©ºÎ
 * @param filterable   {boolean} filterable ¿©ºÎ
 * @param readonly     {boolean} readonly ¿©ºÎ
 * @param align        {String} Á¤·Ä °ª "center", "left", "right"
 * @param AMoving      {boolean} drag & drop ¿©ºÎ
 * @param colIndex     {int}    colIndex
 * @param rowIndex     {int}    rowIndex
 * @param bandindex    {int}    bandindex (¹­À½)
 */
function AppendCheckColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, rowIndex, bandindex) {
  if (colIndex == undefined) colIndex = -1;
  if (rowIndex == undefined) rowIndex = -1;
  if (bandindex == undefined) bandindex = 0;
  if (sortable == undefined) sortable = false;
  if (filterable == undefined) filterable = true;
  if (readonly == undefined) readonly = true;
  if (align == undefined) align = 'center';
  if (AMoving == undefined) AMoving = true;
  if (caption == '¼±ÅÃ' ) readonly = false;

  var idx = grid.AddColumnHeader('check', caption, align, 'center', 'center', 'center'
            , visible, sortable, true, false, true, false
            , readonly, width, colIndex, rowIndex, 1
            , bandindex , filterable
              );
  var columnObj = grid.GetColumn(idx);
  columnObj.Moving = AMoving;
}


/**
 * ¶óµð¿À ÄÃ·³ÀÎ°æ¿ì
 * @param grid         {Object} grid
 * @param caption      {String} Ç¥½Ã ÀÌ¸§
 * @param width        {int}    »çÀÌÁî
 * @param visible      {boolean} Ç¥½Ã¿©ºÎ
 * @param sortable     {boolean} sorting ¿©ºÎ
 * @param filterable   {boolean} filterable ¿©ºÎ
 * @param readonly     {boolean} readonly ¿©ºÎ
 * @param align        {String} Á¤·Ä °ª "center", "left", "right"
 * @param AMoving      {boolean} drag & drop ¿©ºÎ
 * @param colIndex     {int}    colIndex
 * @param rowIndex     {int}    rowIndex
 * @param bandindex    {int}    bandindex (¹­À½)
 */
function AppendRadioColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, rowIndex, bandindex) {
  //alert('TEST0');
  if (colIndex == undefined) colIndex = -1;
  if (rowIndex == undefined) rowIndex = -1;
  if (bandindex == undefined) bandindex = 0;
  if (sortable == undefined) sortable = false;
  if (filterable == undefined) filterable = true;
  if (readonly == undefined) readonly = true;
  if (align == undefined) align = 'center';
  if (AMoving == undefined) AMoving = false;

  readonly = true;

  var idx = grid.AddColumnHeader('radio', caption, align, 'center', 'center', 'center'
            , visible, sortable, true, false, true, false
            , readonly, width, colIndex, rowIndex, 1
            , bandindex , filterable
              );
  //¶óµð¿À ¹öÆ° Ä®·³Àº ÀÓ½Ã·Î ¿òÁ÷ÀÌ´Â ±â´É ¸·¾Æ³ùÀ½. Ä®·³ÀÌµ¿ÀÌ ÇÊ¿äÇÑ °æ¿ì ÁÖ¼® Ã³¸® ÇØÁ¦ÇØ ÁÖ¼¼¿ä.
  //var columnObj = grid.GetColumn(idx);
  //columnObj.Moving = AMoving;
}

/**
 * È­Æó ÄÃ·³ÀÎ°æ¿ì
 * @param grid         {Object} grid
 * @param caption      {String} Ç¥½Ã ÀÌ¸§
 * @param width        {int}    »çÀÌÁî
 * @param visible      {boolean} Ç¥½Ã¿©ºÎ
 * @param sortable     {boolean} sorting ¿©ºÎ
 * @param filterable   {boolean} filterable ¿©ºÎ
 * @param readonly     {boolean} readonly ¿©ºÎ
 * @param align        {String} Á¤·Ä °ª "center", "left", "right"
 * @param AMoving      {boolean} drag & drop ¿©ºÎ
 * @param colIndex     {int}    colIndex
 * @param rowIndex     {int}    rowIndex
 * @param bandindex    {int}    bandindex (¹­À½)
 * @param DecimalPlaces    {int}    ±¸ºÐ¹®ÀÚ Ç¥½Ã index
 * @param DecimalChar    {String}    ±¸ºÐ¹®ÀÚ
 */
function AppendCurrencyColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, ARequired, AMaxLength, rowIndex, bandindex, DecimalPlaces, DecimalChar) {
  if (colIndex == undefined) colIndex = -1;
  if (rowIndex == undefined) rowIndex = -1;
  if (bandindex == undefined) bandindex = 0;
  if (sortable == undefined) sortable = false;
  if (filterable == undefined) filterable = true;
  if (readonly == undefined) readonly = true;
  if (align == undefined) align = 'right';
  if (AMoving == undefined) AMoving = true;
  if (DecimalChar == undefined) DecimalChar = '#';
  if (ARequired == undefined) ARequired = false;
  if (AMaxLength == undefined) AMaxLength = 0;

  var idx = grid.AddColumnHeader('currency', caption, align, 'center', 'center', 'center'
              , visible, sortable, true, false, true, false
              , readonly, width, colIndex, rowIndex, 1
              , bandindex , filterable, ARequired, AMaxLength
                );

  var columnObj = grid.GetColumn(idx);
  columnObj.Moving = AMoving;

  if (DecimalPlaces != undefined)
  {
    try{
      var cc = grid.GetColumn(idx);
      var cp = cc.GetProperties();
      var DecimalStr = '';
      for(var i=0;i<DecimalPlaces;i++)
        DecimalStr += DecimalChar;

      cp.DecimalPlaces = DecimalPlaces;
      cp.DisplayFormat = "\,0." + DecimalStr +";-\,0." + DecimalStr;
    }catch(E){

    }
  }
}


//function AppendCurrencyColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, rowIndex) {
//  if (colIndex == undefined) colIndex = -1;
//  if (rowIndex == undefined) rowIndex = -1;
//  if (sortable == undefined) sortable = false;
//  if (filterable == undefined) filterable = true;
//  if (readonly == undefined) readonly = true;
//  if (align == undefined) align = 'right';
//  if (AMoving == undefined) AMoving = true;

//  var idx = grid.AddColumnHeader('currency', caption, align, 'center', 'center', 'center'
//              , visible, sortable, true, false, true, false
//              , readonly, width, colIndex, rowIndex, 1
//              , 0 , filterable
//                );
//  var columnObj = grid.GetColumn(idx);
//  columnObj.Moving = AMoving;
//}

function AppendHyperLinkColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, rowIndex, bandindex) {
  if (colIndex == undefined) colIndex = -1;
  if (rowIndex == undefined) rowIndex = -1;
  if (bandindex == undefined) bandindex = 0;
  if (sortable == undefined) sortable = false;
  if (filterable == undefined) filterable = true;
  if (readonly == undefined) readonly = true;
  if (align == undefined) align = 'center';
  if (AMoving == undefined) AMoving = true;

  var idx = grid.AddColumnHeader('hyperlink', caption, align, 'center', 'center', 'center'
              , visible, sortable, true, false, true, false
              , readonly, width, colIndex, rowIndex, 1
              , bandindex , filterable
                );
  var columnObj = grid.GetColumn(idx);
  columnObj.Moving = AMoving;
}

function AppendMaskColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, ARequired, AMaxLength, rowIndex, bandindex) {
  if (colIndex == undefined) colIndex = -1;
  if (rowIndex == undefined) rowIndex = -1;
  if (bandindex == undefined) bandindex = 0;
  if (sortable == undefined) sortable = false;
  if (filterable == undefined) filterable = true;
  if (readonly == undefined) readonly = true;
  if (align == undefined) align = 'left';
  if (AMoving == undefined) AMoving = true;

  var idx = grid.AddColumnHeader('mask', caption, align, 'center', 'center', 'center'
              , visible, sortable, true, false, true, false
              , readonly, width, colIndex, rowIndex, 1
              , bandindex , filterable, ARequired, AMaxLength
                );
  var columnObj = grid.GetColumn(idx);
  columnObj.Moving = AMoving;
}

function AppendButtonColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, rowIndex, bandindex) {
  if (colIndex == undefined) colIndex = -1;
  if (rowIndex == undefined) rowIndex = -1;
  if (bandindex == undefined) bandindex = 0;
  if (sortable == undefined) sortable = false;
  if (filterable == undefined) filterable = true;
  if (readonly == undefined) readonly = true;
  //if (align == undefined) align = 'left';
  if (AMoving == undefined) AMoving = true;

  var idx = grid.AddColumnHeader('Button', caption, align, 'center', 'center', 'center'
              , visible, sortable, true, false, true, false
              , readonly, width, colIndex, rowIndex, 1
              , bandindex , filterable
                );
  var columnObj = grid.GetColumn(idx);
  columnObj.Moving = AMoving;
  //grid.ColumnAddButtons();
}

function AppendTextAColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, rowIndex, bandindex){
  AppendTextColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, rowIndex, bandindex);
}

function AppendTextHColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, rowIndex, bandindex){
  AppendTextColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, rowIndex, bandindex);
}

function AppendTextNColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, rowIndex, bandindex){
  AppendTextColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, rowIndex, bandindex);
}

function AppendTextAHColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, rowIndex, bandindex){
  AppendTextColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, rowIndex, bandindex);
}

function AppendTextANColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, rowIndex, bandindex){
  AppendTextColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, rowIndex, bandindex);
}

function AppendTextHNColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, rowIndex, bandindex){
  AppendTextColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, rowIndex, bandindex);
}

function AppendTextAHNColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, rowIndex, bandindex){
  AppendTextColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, rowIndex, bandindex);
}

function ShowSeq(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, rowIndex, bandindex){

}

function AppendDateColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, ARequired, rowIndex, bandindex){
  if (colIndex == undefined) colIndex = -1;
  if (rowIndex == undefined) rowIndex = -1;
  if (bandindex == undefined) bandindex = 0;
  if (sortable == undefined) sortable = false;
  if (filterable == undefined) filterable = true;
  if (readonly == undefined) readonly = true;
  if (align == undefined) align = 'left';
  if (AMoving == undefined) AMoving = true;
  if (ARequired == undefined) ARequired = false;

  var idx = grid.AddColumnHeader('date', caption, align, 'center', 'center', 'center'
              , visible, sortable, true, false, true, false
              , readonly, width, colIndex, rowIndex, 1
              , bandindex , filterable , ARequired
                );
  var columnObj = grid.GetColumn(idx);
  columnObj.Moving = AMoving;
}

function AppendIntColumnHeader(grid, caption, width, visible, sortable, filterable, readonly, align, AMoving, colIndex, rowIndex, bandindex) {
  if (colIndex == undefined) colIndex = -1;
  if (rowIndex == undefined) rowIndex = -1;
  if (bandindex == undefined) bandindex = 0;
  if (sortable == undefined) sortable = false;
  if (filterable == undefined) filterable = true;
  if (readonly == undefined) readonly = true;
  if (align == undefined) align = 'left';
  if (AMoving == undefined) AMoving = true;

  var idx = grid.AddColumnHeader('text', caption, align, 'center', 'center', 'center'
              , visible, sortable, true, false, true, false
              , readonly, width, colIndex, rowIndex, 1
              , bandindex , filterable
                );
  var columnObj = grid.GetColumn(idx);
  columnObj.ValueType = "integer";
}

/******************************************************************************
   XGridÀÇ Å×¸¶¸¦ ¼³Á¤ÇÏ´Â ÇÔ¼ö
 *****************************************************************************/
function InitGridDesign( grid , XH, XW, XBankName, XAppletTitle, XTitleBackColor, XTitleForeColor, XFontStyle, XCheckboxAll, XSetnoseq, XPrintFontSize, XOrientation) {
  if (XBankName == undefined)   XBankName   = "ÇÏ³ªÀºÇà";   //"<%=applet_bankname%>";
  if (XAppletTitle == undefined)  XAppletTitle  = "°áÀç½ÇÇà´ë±â-";  //"°áÀç½ÇÇà´ë±â-<%=CodeUtil.getupmu_dist(upmu_dist[screen_index])%>";
  if (XTitleBackColor == undefined) XTitleBackColor = "236, 231, 216";      //"<%=applet_titlebackcolor%>";
  if (XTitleForeColor == undefined) XTitleForeColor = "66, 72, 63";      //"<%=applet_titleforecolor%>";
  if (XFontStyle == undefined)    XFontStyle    = "BOLD";
  if ((XCheckboxAll == undefined) || (XCheckboxAll == '') )     XCheckboxAll = "false";
  if (XSetnoseq == undefined)     XSetnoseq = "false";
  if (XPrintFontSize == undefined)  XPrintFontSize = 1;
  if (XOrientation == undefined)    XOrientation = 1;
  if (XOrientation != 2) XOrientation = 1;

  with( grid ) {
    //******** ±×¸®µå ±âº» Á¤º¸
    GridName      = XAppletTitle;
    BankName      = XBankName;
    GridFontName  = '±¼¸²';
    GridFontSize  = 9;  //FontSize Á¶Á¤ .. ±âº»Àº 9
    HeaderHeight  = 26;
    CellHeight    = 26;
    Footer        = true;
    GridLine_set  = 'B'; //±×¸®µå ¶óÀÎÁöÁ¤ H-°¡·Î, V-¼¼·Î, B-¾çÂÊ´Ù, N-¶óÀÎ¾øÀ½.
    AutoWidth     = false;
    PrintFontSize = XPrintFontSize;
    GridLineColor = RgbColor(204, 204, 204);
    PrintOrientation  = XOrientation; // ¹Ì¸®º¸±â ¹× ÀÎ¼â½Ã ÆäÀÌÁö ¼³Á¤°ª ±âº»1:¼¼·Î 2:°¡·Î
    HeaderBorderColor = RgbColor(190, 180, 155);
    SetLanguage('kor');   //ÇÑ±Û : kor , ¿µ¹® : eng
    //CheckBox ColumnHeaderÀÎ °æ¿ì ÀüÃ¼¼±ÅÃ/ÀüÃ¼ÇØÁ¦ ¹Ú½º Visible
    if((XCheckboxAll == true) || (XCheckboxAll == 'true'))
      CheckBoxAll = true;
    PrintPageHeaderVisible = true; // PageHeader º¸¿©ÁÙÁö ¿©ºÎ
    //**°Ë»ö Á¶°Ç ¸ðµç ÆäÀÌÁö¿¡ º¸¿©ÁÙÁö ¿©ºÎ
    //PrintPageTitleConditionVisible = true;
    //**GridHeaderºÎºÐ ¸ðµç ÆäÀÌÁö¿¡ Ãâ·ÂÇÒÁö ¿©ºÎ : trueÀÏ¶§´Â ¸ðµç ÆäÀÌÁö¿¡ º¸¿©ÁÖ°í falseÀÏ¶§´Â Ã¹ÆäÀÌÁö¸¸
    //PrintRepaintGridHeader = true;

    //** Indicator infomation
    Indicator         = false;
    IndicatorShowSeq  = true;
    IndicatorWidth    = 40;

    //**MainGrid Frame infomation
    DetailFrameWidth = 1;
    DetailFrameColor = RgbColor(190, 180, 155);

    //** »ó¼¼º¸±â infomation
    DetailedView = true; // ´õºíÅ¬¸¯½Ã »ó¼¼º¸±â ¿©ºÎ
    DetailedFormHeaderColor   = RgbColor(238, 246, 248);
    FDetailedFormContentColor = RgbColor(255, 255, 255);
    FDetailedFormLineColor    = RgbColor(111, 184, 185);

    //** Â¦¼ö¶óÀÎ infomation
    SetStyleProperty(snContent, spColor     , RgbColor(255, 255, 255));
    SetStyleProperty(snContent, spFontColor , RgbColor(102, 102, 102));
    SetStyleProperty(snContent, spFontHeight, -11);
    SetStyleProperty(snContent, spFontName  , 'Gulim');
    SetStyleProperty(snContent, spFontSize  , 9);
    //SetStyleProperty(snContent, spFontStyle , fsBold);
    SetStyleProperty(snContent, spTextColor,  RgbColor(102, 102, 102));
    //SetStyleProperty(snContent, spFontStyle , fsBold | fsItalic | fsUnderline | fsStrikeOut);
    //SetStyleProperty(snContent, spTag       , 1);

    //** È¦¼ö¶óÀÎ infomation
    SetStyleProperty(snContentOdd, spColor     , RgbColor(255, 255, 255));
    SetStyleProperty(snContentOdd, spFontColor , RgbColor(102, 102, 102));
    SetStyleProperty(snContentOdd, spFontHeight, -11);
    SetStyleProperty(snContentOdd, spFontName  , 'Gulim');
    SetStyleProperty(snContentOdd, spFontSize  , 9);
    //SetStyleProperty(snContentOdd, spFontStyle , fsBold);
    SetStyleProperty(snContentOdd, spTextColor,  RgbColor(102, 102, 102));
    //SetStyleProperty(snContentOdd, spFontStyle , fsBold | fsItalic | fsUnderline | fsStrikeOut);
    //SetStyleProperty(snContentOdd, spTag       , 1);

    //**ÇÕ°è¿µ¿ª
    FooterFrameStyle      = lfFlat;
    FooterSeparatorColor  = RgbColor(245, 243, 235);
    FooterLineColor       = RgbColor(245, 243, 235);
    FooterBorderColor     = RgbColor(190, 180, 155); //À§ÀÇ FooterLineColor¿Í °°°ÔÇÏ¸é ¾Èº¸ÀÓ..
    FooterHeight          = 26;
    SetStyleProperty(snFooter, spColor    , RgbColor(245, 243, 235));
    SetStyleProperty(snFooter, spFontName , 'Gulim');
    SetStyleProperty(snFooter, spFontStyle, fsBold);
    SetStyleProperty(snFooter, spFontSize , 9);   //FontSize Á¶Á¤ .. ±âº»Àº 9
    SetStyleProperty(snFooter, spTextColor, RgbColor(68, 68, 68));

    //**Header infomation
    // [ AStyleType, AProperty, AValue ] ¸ðµç ÆÄ¶ó¸ÞÅÍ ÇÊ¼ö
    if(XTitleBackColor.length = 3)
      eval("SetStyleProperty(snHeader, spColor,     RgbColor(" + XTitleBackColor + "))");
    else
      SetStyleProperty(snHeader, spColor,     RgbColor(235, 235, 235));
    SetStyleProperty(snHeader, spFontName , 'Gulim');
    SetStyleProperty(snHeader, spFontSize , 9);    //ÄÃ·³ FontSize Á¶Á¤ .. ±âº»Àº 9
    SetStyleProperty(snHeader, spFontStyle, fsBold);
    if(XTitleForeColor.length = 3)
      eval("SetStyleProperty(snHeader, spTextColor,   RgbColor(" + XTitleForeColor + "))");
    else
      SetStyleProperty(snHeader, spTextColor,   RgbColor(102, 102, 102));

    //**BandHeader Infomation
    SetStyleProperty(snBandHeader, spColor, RgbColor(170, 193, 217));
    SetStyleProperty(snBandHeader, spFontName,  'Gulim');
    SetStyleProperty(snBandHeader, spFontSize,  9);
    SetStyleProperty(snBandHeader, spFontStyle, fsBold);
    //SetStyleProperty(snBandHeader, spTag,   1);
    SetStyleProperty(snBandHeader, spTextColor, RgbColor(32, 59, 89));

    //**Çà¼±ÅÃ½Ã »ö»ó
    SetStyleProperty(snSelection, spColor    , RgbColor(244, 250, 250)); //¿ì¸®ÀºÇà
    SetStyleProperty(snSelection, spFontName , 'Gulim');
    SetStyleProperty(snSelection, spFontSize , 9);
    //SetStyleProperty(snSelection, spFontStyle,  fsBold | fsItalic | fsUnderline | fsStrikeOut);
    SetStyleProperty(snSelection, spTextColor, RgbColor(102, 102, 102));

    //**inactive Infomation
    SetStyleProperty(snInactive, spColor    , RgbColor(244, 250, 250)); // ¿ì¸®ÀºÇà
    SetStyleProperty(snInactive, spFontName , 'Gulim');
    SetStyleProperty(snInactive, spFontSize ,  9);
    //SetStyleProperty(snInactive, spFontStyle, fsBold | fsItalic | fsUnderline | fsStrikeOut);
    SetStyleProperty(snInactive, spTextColor, RgbColor(102, 102, 102));

    //**Indecator Infomation
    SetStyleProperty(snIndicator, spColor     , RgbColor(255, 255, 255));
    SetStyleProperty(snIndicator, spFontColor , RgbColor(102, 102, 102));
    SetStyleProperty(snIndicator, spFontName  , 'Gulim');
    SetStyleProperty(snIndicator, spFontSize  , 9);
    SetStyleProperty(snIndicator, spTextColor , RgbColor(102, 102, 102));

    /***************************************************************************
    SetStyleProperty(snBackground, spColor,   RgbColor(, , ));
    SetStyleProperty(snBackground, spFontColor, RgbColor( , , ));
    SetStyleProperty(snBackground, spFontHeight,-11);
    SetStyleProperty(snBackground, spFontName,  '±¼¸²');
    SetStyleProperty(snBackground, spFontSize,  9);
    SetStyleProperty(snBackground, spFontStyle, fsBold | fsItalic | fsUnderline | fsStrikeOut);
    SetStyleProperty(snBackground, spTag,   1);
    SetStyleProperty(snBackground, spTextColor, RgbColor( , , ));
    ***************************************************************************/
  }
}

/******************************************************************************
name=Å°°ª   |width=0  |type=STRING  |sort=Y|edit=N|find=Y|align=CENTER;
name=cre_date |width=0  |type=HIDDEN  |sort=N|edit=N|find=Y|align=CENTER;
name=cre_time |width=0  |type=HIDDEN  |sort=N|edit=N|find=Y|align=CENTER;
name=rejectsayu |width=0  |type=HIDDEN  |sort=N|edit=N|find=Y|align=CENTER;
name=¼±ÅÃ   |width=50 |type=RADIO   |sort=N|edit=Y|find=N|align=CENTER;
name=½ÅÃ»ÀÏÀÚ |width=90 |type=STRING  |sort=Y|edit=N|find=Y|align=CENTER;
name=Åë È­    |width=60 |type=STRING  |sort=Y|edit=N|find=Y|align=CENTER;
name=°³¼³±Ý¾× |width=100  |type=STRINGN |sort=Y|edit=N|find=Y|align=RIGHT;
name=¼±Àû±âÀÏ |width=90 |type=STRING  |sort=Y|edit=N|find=Y|align=CENTER;
name=À¯È¿±âÀÏ |width=90 |type=STRING  |sort=Y|edit=N|find=Y|align=CENTER;
name=½Å¿ëÀå¹øÈ£ |width=100  |type=STRING  |sort=Y|edit=N|find=Y|align=CENTER;
name=Á¢¼ö»óÅÂ |width=87 |type=STRING  |sort=Y|edit=N|find=Y|align=CENTER;
 *****************************************************************************/
function initSecond(grid, columnheader_def, titlename) {
  grid.BeginUpdate();
  try {
    if((titlename!=undefined)||(titlename!=null))
      grid.GridName = titlename;
    var arr = columnheader_def.split(';');
    var i, j, strLine, opst;
    var op, value, spIndex;
    grid.ClearAllObj();

    var vName, vWidth, vType, vSort;
    var vEdit, vFind, vAlign, visible;

    for(i=0; i<arr.length; i++) {
      strLine = arr[i];
      if(strLine == '') continue;
      strLine = strLine.split('|');

      vName = '';
      vWidth = 0;
      vType = '';
      vSort = true;
      vEdit = true;
      vFind = true;
      vAlign = 'center';

      for(j=0; j<strLine.length; j++) {
        opst = strLine[j];
        spIndex = opst.search('=');
        op = opst.substr(0, spIndex);
        value = opst.substr(spIndex+1, opst.length-spIndex-1);
        op = op.toLowerCase();
        value = value.toLowerCase();
//alert(op + '\n' + value);
        if(op == 'name') {
//alert(op + '\n' + 'vName = value;' + '\n' + vName);
          vName = opst.substr(spIndex+1, opst.length-spIndex-1);
        } else if(op == 'width') {
//alert(op + '\n' + 'vWidth = value;' + '\n' + vWidth);
          vWidth = value;
        } else if(op == 'type') {
//alert(op + '\n' + 'vType = value;' + '\n' + vType);
          vType = value;
        } else if(op == 'sort') {
//alert(op + '\n' + 'vSort = value;' + '\n' + vSort);
          vSort = (value == 'y') ? true : false;
        } else if(op == 'edit') {
//alert(op + '\n' + 'vEdit = value;' + '\n' + vEdit);
          vEdit = (value == 'y') ? false : true;
        } else if(op == 'find') {
//alert(op + '\n' + 'vFind = value;' + '\n' + vFind);
          vFind = (value == 'y') ? true : false;
        } else if(op == 'align') {
//alert(op + '\n' + 'vAlign = value;' + '\n' + vAlign);
          vAlign = value;
        }
//name=¼±ÅÃ   |width=50 |type=RADIO   |sort=N|edit=Y|find=N|align=CENTER;
      }
      //if( strLine.length <= 1 ) continue;

  /*
  alert(strLine.length + '\n\n' + '"' + vName + '", '+
  '"' + vWidth + '", '+
  '"' + vType + '", '+
  '"' + vSort + '", '+
  '"' + vEdit + '", '+
  '"' + vFind + '", '+
  '"' + vAlign + '"');
  */
      if(vName == 'Å°°ª') visible = false;
      else visible = true;
      // ¿©±â¼­ ÄÃ·³ ÇØ´õ Á¤ÀÇÇØÁÖ±â.
      if( vType.search('choice') >= 0 ) {
        ;
      } else if(vType.search('boolean') >= 0 ) {
        AppendCheckColumnHeader(grid, vName, vWidth, visible, vSort, true, vEdit, vAlign);
      } else if(vType.search('radio') >= 0 ) {
        AppendRadioColumnHeader(grid, vName, vWidth, visible, vSort, false, vEdit, vAlign);
      } else if(vType.search('currency') >= 0 ) {
        AppendCurrencyColumnHeader(grid, vName, vWidth, visible, vSort, true, vEdit, vAlign);
      } else if(vType.search('hidden') >= 0 ) {
        visible = false;
        AppendTextColumnHeader(grid, vName, vWidth, visible, vSort, true, vEdit, vAlign);
      } else if(vType.search('stringhn') >= 0 ) {
        AppendTextHNColumnHeader(grid, vName, vWidth, visible, vSort, true, vEdit, vAlign);
      } else if(vType.search('stringah') >= 0 ) {
        AppendTextAHColumnHeader(grid, vName, vWidth, visible, vSort, true, vEdit, vAlign);
      } else if(vType.search('stringan') >= 0 ) {
        AppendTextANColumnHeader(grid, vName, vWidth, visible, vSort, true, vEdit, vAlign);
      } else if(vType.search('stringahn') >= 0 ) {
        AppendTextAHNColumnHeader(grid, vName, vWidth, visible, vSort, true, vEdit, vAlign);
      } else if(vType.search('stringa') >= 0 ) {
        AppendTextAColumnHeader(grid, vName, vWidth, visible, vSort, true, vEdit, vAlign);
      } else if(vType.search('stringh') >= 0 ) {
        AppendTextHColumnHeader(grid, vName, vWidth, visible, vSort, true, vEdit, vAlign);
      } else if(vType.search('stringn') >= 0 ) {
        AppendTextNColumnHeader(grid, vName, vWidth, visible, vSort, true, vEdit, vAlign);
      } else if(vType.search('string') >= 0 ) {
        AppendTextColumnHeader(grid, vName, vWidth, visible, vSort, true, vEdit, vAlign);
      } else if(vType.search('seq') >= 0 ) {
        ShowSeq(grid, vName, vWidth, visible, vSort, filterable, vEdit, vAlign);
      } else if(vType.search('date') >= 0 ) {
        AppendDateColumnHeader(grid, vName, vWidth, visible, vSort, true, vEdit, vAlign);
      } else if(vType.search('int') >= 0 ) {
        AppendIntColumnHeader(grid, vName, vWidth, visible, vSort, true, vEdit, vAlign);
      } else {
        AppendTextColumnHeader(grid, vName, vWidth, visible, vSort, true, vEdit, vAlign);
      }
    }
  } catch(e) {
    //alert('initSecond ERROR : '+e.description);
  } finally {
    grid.EndUpdate();
    grid.LoadFromRegstry();
  }
}
