///////////////////////////////////////////////////////
//
// ¼¿·ºÆ®Æû ·¹ÀÌ¾î·Î º¯°æÇÏ±â
// ÀÛ¼ºÀÚ : 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;}');
document.write('.selectSub{;padding-left: 4px;width: 100%; cursor: pointer; height: 19px;}');
document.write('.optlaysub{}');
document.write('.optlayScroll{scrollbar-shadow-color:#DDDDDD;scrollbar-darkshadow-color:#FFFFFF;scrollbar-3dlight-color:#DDDDDD;scrollbar-highlight-color:#FFFFFF;scrollbar-face-color:#EEEEEE;scrollbar-arrow-color:#AAAAAA;}');
document.write('</style>');
var nowValIndex;
var optLay = new Object;
var selectbox_img_path='img';
optLay.count = 1;

function selectLayerNomal(obj,val,func,w,selectbox_img_path){
    val = val!='' ? val : '' ; 
    objName = obj.name;
	obj.style.display = 'none';
	optLay[optLay.count] = obj;
	objOpt = optLay[optLay.count].options;
	str = new Array();
	total = objOpt.length;
	tHeight = 25 * total;
	tHeight =(tHeight > 500 && document.all) ? '500' : 'auto';
	out = "<div class='selectMain' style='width:100%;' onMousemove='optLay_" + optLay.count + ".style.display=\"inline\"' onMouseout='optLay_" + optLay.count + ".style.display=\"none\";optLay_" + optLay.count + ".style.zIndex=\"999\"' onMousemove='optLay_" + optLay.count + ".style.display=\"inline\";optLay_" + optLay.count + ".style.zIndex=\"900\"'>";
		out += "<div style='border:0px #bbb solid;width:100%;display:block' >";
			out += "<table id='my"+objName+"' border='0' width='" + w + "' cellspacing='0' cellspacing='0' height='19' onMouseout='optLay_" + optLay.count + ".style.display=\"none\"'>";
			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+"/selectBtn.gif id='btnImg_" + optLay.count + "' onClick=\"execOpt('" + optLay.count + "','','"+selectbox_img_path+"');\"></td></tr></table>";
		out += "</div>";
        out += "<div id='optLay_" + optLay.count + "' onMouseOver='this.style.zIndex=\"0\"' style='width:100%;display:none;border:1px #dddddd solid;border-top:0px;background-color:white;position:absolute;z-index:900;";
			if(total>3){
				out += ";height:"+tHeight+";max-height:"+tHeight+"' class=optLaysub>";
			}else{
				out += ";' class=optLaysub>";
			}
        out += "<div style='width:100%;height:100%;overflow-y:auto;height:"+tHeight+";max-height:"+tHeight+"'' class='optlayScroll'>";
            out += "<table border=0 cellpadding=0 cellspacing=0 width='100%' onMousemove='optLay_" + optLay.count + ".style.display=\"inline\"' onMouseout='optLay_" + optLay.count + ".style.display=\"none\"'>";
	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>";
	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 selectLayer(obj,val,func,w,selectbox_img_path,rborder,rbgcolor){
    val = val!='' ? val : '' ; 
    rborder = rborder ? rborder : '#DDDDDD' ;
    rbgcolor = rbgcolor ? rbgcolor : '#EEEEEE' ;
    objName = obj.name;
	obj.style.display = 'none';
	optLay[optLay.count] = obj;
	objOpt = optLay[optLay.count].options;
	str = new Array();
	total = objOpt.length;
	tHeight = 25 * total;
	tHeight =(tHeight > 500 && document.all) ? '500' : 'auto';
	out = "<div class='selectMain' style='width:100%;z-index:500;' onMouseOver='this.style.zIndex=\"1000\";optLay_" + optLay.count + ".style.display=\"inline\"' onMousemove='this.style.zIndex=\"1000\";optLay_" + optLay.count + ".style.display=\"inline\"' onMouseout='this.style.zIndex=\"500\";optLay_" + optLay.count + ".style.display=\"none\";optLay_" + optLay.count + ".style.zIndex=\"999\"' onMousemove='optLay_" + optLay.count + ".style.display=\"inline\";optLay_" + optLay.count + ".style.zIndex=\"900\"'>";
		out += "<div style='border:0px #bbb solid;width:100%;display:block' >";
			out += "<table id='my"+objName+"' border='0' width='" + w + "' cellspacing='0' cellspacing='0' height='19' radius='1' rborder='"+rborder+"' rbgcolor='"+rbgcolor+"' onMouseout='optLay_" + optLay.count + ".style.display=\"none\"'>";
			out += "<tr>";
			out += "<td id='title_" + optLay.count + "' class='selectTitle' onMouseOut='this.style.zIndex=\"501\"' onMouseOver='this.style.zIndex=\"1001\"'  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+"/selectBtn.gif id='btnImg_" + optLay.count + "' onClick=\"execOpt('" + optLay.count + "','','"+selectbox_img_path+"');\"></td></tr></table>";
		out += "</div>";
        out += "<div id='optLay_" + optLay.count + "' onMouseOver='this.style.zIndex=\"0\"' onMouseout='optLay_" + optLay.count + ".style.display=\"none\"' style='width:100%;display:none;border:1px #dddddd solid;border-top:0px;background-color:white;position:absolute;";
			if(total>3){
				out += ";height:"+tHeight+";max-height:"+tHeight+"' class=optLaysub>";
			}else{
				out += ";' class=optLaysub>";
			}
        out += "<table id='myValue"+objName+"' border=0 cellpadding=0 cellspacing=0 width='" + w + "' height='*' radius='1' rborder='#666666' rbgcolor='#FFFFFF' onMousemove='optLay_" + optLay.count + ".style.display=\"inline\"' onMouseout='optLay_" + optLay.count + ".style.display=\"none\"'><tr><td>";
        out += "<div style='width:100%;height:100%;overflow-y:auto;height:"+tHeight+";max-height:"+tHeight+"'' class='optlayScroll'>";
            out += "<table border=0 cellpadding=0 cellspacing=0 width='100%' onMousemove='optLay_" + optLay.count + ".style.display=\"inline\"' onMouseout='optLay_" + optLay.count + ".style.display=\"none\"'>";
	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 += "</td></tr></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++;
    roundTable('my'+objName);
    //roundTable('myValue'+objName);
}

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 +'/selectBtn.gif';
      //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+'/selectBtn.gif';
      //objBtnImg.src = selectbox_img_path+'/btn_down.gif';
      objoptLay.style.display = 'none';
   }
}
//-->
