/* ¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë
	¡Ý Select_01 START
¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë*/
var Ko_ENV = new Object();
Ko_ENV.IE_Version = new Number(((window.navigator.appVersion.split('; '))[1].split(' '))[1]);
Ko_ENV.CR = new Object();
Ko_ENV.CR.ReverseBackground = '#E5E5E5';
Ko_ENV.CR.ReverseText = '#9A9A9A';
Ko_ENV.CR.Border = '#CCCCCC'; //³ë¸Ö »óÅÂ Å×µÎ¸® »ö»ó
Ko_ENV.CR.BorderActive = '#CCCCCC'; // ¸¶¿ì½º ¿À¹öµÆÀ»¶§ Å×µÎ¸® »ö»ó
Ko_ENV.ImgPrefix = 'images/';
Ko_ENV.DefaultHeight = 20;
Ko_ENV.ButtonWidth = 16;  //Ç®´Ù¿î ÀÌ¹ÌÁö width°ª
Ko_ENV.OptionsDivStyle = ''
  + ' display:none;'
  + ' z-index:10;'
  + ' position:absolute;'
  + ' border:1 solid '+ Ko_ENV.CR.Border+';'
  + ' background-color:#FFFFFF;'
  + ' scrollbar-face-color:#D2E4C2;'
  + ' scrollbar-shadow-color:#D2E4C2;'
  + ' scrollbar-highlight-color:#D2E4C2;'
  + ' scrollbar-3dlight-color:#D2E4C2;'
  + ' scrollbar-darkshadow-color:#D2E4C2;'
  + ' scrollbar-track-color:#EFF5E9;'
  + ' scrollbar-arrow-color:#245500;';
Ko_ENV.MouseStyle = 'cursor:hand;'//¹Ú½ºÀ§¿¡¿Ã¶ó°¬À»¶§ÀÇ ¸¶¿ì½º¸ð¾ç
Ko_ENV.OptionNobrStyle = ''
  + ' font-size:12px; color=#9A9A9A;'
  + ' padding-left:5px;'  
  + ' font-family:Dotum';
// SaySelect Variables
var Ko_VAR = new Object();
Ko_VAR.DivDummy = document.createElement("DIV");
Ko_VAR.SelectList = new Array();
Ko_VAR.bEventAttached = false;

var Ko_CreatedElements = new Object();

function unloadObjects()
{
  try {
    if (Ko_VAR && Ko_VAR.SelectList)
    {
      for (key in Ko_VAR.SelectList)
      {
	if (Ko_VAR.SelectList[key])
	{
	  try {
	   Ko_VAR.SelectList[key].select.setAttribute('Pru', 0);
	  } catch (e) {};
	  delete Ko_VAR.SelectList[key];
	}
      }
    }
  } catch (e) {};
}

attachEvent("onunload", unloadObjects);

function Ko_create (srcHTML, ListMax, bAutoDetect)
{
  // property
  this.ssID = Ko_VAR.SelectList.length;
  this.bOriginalSelect = (bAutoDetect && Ko_ENV.IE_Version < 5.5);
  this.select = Ko_createElement(srcHTML);
  this.selectedIndex = this.select.selectedIndex;
  this.options = this.select.options;
  this.width = parseInt(this.select.style.width);
  this.height = (this.select.style.height) ? parseInt(this.select.style.height) : Ko_ENV.DefaultHeight;
  this.OptionHeight = this.height - 4;
  this.bListDown = (ListMax && '-'==ListMax.toString().substr(0, 1)) ? false : true;
  this.ListMax = (!isNaN(parseInt(ListMax))) ? Math.abs(ListMax) : 100;

  this.Table;
  this.TitleDiv;
  this.TitleTable;
  this.TitleWrapper;
  this.OptionsDiv;
  this.OptionsWrapper;
  this.OptionsTable;
  this.bFocused = false;
  this.bExpanded = false;
  this.bReverse = false;

  // private method
  this.isThisEventToBeCanceled = Ko_isThisEventToBeCanceled;
  this.toggleTitle = Ko_toggleTitle;
  this.syncSelectedIndex = Ko_syncSelectedIndex;
  this.toggleOptions = Ko_toggleOptions;
  this.turnOnOption = Ko_turnOnOption;
  this.turnOffOption = Ko_turnOffOption;
  this.handleMousewheel = Ko_handleMousewheel;
  this.handleOverTitle = Ko_handleOverTitle;
  this.handleOutTitle = Ko_handleOutTitle;
  this.handleOverOption = Ko_handleOverOption;
  this.createTable = Ko_createTable;
  this.createTitleDiv = Ko_createTitleDiv;
  this.createOptionsDiv = Ko_createOptionsDiv;
  this.createOptionTr = Ko_createOptionTr;
  this.adjustOptionsDiv = Ko_adjustOptionsDiv;
  this.syncOptions = Ko_syncOptions;
  this.pressOption = Ko_pressOption;
  this.moveOption = Ko_moveOption;
  this.releaseOption = Ko_releaseOption;
  this.pressTitle = Ko_pressTitle;
  this.releaseTitle = Ko_releaseTitle;

  // public method
  this.display = Ko_display;
  this.insertOption = Ko_insertOption;
  this.deleteOption = Ko_deleteOption;
  this.changeOption = Ko_changeOption;

  // initiate
  this.createTable();
  this.select.setAttribute('Pru', this);
  if (!this.bOriginalSelect)
    this.select.onpropertychange = Ko_handlePropertychange;
  Ko_VAR.SelectList[this.ssID] = this;
}
function Ko_display ()
{
  document.write("<div id=Ko_TempDiv></div>\n");
  document.all.Ko_TempDiv.appendChild(this.Table);
  document.all.Ko_TempDiv.removeNode();
}
function Ko_write (srcHTML, ListMax, bAutoDetect)
{
  var oPru = new Ko_create(srcHTML, ListMax, bAutoDetect);
  oPru.display();
  return oPru;
}
function Ko_insertOption (value, innerText, idx)
{
  var NewOption = document.createElement("OPTION");
  Ko_CreatedElements[Ko_CreatedElements.length] = NewOption;
  this.options.add(NewOption, idx);
  NewOption.innerText = innerText;
  NewOption.value = value;

  if (!this.bOriginalSelect)
    this.createOptionTr(idx);
  this.syncOptions();
  this.adjustOptionsDiv();
  this.syncSelectedIndex();
}
function Ko_deleteOption (idx)
{
  this.options.remove(idx);
  if (!this.bOriginalSelect)
    this.OptionsTable.deleteRow(idx);
  this.syncOptions();
  this.adjustOptionsDiv();
  this.syncSelectedIndex();
}
function Ko_changeOption (idx, value, innerText)
{
  this.options[idx].value = value;
  this.options[idx].innerText = innerText;
  this.syncOptions();
  this.syncSelectedIndex();
}

