///////////////////////////////////////////////////////
//
// ¼¿·ºÆ®Æû ·¹ÀÌ¾î·Î º¯°æÇÏ±â
// ÀÛ¼ºÀÚ : IEZN<iezn@iezn.com>
// È¨ÆäÀÌÁö : http://iezn.com
//
// »ç¿ë¹æ¹ý
// ¼¿·ºÆ®Æû ¹Ù·ÎµÚ¿¡ ´ÙÀ½ ½ºÅ©¸³Æ®¸¦ ³Ö¾îÁØ´Ù.
//
// ºê¶ó¿ìÁ® ¿ÀÈ¯ : DOM LEVEL1 Áö¿ø ºê¶ó¿ìÁ® 
// ¼¿·ºÆ®Æû ³×ÀÓÀº id·Îµµ ¼±¾ðµÇ¾î¾ß ÇÑ´Ù.
//
// <script\>selectLayer(¼¿·ºÆ®Æû ¿ÀºêÁ§Æ®,'¹Ì¸® ¼±ÅÃµÇ¾îÁú °ª','onSelect ½ÇÇàÇÔ¼ö','selectbox width');</script\>
//
///////////////////////////////////////////////////////
document.write("<style type='text/css'>");
document.write('.selectMain{width:100%; cursor: pointer; position:relative;z-index:50;text-align:left;display:block;}');
document.write('.selectTitle{overflow:hidden;padding-left:4px;width: 100%; cursor: pointer; color:#000000;color:red}');
document.write('.selectSub{;padding-left: 4px;width: 100%; cursor: pointer; height: 19px;}');
document.write('.optlaysub{}');
document.write('</style>');
var nowValIndex;
var optLay = new Object;
var selectbox_img_path='/images';
optLay.count = 1;

function selectLayer(obj,val,func,w,selectbox_img_path){
	obj.style.display = 'none';
	optLay[optLay.count] = obj;
	objOpt = optLay[optLay.count].options;
	str = new Array();
	total = objOpt.length;
	tHeight = 21 * total;
	tHeight =(tHeight > 100 && document.all) ? '100px' : 'auto';
	out = "<div class='selectMain'>";// style='widthf:" + w + ";'>";
		out += "<div style='border:1px #bbb solid;width:100%;display:block'>";
			out += "<table border='0' width='100%' cellspacing='0' cellspacing='0' bgcolor='#eeeeee' height='19'>";
			out += "<tr>";
			out += "<td id='title_" + optLay.count + "' class='selectTitle' onClick=\"execOpt('" + optLay.count + "','','"+selectbox_img_path+"');\" valign=bottom nowrap>";
			out +=  objOpt[0].text + " " + "</td><td width=13 style=padding-right:4px align=center><img src="+selectbox_img_path+"/btn_down.gif id='btnImg_" + optLay.count + "' onClick=\"execOpt('" + optLay.count + "','','"+selectbox_img_path+"');\"></td></tr></table>";
		out += "</div>";
		out += "<div id='optLay_" + optLay.count + "' style='display:none;border:1px #dddddd solid;overflow-y:auto;background-color:white;position:absolute;width:100%;";
			if(total>3){
				out += ";height:"+tHeight+";max-height:"+tHeight+"' class=optLaysub>";
			}else{
				out += ";' class=optLaysub>";
			}
			out += "<table border=0 cellpadding=0 cellspacing=0 width=100%>";
	for(i = 0; i < total; i++){
		thisTxt = objOpt[i].text;
		thisVal = objOpt[i].value;
		if(val == thisVal) nowValIndex = i;
		str[i] = "<tr class='selectSub' height=21 onmouseover=\"style.backgroundColor='orange';\" onmouseout=\"style.backgroundColor=''\" onClick=\"javascript:execOpt('" + optLay.count + "','" + i + "','"+selectbox_img_path+"');" + func + "\" value='" + thisVal + "'><td style='border-bottom:1px #eeeeee solid;padding-left:2px'><nobr>" + thisTxt + "</nobr></td></tr>";
	}
			out += str.join('');
			out += "</table>";
		out += "</div>";
	out += "</div>";
	document.write(out);
	if(nowValIndex){
		optLay[optLay.count].options[nowValIndex].selected = true;
		document.getElementById("title_" + optLay.count).innerHTML = optLay[optLay.count].options[nowValIndex].text;
	}
	nowValIndex = '';
	optLay.count++;
}

function execOpt(n, i,selectbox_img_path){
   objoptLay = document.getElementById("optLay_" + n);
   objBtnImg = document.getElementById("btnImg_" + n);
   if(objoptLay.style.display == 'none'){
      objBtnImg.src = selectbox_img_path +'/btn_up.gif';
      objoptLay.style.display = 'block';
   }else{
      if(i){
         optLay[n].options[i].selected = true;
         document.getElementById("title_" + n).innerHTML = optLay[n].options[i].text;
      }
      objBtnImg.src = selectbox_img_path+'/btn_down.gif';
      objoptLay.style.display = 'none';
   }
}
//-->
