var nowOpenedSelectBox="";var nowOpenedSelectExpBox=new Array();var mousePosition="";var downArrowSrc="";var downArrowSrcWidth=20;var downArrowSrc2="/template/images/ico_add.png";var upArrowSrc2="/template/images/ico_minus.png";function InitSelectBoxCSS(){var w="PADDING-LEFT: 3px; FONT-SIZE: 12px; COLOR: #000000; LINE-HEIGHT: 17px; PADDING-TOP: 1px;";var I="PADDING-LEFT: 3px; font-weight:bold; FONT-SIZE: 12px; COLOR: #000000; LINE-HEIGHT: 17px; PADDING-TOP: 1px;";var C="PADDING-LEFT: 3px; FONT-SIZE: 12px; COLOR: #333333; LINE-HEIGHT: 17px; PADDING-TOP: 1px;";var x="PADDING-LEFT: 3px; FONT-SIZE: 12px; COLOR: #000000; LINE-HEIGHT: 17px; PADDING-TOP: 2px;  BACKGROUND-COLOR: #ffffff;";var E="PADDING-LEFT: 3px; FONT-SIZE: 12px; COLOR: #333333; LINE-HEIGHT: 17px; PADDING-TOP: 2px;  BACKGROUND-COLOR: #FFBA00 ;cursor:pointer;";var t="BORDER-RIGHT: #b4b4b4 1px solid; BORDER-TOP: #b4b4b4 1px solid; OVERFLOW: auto; BORDER-LEFT: #b4b4b4 1px solid;   BORDER-BOTTOM: #b4b4b4 1px solid; BACKGROUND-COLOR: #ffffff;";var u="BACKGROUND-COLOR: #7ffff7;";var B;var D=false;var G=false;var y=false;var H=false;var F=false;var i=false;var z=false;if(document.styleSheets.length>0){for(var A=0;A<document.styleSheets.length;A++){B=new Stylesheet(A);if(B.getRule(".selectBoxSelectedArea")){D=true}if(B.getRule(".selectBoxSelectedVal")){G=true}if(B.getRule(".selectBoxSelectedAreaFocus")){y=true}if(B.getRule(".selectBoxOption")){H=true}if(B.getRule(".selectBoxOptionOver")){F=true}if(B.getRule(".selectBoxOptionInnerLayer")){i=true}if(B.getRule(".selectBoxBackground")){z=true}}if(!D){B.insertRule(".selectBoxSelectedArea",w)}if(!G){B.insertRule(".selectBoxSelectedVal",I)}if(!y){B.insertRule(".selectBoxSelectedAreaFocus",C)}if(!H){B.insertRule(".selectBoxOption",x)}if(!F){B.insertRule(".selectBoxOptionOver",E)}if(!i){B.insertRule(".selectBoxOptionInnerLayer",t)}if(!z){B.insertRule(".selectBoxBackground",u)}}else{var J=document.createElement("style");J.setAttribute("type","text/css");var v=document.getElementsByTagName("head")[0];v.appendChild(J);B=new Stylesheet(0);B.insertRule(".selectBoxSelectedArea",w);B.insertRule(".selectBoxSelectedAreaFocus",C);B.insertRule(".selectBoxOption",x);B.insertRule(".selectBoxOptionOver",E);B.insertRule(".selectBoxOptionInnerLayer",t);B.insertRule(".selectBoxBackground",u);B.insertRule(".selectBoxSelectedVal",I)}}function addselectoptions(j,g){var f=document.getElementById(j);var h;for(var i=0;i<g.length;i++){h=new Option(g[i].n,g[i].v);h.setAttribute("havechild",g[i].c);h.setAttribute("level",g[i].l);f.options.add(h);f.options[0].selected=true}}function selectThisValue(h,k){var m=h;var i=k;var j=document.getElementById(m);var n=j.options[i].text;var l=j.options[i].value;if(l==""&&k>0){return}hideOptionLayer(m);if(j){j.value=l}if(k==0){settingValue(m,n,false)}else{settingValue(m,n,true)}selectBoxFocus(m);jQuery(j).change()}function settingValue(h,g,k){var j=h;var l=g;var i=document.getElementById(j+"selectBoxSelectedValue");if(i){i.innerHTML=l;if(k){i.className="selectBoxSelectedVal"}else{i.className="selectBoxSelectedArea"}}}function viewOptionLayer(e){var d=e;var f=document.getElementById(d+"selectBoxOptionLayer");if(f){f.style.display=""}nowOpenedSelectBox=d;setMousePosition("inBox")}function hideOptionLayer(e){var d=e;var f=document.getElementById(d+"selectBoxOptionLayer");if(f){f.style.display="none"}}function setMousePosition(d){var c=d;mousePosition=c}function clickMouse(){if(mousePosition=="out"){hideOptionLayer(nowOpenedSelectBox)}}function selectBoxFocus(e){var d=e;var f=document.getElementById(d+"selectBoxSelectedValue");f.focus()}function selectBoxBlur(e){var d=e;var f=document.getElementById(d+"selectBoxSelectedValue")}function closeBrotherLayer(i,j){var g=nowOpenedSelectExpBox[j];if(!document.getElementById(i)){return}var h=new Array();for(var f=0;f<g.length;f++){if(document.getElementById(g[f])&&g[f]!=i){if(!isParentNode(document.getElementById(g[f]),document.getElementById(i))){document.getElementById(g[f]).style.display="none";document.getElementById(g[f]+"AR").src=downArrowSrc2}else{h.push(g[f])}}}nowOpenedSelectExpBox[j]=h}function isParentNode(g,f){if(f==g){return false}for(var h=0,e=f;e=e.parentNode;h++){if(e==g){return true}if(e==document.documentElement){return false}}}function showExpLayer(d,e){closeBrotherLayer(d,e);var f=document.getElementById(d);if(f&&f.style.display=="block"){f.style.display="none";nowOpenedSelectExpBox[e].pop();document.getElementById(d+"AR").src=downArrowSrc2}else{if(f.style.display=="none"){f.style.display="block";nowOpenedSelectExpBox[e].push(d);document.getElementById(d+"AR").src=upArrowSrc2}}}function makeSelectBox(B){InitSelectBoxCSS();var C;var y;var i=18;var F=7;var s;if(typeof(B)=="object"){if(!B.selectid){return}else{var E=B.selectid;if(B.optionMaxNum){F=B.optionMaxNum}}}else{var E=B}y=document.getElementById(E);i=parseInt(y.style.height);s=parseInt(y.style.width);if(y.options.length>F){C=i*F}else{C=i*(y.options.length+1)}newSelect="<table id='"+E+"selectBoxOptionLayer' style='position:absolute;z-index:100;display:none;border-collapse:collapse;' onMouseOver=\"viewOptionLayer('"+E+"')\" onMouseOut=\"setMousePosition('out')\">";newSelect+=" <tr class='selectBoxSelectedArea'>";newSelect+=" <td onClick=\"hideOptionLayer('"+E+"')\"></td>";newSelect+=" </tr>";newSelect+=" <tr>";newSelect+=" <td style='height:0px;'></td>";newSelect+=" </tr>";newSelect+=" <tr>";newSelect+=" <td bgcolor='#D3D3D3'>";newSelect+=" <div class='selectBoxOptionInnerLayer' style='width:"+(s-5)+"px;height:"+C+"px;'>";newSelect+=" <table style='border-collapse:collapse;' width='100%'>";newSelect+=" <tr onMouseOver=\"this.className='selectBoxOptionOver'\" onMouseOut=\"this.className='selectBoxOption'\" onClick=\"selectThisValue('"+E+"',"+0+");\" class='selectBoxOption' >";newSelect+="  <td style='white-space:nowrap;'>";newSelect+="<span style='font-weight:bold' >&nbsp;&nbsp;"+y.options[0].text;+"</span></nobr>";newSelect+="</td></tr>";var A=1;for(var z=1;z<y.options.length;z++){var w=y.options[z].value;var x=y.options[z].text;var D=y.options[z].getAttribute("havechild")?y.options[z].getAttribute("havechild"):"false";var n=y.options[z].getAttribute("level")?y.options[z].getAttribute("level"):1;if(A>n){newSelect+="</table></td></tr>";z--;A--}else{newSelect+=" <tr onMouseOver=\"this.className='selectBoxOptionOver'\" onMouseOut=\"this.className='selectBoxOption'\" onClick=\"selectThisValue('"+E+"',"+z+");\" class='selectBoxOption' >";newSelect+="  <td style='white-space:nowrap;'><nobr>";if(D=="true"||D=="1"){newSelect+="<span id='"+E+"SelectBoxOptionValue"+z+"exp' onClick='event.cancelBubble = true; showExpLayer(\""+E+"SelectBoxOptionValue"+z+'expLayer","'+E+"\");' >";for(var t=1;t<n;t++){newSelect+="&nbsp;"}newSelect+="<img src='"+downArrowSrc2+"' class='selectBoxdownArrow' id='"+E+"SelectBoxOptionValue"+z+"expLayerAR'>";newSelect+="</span>"}else{newSelect+="<span>";for(var t=1;t<n;t++){newSelect+="&nbsp;"}newSelect+="&nbsp;&nbsp;";newSelect+="</span>"}newSelect+="<span>"+x+"</span></nobr>";newSelect+="</td>";newSelect+=" </tr>";if(D=="true"||D=="1"){newSelect+="<tr style='display:none;' id='"+E+"SelectBoxOptionValue"+z+"expLayer'>";newSelect+="<td><table cellpadding='0' cellspacing='0' border='0' style='overflow:auto;width:"+(s-2)+"px;'>"}if(A<n){A=n}}}for(A;A>1;){newSelect+="</table></td></tr>";z--;A--}newSelect+=" </table>";newSelect+=" </div>";newSelect+=" </td>";newSelect+=" </tr>";newSelect+="</table>";newSelect+="<div onClick=\"viewOptionLayer('"+E+"')\" class='selectBoxBackground' style='WIDTH:"+s+"px;'>";newSelect+="<div id='"+E+"selectBoxSelectedValue' class='selectBoxSelectedArea' style='width:"+(s-downArrowSrcWidth)+"px; overflow:hidden;' onBlur=\"selectBoxBlur('"+E+"')\" ></div>";if(downArrowSrc!=""){newSelect+="<span><img src='"+downArrowSrc+"' class='selectBoxdownArrow' border='0'></span>"}newSelect+="</div>";var u=document.createElement("span");u.innerHTML=newSelect;y.parentNode.insertBefore(u,y);var v=false;for(var z=y.options.length-1;z>=0;z--){if(y.options[z].value==y.getAttribute("currvalue")){v=true;settingValue(E,y.options[z].text,z);y.options[z].selected=true}}if(!v){settingValue(E,y.options[0].text,false)}nowOpenedSelectExpBox[E]=new Array()}document.onmousedown=clickMouse;