function Ko_insertOption1 (obj, value, innerText, idx)
{
  var NewOption = document.createElement("OPTION");
  Ko_CreatedElements[Ko_CreatedElements.length] = NewOption;
  obj.options.add(NewOption, idx);
  NewOption.innerText = innerText;
  NewOption.value = value;

  if (!obj.bOriginalSelect)
    obj.createOptionTr(idx);

  obj.syncOptions();
  obj.adjustOptionsDiv();
  obj.syncSelectedIndex();
}


function Ko_changeOption1 (obj, idx, value, innerText)
{
  obj.options[idx].value = value;
  obj.options[idx].innerText = innerText;
  obj.syncOptions();
  obj.syncSelectedIndex();
}

function Ko_deleteOption1 (obj, idx)
{
  obj.options.remove(idx);
  if (!obj.bOriginalSelect)
    obj.OptionsTable.deleteRow(idx);
  obj.syncOptions();
  obj.adjustOptionsDiv();
  obj.syncSelectedIndex();
}


function Ko_cancelEvent (event)
{
  event.cancelBubble = true;
  event.returnValue = false;
}
function Ko_isThisEventToBeCanceled (event)
{
  if ('object' == typeof(event)) {
    switch (event.type) {
      case 'mousedown':
        if (!(event.button & 1)) return true;
        break;
      case 'mouseup':
        if (!(event.button & 1)) return true;
        if (Ko_ENV.IE_Version >= 5.5 && event.srcElement != this.srcElementOfLastMousedown && this.srcElementOfLastMousedown != null) {
          this.srcElementOfLastMousedown = null;
          return true;
        }
        break;
      case 'mouseout':
        if (!(Ko_ENV.IE_Version < 5.5 && event.srcElement == this.srcElementOfLastMousedown))
          return true;
        break;
      case 'mousemove':
        if (Ko_ENV.IE_Version >= 5.5 && event.srcElement != this.srcElementOfLastMousedown && this.srcElementOfLastMousedown != null)
          return true;
        break;
    }
  }
  return false;
}
function Ko_createElement (html)
{
  Ko_VAR.DivDummy.insertAdjacentHTML('afterBegin', html);
  var oEl = Ko_VAR.DivDummy.children(0);
  while (Ko_VAR.DivDummy.children.length > 0) {
    Ko_VAR.DivDummy.removeChild(Ko_VAR.DivDummy.children(0));
  }
  return oEl;
}
function Ko_blurExcept (except)
{
  Ko_cancelEvent(window.event);

  except = ('number'==typeof(except)) ? except : -1;

  var bHasToDetachEvent = true;
  for (var i=0; i < Ko_VAR.SelectList.length; i++) {
    if (-1==except && Ko_VAR.SelectList[i].bFocused && Ko_VAR.SelectList[i].bExpanded) {
      Ko_VAR.SelectList[i].toggleOptions(false, true);
      Ko_VAR.SelectList[i].toggleTitle(true);
      bHasToDetachEvent = false;
    }
    else if (i!=except) {
      if (Ko_VAR.SelectList[i].bExpanded)
        Ko_VAR.SelectList[i].toggleOptions(false, true);
      if (Ko_VAR.SelectList[i].bReverse)
        Ko_VAR.SelectList[i].toggleTitle(false);
      Ko_VAR.SelectList[i].bFocused = false;
    }
  }

  if (Ko_VAR.bEventAttached && bHasToDetachEvent) {
    document.detachEvent('onmousedown', Ko_blurExcept);
    document.detachEvent('ondblclick', Ko_blurExcept);
    Ko_VAR.bEventAttached = false;
  }
}
function Ko_syncSelectedIndex ()
{
  this.selectedIndex = this.select.selectedIndex;

  if (this.bOriginalSelect) return;

  if (this.TitleTable.cells(0).childNodes(0).innerText != this.options[this.selectedIndex].innerText)
    this.TitleTable.cells(0).childNodes(0).innerText = this.options[this.selectedIndex].innerText;
  if (this.bExpanded)
    this.toggleOptions(false);
}
function Ko_syncSelectedIndex1 (obj)
{
  obj.selectedIndex = obj.select.selectedIndex;

  if (obj.bOriginalSelect) return;

  if (obj.TitleTable.cells(0).childNodes(0).innerText != obj.options[obj.selectedIndex].innerText)
    obj.TitleTable.cells(0).childNodes(0).innerText = obj.options[obj.selectedIndex].innerText;
  if (obj.bExpanded)
    obj.toggleOptions(false);
}
function Ko_toggleTitle (bReverse)
{
  this.bReverse = ('undefined'!=typeof(bReverse)) ? bReverse: (!this.bReverse);
  this.TitleTable.cells(0).style.backgroundColor = this.bReverse ? Ko_ENV.CR.ReverseBackground : '';
  this.TitleTable.cells(0).style.color = this.bReverse ? Ko_ENV.CR.ReverseText : '';
}
function Ko_toggleOptions (bExpanded, bStrict)
{
  if (!bStrict && !this.bFocused) {
    Ko_blurExcept(this.ssID);
  }
  this.bExpanded = ('undefined'!=typeof(bExpanded)) ? bExpanded: (!this.bExpanded);
  if (this.bExpanded) {
    this.adjustOptionsDiv();
    this.OptionsDiv.style.display = 'block';
    if (!bStrict) {
      this.toggleTitle(false);
      this.handleOverOption(this.selectedIndex);
    }
    this.handleOutTitle();
  }
  else {
    this.OptionsDiv.style.display = 'none';
    if (!bStrict) {
      this.toggleTitle(true);
    }
  }
  if (!bStrict) {
    this.bFocused = true;

    if (!Ko_VAR.bEventAttached) {
      document.attachEvent('onmousedown', Ko_blurExcept);
      document.attachEvent('ondblclick', Ko_blurExcept);
      Ko_VAR.bEventAttached = true;
    }
  }
}
function Ko_handlePropertychange ()
{
  if ('propertychange'==window.event.type && 'selectedIndex'==window.event.propertyName) {
    var oPru = window.event.srcElement.Pru;
    oPru.syncSelectedIndex();

    if (null != oPru.select.onchange)
      oPru.select.onchange();
  }
}
function Ko_handleMousewheel (event)
{
  var idx = this.selectedIndex;
  if ('mousewheel'==event.type && this.bFocused && this.bReverse) {
    for (var i=0; i < event.wheelDelta; i += 120)
      idx--;
    for (var i=0; i > event.wheelDelta; i -= 120)
      idx++;
  }
  idx = Math.max(idx, 0);
  idx = Math.min(idx, this.options.length - 1);
  this.select.selectedIndex = idx;
}
function Ko_handleOverTitle ()
{
  if (this.bExpanded)
    return;

  this.TitleTable.style.borderColor = Ko_ENV.CR.BorderActive;
  this.TitleTable.cells(1).style.display = 'none';
  this.TitleTable.cells(2).style.display = 'block';
}
function Ko_handleOutTitle ()
{
  this.TitleTable.style.borderColor = Ko_ENV.CR.Border;
  this.TitleTable.cells(2).style.display = 'none';
  this.TitleTable.cells(1).style.display = 'block';
}
function Ko_handleOverOption (idx)
{
  for (var i=0; i < this.options.length; i++) {
    if (i==idx)
      this.turnOnOption(i);
    else
      this.turnOffOption(i);
  }
}
function Ko_turnOnOption (idx)
{
  this.OptionsTable.cells(idx).style.color = Ko_ENV.CR.ReverseText;
  this.OptionsTable.cells(idx).style.backgroundColor = Ko_ENV.CR.ReverseBackground;
}
function Ko_turnOffOption (idx)
{
  this.OptionsTable.cells(idx).style.color = '';
  this.OptionsTable.cells(idx).style.backgroundColor = '';
}
function Ko_adjustOptionsDiv ()
{
  if (this.bOriginalSelect) return;

  this.OptionsDiv.style.width = this.width;
  this.OptionsDiv.style.height = Math.min(this.options.length, this.ListMax) * this.OptionHeight + 2;
  this.OptionsWrapper.style.height = this.options.length * this.OptionHeight;
  this.OptionsDiv.style.overflowY = (this.options.length > this.ListMax) ? 'scroll' : '';

  var top = this.Table.offsetTop;
  var left = this.Table.offsetLeft;
  for (var El = this.Table.offsetParent; 'BODY'!=El.tagName && 'absolute'!=El.style.position && 'relative'!=El.style.position; El = El.offsetParent) {
    if ('TABLE' != El.tagName) {
      top += El.clientTop;
      left += El.clientLeft;
    }
    top += El.offsetTop;
    left += El.offsetLeft;
  }
  this.OptionsDiv.style.top = (this.bListDown) ? (top + this.height) : (top - parseInt(this.OptionsDiv.style.height));
  this.OptionsDiv.style.left = left;

  this.TitleWrapper.style.top = 0;
  this.TitleWrapper.style.left = 0;
}
function Ko_syncOptions ()
{
  if (this.bOriginalSelect) return;

  for (var i=0; i < this.options.length; i++) {
    this.OptionsTable.cells(i).setAttribute('index', i);
    if (this.OptionsTable.cells(i).childNodes(0).innerText != this.options[i].innerText)
      this.OptionsTable.cells(i).childNodes(0).innerText = this.options[i].innerText;
  }
}
function Ko_pressTitle (event)
{
  Ko_cancelEvent(event);

  this.srcElementOfLastMousedown = event.srcElement;

  this.toggleOptions();
}
function Ko_releaseTitle (event)
{
  Ko_cancelEvent(event);

  if (this.isThisEventToBeCanceled(event)) return;

  this.srcElementOfLastMousedown = null;
}
function Ko_pressOption (event)
{
  Ko_cancelEvent(event);

  this.srcElementOfLastMousedown = event.srcElement;
}
function Ko_moveOption (event)
{
  Ko_cancelEvent(event);

  if (this.isThisEventToBeCanceled(event)) return;
  if (!(event.offsetX >= 0 && event.offsetX <= this.OptionsTable.offsetWidth)) return;

  this.handleOverOption(Math.floor(event.offsetY / this.OptionHeight));
}
function Ko_releaseOption (event)
{
  Ko_cancelEvent(event);

  if (this.isThisEventToBeCanceled(event)) return;

  this.srcElementOfLastMousedown = null;

  if (event.offsetX >= 0 && event.offsetX <= this.OptionsTable.offsetWidth) {
    this.toggleOptions(false);
    this.select.selectedIndex = Math.floor(event.offsetY / this.OptionHeight);
  }
}
function Ko_createTable ()
{
  this.Table = Ko_createElement(""
    + "<table border=0 cellpadding=0 cellspacing=0 style='table-layout:fixed; "+Ko_ENV.MouseStyle+"'>"
    + "<tr><td></td></tr>"
    + "</table>"
  );
  if (!isNaN(this.width))
    this.Table.style.width = this.width;
  this.Table.style.height = this.height;

  if (!this.bOriginalSelect) {
    this.createTitleDiv();
    this.createOptionsDiv();
    this.Table.cells(0).appendChild(this.TitleDiv);
    this.Table.cells(0).appendChild(this.OptionsDiv);
  }
  else {
    this.Table.cells(0).appendChild(this.select);
  }
}
function Ko_createTitleDiv ()
{
  this.TitleDiv = Ko_createElement(""
    + "<div style='position:relative; top:0; left:0;'>" //Ã³À½ ¼¿·ºÆ® ¸ð¾ç
    + "  <table border=0 cellpadding=0 cellspacing=0"
    + "    height="+this.height
    + "    bgcolor=FFFFFF"
    + "    style='table-layout:fixed; border:1 solid "+Ko_ENV.CR.Border+";'"
    + "    onmouseover='Ko_VAR.SelectList["+this.ssID+"].adjustOptionsDiv()'"
    + "  >"
    + "  <tr>"
    + "    <td><nobr style='text-oveflow:hidden;"+Ko_ENV.OptionNobrStyle+"'></nobr></td>"
    + "    <td width="+Ko_ENV.ButtonWidth+" align=center style='word-wrap:normal'></td>"
    + "    <td style='display:none' width="+Ko_ENV.ButtonWidth+" align=center style='word-wrap:normal'></td>"
    + "    <td style='display:none'></td>"
    + "  </tr>"
    + "  </table>"
    + "</div>"
  );
  this.TitleTable = this.TitleDiv.childNodes(0);
  this.TitleTable.cells(0).childNodes(0).innerText = this.options[this.selectedIndex].innerText;
  this.TitleTable.cells(1).innerHTML = "<img src='images/icon02.gif' border=0 width=13 height=12 align=absmiddle>"; //³ë¸Ö Ç®´Ù¿î ÀÌ¹ÌÁö
  this.TitleTable.cells(2).innerHTML = "<img src='images/icon02.gif' border=0 width=13 height=12 align=absmiddle>"; //¿À¹ö Ç®´Ù¿î ÀÌ¹ÌÁö
  this.TitleTable.cells(3).appendChild(this.select);
  this.TitleWrapper = document.createElement(""
    + "<img src='"+Ko_ENV.ImgPrefix+"blank.gif'"
    + "  style='position:absolute; top:0; left:0; z-index:2; width:100%; height:"+this.height+";'"
    + "  onmouseover='Ko_VAR.SelectList["+this.ssID+"].handleOverTitle()'"
    + "  onmouseout='Ko_VAR.SelectList["+this.ssID+"].handleOutTitle(); Ko_VAR.SelectList["+this.ssID+"].releaseTitle(window.event);'"
    + "  onmousedown='Ko_VAR.SelectList["+this.ssID+"].pressTitle(window.event)'"
    + "  ondblclick='Ko_VAR.SelectList["+this.ssID+"].pressTitle(window.event); Ko_VAR.SelectList["+this.ssID+"].releaseTitle(window.event);'"
    + "  onmouseup='Ko_VAR.SelectList["+this.ssID+"].releaseTitle(window.event)'"
    + "  onmousewheel='Ko_VAR.SelectList["+this.ssID+"].handleMousewheel(window.event)'"
    + "  ondragstart='Ko_cancelEvent(window.event)'"
    + ">"
  );
  Ko_CreatedElements[Ko_CreatedElements.length] = this.TitleWrapper;
  this.TitleDiv.appendChild(this.TitleWrapper);
}
function Ko_createOptionsDiv ()
{
  this.OptionsDiv = Ko_createElement(""
    + "<div style='"+Ko_ENV.OptionsDivStyle+"'"
    + "  onscroll='Ko_VAR.SelectList["+this.ssID+"].moveOption(window.event)'"
    + "  onmousedown='Ko_cancelEvent(window.event)'"
    + ">"
    + "  <table border=0 cellpadding=0 cellspacing=0 width=100% style='table-layout:fixed;'>" //Ç®´Ù¿î ¿­·ÈÀ»¶§ Á¤·ÄÀ§ÇÑ Å×ÀÌºí
    + "  </table>"
    + "</div>"
  );
  this.OptionsTable = this.OptionsDiv.childNodes(0);
  for (var i=0; i < this.options.length; i++) {
    this.createOptionTr(i);
  }
  this.syncOptions();
  this.OptionsWrapper = document.createElement(""
	+ "<img src='"+Ko_ENV.ImgPrefix+"blank.gif'"
    + "  style='position:absolute; top:0; left:0; width:100%;'"
    + "  onmousedown='Ko_VAR.SelectList["+this.ssID+"].pressOption(window.event)'"
    + "  onmousemove='Ko_VAR.SelectList["+this.ssID+"].moveOption(window.event)'"
    + "  onmouseup='Ko_VAR.SelectList["+this.ssID+"].releaseOption(window.event)'"
    + "  onmouseout='Ko_VAR.SelectList["+this.ssID+"].releaseOption(window.event)'"
    + "  ondragstart='Ko_cancelEvent(window.event)'"
    + ">"
  );
  Ko_CreatedElements[Ko_CreatedElements.length] = this.OptionsWrapper;
  this.OptionsDiv.appendChild(this.OptionsWrapper);
}
function Ko_createOptionTr (idx)
{
  idx = ('undefined'!=typeof(idx)) ? idx : this.options.length - 1;
  var OptionTr = this.OptionsTable.insertRow(-1);
  var OptionTd = document.createElement("<td height="+this.OptionHeight+"></td>");
  Ko_CreatedElements[Ko_CreatedElements.length] = this.OptionsTd;
  OptionTd.appendChild(document.createElement("<nobr style='"+Ko_ENV.OptionNobrStyle+"'></nobr>"));
  OptionTr.appendChild(OptionTd);
}
/* ¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë
	¡Ý Select_01 END
¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë*/

/* ¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë
	¡Ý Select_02 START
¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë*/
var nowOpenedSelectBox = "";
var mousePosition = "";

function selectThisValue(thisId,thisIndex,thisValue,thisString) {
	var objId = thisId;
	var nowIndex = thisIndex;
	var valueString = thisString;
	var sourceObj = document.getElementById(objId);
	var nowSelectedValue = document.getElementById(objId+"SelectBoxOptionValue"+nowIndex).value;
	hideOptionLayer(objId);
	if (sourceObj) sourceObj.value = nowSelectedValue;
	settingValue(objId,valueString);
	selectBoxFocus(objId);
	if (sourceObj.onchange) sourceObj.onchange();
}

function settingValue(thisId,thisString) {
	var objId = thisId;
	var valueString = thisString;
	var selectedArea = document.getElementById(objId+"selectBoxSelectedValue");
	if (selectedArea) selectedArea.innerHTML = valueString.replace("&","&amp;");
}

function viewOptionLayer(thisId) {
	var objId = thisId;
	var optionLayer = document.getElementById(objId+"selectBoxOptionLayer");
	if (optionLayer) optionLayer.style.display = "";
	nowOpenedSelectBox = objId;
	setMousePosition("inBox");
}

function hideOptionLayer(thisId) {
	var objId = thisId;
	var optionLayer = document.getElementById(objId+"selectBoxOptionLayer");
	if (optionLayer) optionLayer.style.display = "none";
}

function setMousePosition(thisValue) {
	var positionValue = thisValue;
	mousePosition = positionValue;
}

function clickMouse() {
	if (mousePosition == "out") hideOptionLayer(nowOpenedSelectBox);
}

function selectBoxFocus(thisId) {
	var objId = thisId;
	var obj = document.getElementById(objId + "selectBoxSelectedValue");
	obj.className = "selectBoxSelectedAreaFocus";
	obj.focus();
}

function selectBoxBlur(thisId) {
	var objId = thisId;
	var obj = document.getElementById(objId + "selectBoxSelectedValue");
	obj.className = "selectBoxSelectedArea";
}

function selectBoxOptionRefresh(thisId) {
	var optionHeight = 20; // option ÇÏ³ªÀÇ ³ôÀÌ
	var optionMaxNum = 6; // ÇÑ¹ø¿¡ º¸¿©Áö´Â optionÀÇ °¹¼ö
	var objId = thisId;
	var obj = document.getElementById(objId);
	var trgObj = document.getElementById(objId+"SelectBoxOptionArea");
	var newOption = "";
	
	newOption += "		<table cellpadding='0' cellspacing='0' border='0' width='100%' style='table-layout:fixed;word-break:break-all;'>";
	for (var i=0 ; i < obj.options.length ; i++) {
		var nowValue = obj.options[i].value;
		var nowText = obj.options[i].text;
		newOption += "			<tr>";
		newOption += "				<td height='" + optionHeight + "' class='selectBoxOption' onMouseOver=\"this.className='selectBoxOptionOver'\" onMouseOut=\"this.className='selectBoxOption'\" onClick=\"selectThisValue('"+ objId + "'," + i + ",'" + nowValue + "','" + nowText + "')\" style='cursor:hand;'>" + nowText + "</td>";
		newOption += "				<input type='hidden' id='"+ objId + "SelectBoxOptionValue" + i + "' value='" + nowValue + "'>";
		newOption += "			</tr>";
	}
	newOption += "		</table>";
	
	if(trgObj) {
		if (obj.options.length > optionMaxNum) trgObj.style.height = (optionHeight * optionMaxNum) + "px";
		else trgObj.style.height = (optionHeight * obj.options.length) + "px";
		trgObj.innerHTML = newOption;
		var haveSelectedValue = false;
		for (var i=0 ; i < obj.options.length ; i++) {
			if (obj.options[i].selected == true) {
				haveSelectedValue = true;
				settingValue(objId,obj.options[i].text);
			}
		}
		if (!haveSelectedValue) settingValue(objId,obj.options[0].text);
	}
}

function makeSelectBox(thisId) {
	var downArrowSrc = "images/icon02.gif";	//¿À¸¥ÂÊ È­»ìÇ¥ÀÌ¹ÌÁö
	var downArrowSrcWidth = 17;	//¿À¸¥ÂÊ È­»ìÇ¥ÀÌ¹ÌÁö width
	var optionHeight = 20; // option ÇÏ³ªÀÇ ³ôÀÌ
	var optionMaxNum = 6; // ÇÑ¹ø¿¡ º¸¿©Áö´Â optionÀÇ °¹¼ö
	var optionInnerLayerHeight = "";
	var objId = thisId;
	var obj = document.getElementById(objId);
	var selectBoxWidth = parseInt(obj.style.width);
	var selectBoxHeight = parseInt(obj.style.height);
	if (obj.options.length > optionMaxNum) optionInnerLayerHeight = "height:"+ (optionHeight * optionMaxNum) + "px";
	newSelect  = "<table id='" + objId + "selectBoxOptionLayer' cellpadding='0' cellspacing='0' border='0' style='position:absolute;z-index:100;display:none;' onMouseOver=\"viewOptionLayer('"+ objId + "')\" onMouseOut=\"setMousePosition('out')\">";
	newSelect += "	<tr>";
	newSelect += "		<td height='" + (selectBoxHeight - 1) + "' style='cursor:hand;vertical-align:middle' onClick=\"hideOptionLayer('"+ objId + "')\"></td>";
	newSelect += "	</tr>";
	newSelect += "	<tr>";
	newSelect += "		<td bgcolor='#CECEC7' style='padding:0px 1px 1px 1px'>";
	newSelect += "		<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
	newSelect += "			<tr>";
	newSelect += "				<td height='3' bgcolor='#FFFFFF'></td>";
	newSelect += "			</tr>";
	newSelect += "		</table>";
	newSelect += "		<div id='"+ objId + "SelectBoxOptionArea' class='selectBoxOptionInnerLayer' style='width:" + (selectBoxWidth-2) + "px;" + optionInnerLayerHeight + "'>";
	newSelect += "		<table cellpadding='0' cellspacing='0' border='0' width='100%' style='table-layout:fixed;word-break:break-all;'>";
	for (var i=0 ; i < obj.options.length ; i++) {
		var nowValue = obj.options[i].value;
		var nowText = obj.options[i].text;
		if (nowValue != null && nowValue != "") { // value°¡ ¾ø°Å³ª ºó°ªÀÌ¸é ÀÎµ¦½º·Î Ãë±ÞÇÏ°í »Ñ·ÁÁÖÁö ¾Ê°ÔÇÔ.
			newSelect += "			<tr>";
			newSelect += "				<td height='" + optionHeight + "' class='selectBoxOption' onMouseOver=\"this.className='selectBoxOptionOver'\" onMouseOut=\"this.className='selectBoxOption'\" onClick=\"selectThisValue('"+ objId + "'," + i + ",'" + nowValue + "','" + nowText + "')\" style='cursor:hand;'>" + nowText + "</td>";
			newSelect += "				<input type='hidden' id='"+ objId + "SelectBoxOptionValue" + i + "' value='" + nowValue + "'>";
			newSelect += "			</tr>";
		}
	}
	newSelect += "		</table>";
	newSelect += "		</div>";
	newSelect += "		<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
	newSelect += "			<tr>";
	newSelect += "				<td height='4' bgcolor='#FFFFFF'></td>";
	newSelect += "			</tr>";
	newSelect += "		</table>";
	newSelect += "		</td>";
	newSelect += "	</tr>";
	newSelect += "</table>";
	newSelect += "<table cellpadding='0' cellspacing='1' border='0' bgcolor='#CECEC7' onClick=\"viewOptionLayer('"+ objId + "')\" style='cursor:hand;' onMouseOut=\"setMousePosition('out')\">";
	newSelect += "	<tr>";
	newSelect += "		<td bgcolor='#FFFFFF'>";
	newSelect += "		<table cellpadding='0' cellspacing='0' border='0'>";
	newSelect += "			<tr>";
	newSelect += "				<td><div id='" + objId + "selectBoxSelectedValue' class='selectBoxSelectedArea' style='width:" + (selectBoxWidth - downArrowSrcWidth - 2) + "px;height:" + (selectBoxHeight - 2) + "px;overflow:hidden;' onBlur=\"selectBoxBlur('" + objId + "')\"></div></td>";
	newSelect += "				<td><img src='" + downArrowSrc + "' width='" + downArrowSrcWidth + "' border='0'></td>";
	newSelect += "			</tr>";
	newSelect += "		</table>";
	newSelect += "		</td>";
	newSelect += "	</tr>";
	newSelect += "</table>";
	document.write(newSelect);
	
	var haveSelectedValue = false;
	for (var i=0 ; i < obj.options.length ; i++) {
		if (obj.options[i].selected == true) {
			haveSelectedValue = true;
			settingValue(objId,obj.options[i].text);
		}
	}
	if (!haveSelectedValue) settingValue(objId,obj.options[0].text);
}

function makeSelectBox02(thisId, len) {
	var downArrowSrc = "images/icon02.gif";	//¿À¸¥ÂÊ È­»ìÇ¥ÀÌ¹ÌÁö
	var downArrowSrcWidth = 17;	//¿À¸¥ÂÊ È­»ìÇ¥ÀÌ¹ÌÁö width
	var optionHeight = 17; // option ÇÏ³ªÀÇ ³ôÀÌ
	var optionMaxNum = len; // ÇÑ¹ø¿¡ º¸¿©Áö´Â optionÀÇ °¹¼ö
	var optionInnerLayerHeight = "";
	var objId = thisId;
	var obj = document.getElementById(objId);
	var selectBoxWidth = parseInt(obj.style.width);
	var selectBoxHeight = parseInt(obj.style.height);
	if (obj.options.length > optionMaxNum) optionInnerLayerHeight = "height:"+ (optionHeight * optionMaxNum) + "px";
	newSelect  = "<table id='" + objId + "selectBoxOptionLayer' cellpadding='0' cellspacing='0' border='0' style='position:absolute;z-index:100;display:none;' onMouseOver=\"viewOptionLayer('"+ objId + "')\" onMouseOut=\"setMousePosition('out')\">";
	newSelect += "	<tr>";
	newSelect += "		<td height='" + (selectBoxHeight - 1) + "' style='cursor:hand;' onClick=\"hideOptionLayer('"+ objId + "')\"></td>";
	newSelect += "	</tr>";
	newSelect += "	<tr>";
	newSelect += "		<td bgcolor='#CECEC7' style='padding:0px 1px 1px 1px'>";
	newSelect += "		<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
	newSelect += "			<tr>";
	newSelect += "				<td height='3' bgcolor='#FFFFFF'></td>";
	newSelect += "			</tr>";
	newSelect += "		</table>";
	newSelect += "		<div id='"+ objId + "SelectBoxOptionArea' class='selectBoxOptionInnerLayer' style='width:" + (selectBoxWidth-2) + "px;" + optionInnerLayerHeight + "'>";
	newSelect += "		<table cellpadding='0' cellspacing='0' border='0' width='100%' style='table-layout:fixed;word-break:break-all;'>";
	for (var i=0 ; i < obj.options.length ; i++) {
		var nowValue = obj.options[i].value;
		var nowText = obj.options[i].text;
		if (nowValue != null && nowValue != "") { // value°¡ ¾ø°Å³ª ºó°ªÀÌ¸é ÀÎµ¦½º·Î Ãë±ÞÇÏ°í »Ñ·ÁÁÖÁö ¾Ê°ÔÇÔ.
			newSelect += "			<tr>";
			newSelect += "				<td height='" + optionHeight + "' class='selectBoxOption' onMouseOver=\"this.className='selectBoxOptionOver'\" onMouseOut=\"this.className='selectBoxOption'\" onClick=\"selectThisValue('"+ objId + "'," + i + ",'" + nowValue + "','" + nowText + "')\" style='cursor:hand;'>" + nowText + "</td>";
			newSelect += "				<input type='hidden' id='"+ objId + "SelectBoxOptionValue" + i + "' value='" + nowValue + "'>";
			newSelect += "			</tr>";
		}
	}
	newSelect += "		</table>";
	newSelect += "		</div>";
	newSelect += "		<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
	newSelect += "			<tr>";
	newSelect += "				<td height='4' bgcolor='#FFFFFF'></td>";
	newSelect += "			</tr>";
	newSelect += "		</table>";
	newSelect += "		</td>";
	newSelect += "	</tr>";
	newSelect += "</table>";
	newSelect += "<table cellpadding='0' cellspacing='1' border='0' bgcolor='#CECEC7' onClick=\"viewOptionLayer('"+ objId + "')\" style='cursor:hand;' onMouseOut=\"setMousePosition('out')\">";
	newSelect += "	<tr>";
	newSelect += "		<td bgcolor='#FFFFFF'>";
	newSelect += "		<table cellpadding='0' cellspacing='0' border='0'>";
	newSelect += "			<tr>";
	newSelect += "				<td><div id='" + objId + "selectBoxSelectedValue' class='selectBoxSelectedArea' style='width:" + (selectBoxWidth - downArrowSrcWidth - 2) + "px;height:" + (selectBoxHeight - 2) + "px;overflow:hidden;' onBlur=\"selectBoxBlur('" + objId + "')\"></div></td>";
	newSelect += "				<td><img src='" + downArrowSrc + "' width='" + downArrowSrcWidth + "' border='0'></td>";
	newSelect += "			</tr>";
	newSelect += "		</table>";
	newSelect += "		</td>";
	newSelect += "	</tr>";
	newSelect += "</table>";
	document.write(newSelect);
	
	var haveSelectedValue = false;
	for (var i=0 ; i < obj.options.length ; i++) {
		if (obj.options[i].selected == true) {
			haveSelectedValue = true;
			settingValue(objId,obj.options[i].text);
		}
	}
	if (!haveSelectedValue) settingValue(objId,obj.options[0].text);
}

document.onmousedown = clickMouse;
/* ¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë
	¡Ý Select_02 END
¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë*/

/* ¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë
	¡Ý Select_03 START
¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë*/
function setSelectBox(selName)
{
	sel = eval("document.all."+selName);

	borderColor = sel.style.border;
	bgColor = sel.style.backgroundColor;
	selWidth = parseInt(sel.style.width);
	rectLeft = selWidth-2;
	spanWidth = selWidth;
	
	header  = "<span style='position:relative;margin-right:0px;";
	header += "width:"+spanWidth+";height:19px;border:1px solid "+borderColor+";background-color:"+bgColor+";'>\n";
	header += "<span style='position:absolute;left:0px;top:-1px;";
	header += "width:"+selWidth+";height:17px;clip:rect(2,"+rectLeft+",18,2);'>\n";
	
	footer = "</span></span>";

	sel.outerHTML = header+sel.outerHTML+footer;
}
/* ¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë
	¡Ý Select_03 END
¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë¡ë*/