var def_SelectBoxID="AutoSelectBox";var sel_status=new Array();var def_ValList="";var def_ValArr="";var def_Maxwidth="100";var def_Maxchar="30";var def_Maxheight="110";var def_AutoTrunc=true;var def_Freetype=false;var def_DefaultValue="";var def_DefaultName="";var def_scrolling=true;var def_OnSelect="";var def_MultiBoxID="MultiSelectBox";var def_Multiwidth="100";var def_MultiDefList="";var def_MultiDefArr="";var def_PathToImages="/images/select/";var clientOpera=navigator.userAgent.indexOf("Opera")>-1;var clientIE=navigator.userAgent.indexOf("MSIE")>1&&!clientOpera;var clientIE7=navigator.userAgent.indexOf("MSIE 7")>1&&!clientOpera;var clientMozilla=navigator.userAgent.indexOf("Mozilla/5.")==0&&!clientOpera;var isSelectingField;function highlightText(c,b,a){switch(arguments.length){case 1:c.select();break;case 2:a=c.value.length;case 3:if(clientIE||clientIE7){var e=c.createTextRange();e.moveStart("character",b);e.moveEnd("character",-c.value.length+a);e.select()}else{if(clientMozilla||clientOpera){c.setSelectionRange(b,a)}}}try{c.focus();return true}catch(d){return false}}function updateTextbox(b,c){if(clientIE||clientIE7){var d=document.selection.createRange();d.text=c;d.collapse(true);d.select()}else{if(clientMozilla||clientOpera){var a=b.selectionStart;b.value=b.value.substring(0,a)+c+b.value.substring(b.selectionEnd,b.value.length);b.setSelectionRange(a+c.length,a+c.length)}}b.focus()}function checkForEmpty(b,a,c){if((a.keyCode==8||a.keyCode==46)){if(b.value!=""){return true}else{return popupSelectBox(b,a,c)}}}function getMatchIndex(a,c){for(var b=0;b<c.length;b++){thisValue=""+c[b][0];if(thisValue.toLowerCase().indexOf(a.toLowerCase())==0){return b}}return null}function popupSelectBox(c,b,e){if(e.onSelect==""){popupSelectBoxFast(c,b,e)}else{var h,d;var a;var g=new Array();d=0;h=0;if(e.maxheight>0){selectBoxDiv=document.getElementById("p"+e.selectBoxID);g[g.length]="<table id='t"+e.selectBoxID+"' cellpadding=0 cellspacing='0' border='1' class='autoSelectTable'>";re=new RegExp(/%20/ig);onSelectEsc=e.onSelect.replace(re,'"');nameFound=false;for(var d=0;d<e.valArr.length;d++){if(e.autotrunc){if(h<=e.valArr.length){thisValue=""+e.valArr[d][0];if(thisValue.toLowerCase().indexOf(c.value.toLowerCase())==0){nameFound=true}if(nameFound==true){h=h+1;g[g.length]="<tr><td ";g[g.length]=" onMouseOver='return mouseOverSelectBoxField(this);' onMouseOut='return mouseOutSelectBoxField(this);' style='"+fontweight+e.bfontcolor+";padding-left:"+bpaddingleft+"px' onClick='clickOnSelectBoxField("+e.name+', "'+e.valArr[d][1]+'");';if(onSelectEsc==""){g[g.length]="'"}else{g[g.length]=onSelectEsc+"'"}g[g.length]=">"+e.valArr[d][0]+"</td></tr>"}}else{break}}else{g[g.length]="<tr><td ";g[g.length]=" onMouseOver='return mouseOverSelectBoxField(this);' onMouseOut='return mouseOutSelectBoxField(this);' style='"+fontweight+e.bfontcolor+"' onClick='clickOnSelectBoxField("+e.name+', "'+e.valArr[d][1]+'"); ';if(onSelectEsc==""){g[g.length]="'"}else{g[g.length]=onSelectEsc+"'"}g[g.length]=">"+e.valArr[d][0]+"</td></tr>"}}g[g.length]="</table>";var f=g.join("");selectBoxDiv.innerHTML=f;selectBoxDiv.style.width=c.offsetWidth+14+"px";selectBoxDiv.style.display="block";selectBoxDiv.style.height=e.maxheight+"px";selectBoxTable=document.getElementById("t"+e.selectBoxID);selectBoxTable.style.width=c.offsetWidth+"px";if(parseInt(selectBoxTable.offsetHeight)<parseInt(e.maxheight)){selectBoxDiv.style.height=selectBoxTable.offsetHeight+1+"px"}}}return true}function popupSelectBoxFast(textboxObjBnw,oEvent,BS){var n,i;var popupSelectTable;i=0;n=0;if(BS.maxheight>0){selectBoxDiv=document.getElementById("p"+BS.selectBoxID);selectBoxDiv.innerHTML="";oTable=document.createElement("TABLE");oTable.id="t"+BS.selectBoxID;oTable.className="autoSelectTable";oTable.setAttribute("cellPadding",0);oTable.setAttribute("cellSpacing",0);var trElem,tdElem,txtNode;re=new RegExp(/%20/ig);onSelectEsc=BS.onSelect.replace(re,'"');nameFound=false;for(i=0;i<BS.valArr.length;i++){if(BS.autotrunc){if(n<=BS.valArr.length){thisValue=""+BS.valArr[i][0];if(thisValue.toLowerCase().indexOf(textboxObjBnw.value.toLowerCase())==0){nameFound=true}if(nameFound==true){n=n+1;trElem=oTable.insertRow(oTable.rows.length);tdElem=trElem.insertCell(trElem.cells.length);tdElem.id="t"+BS.selectBoxID+"_row_"+i;tdElem.onmouseover=function(){return mouseOverSelectBoxField(this)};tdElem.onmouseout=function(){return mouseOutSelectBoxField(this)};tdElem.onclick=function(){var rowcount=this.id;rowcount=rowcount.substring(rowcount.lastIndexOf("_")+1);clickedValue=BS.valArr[rowcount][1];hiddenValue=document.getElementById("h"+BS.selectBoxID);visibleValue=document.getElementById("v"+BS.selectBoxID);for(var z=0;z<BS.valArr.length;z++){thisValue=""+BS.valArr[z][1];if(thisValue.indexOf(clickedValue)==0){visibleValue.value=BS.valArr[z][0];hiddenValue.value=BS.valArr[z][1];break}}selectBoxDiv=document.getElementById("p"+BS.selectBoxID);selectBoxDiv.style.display="none";return true};txtNode=document.createTextNode(BS.valArr[i][0]);tdElem.appendChild(txtNode)}}else{break}}else{trElem=oTable.insertRow(oTable.rows.length);tdElem=trElem.insertCell(trElem.cells.length);tdElem.id="t"+BS.selectBoxID+"_row_"+i;tdElem.onmouseover=function(){return mouseOverSelectBoxField(this)};tdElem.onmouseout=function(){return mouseOutSelectBoxField(this)};tdElem.onclick=function(){var rowcount=this.id;rowcount=rowcount.substring(rowcount.lastIndexOf("_")+1);clickedValue=BS.valArr[rowcount][1];hiddenValue=document.getElementById("h"+BS.selectBoxID);visibleValue=document.getElementById("v"+BS.selectBoxID);for(var z=0;z<BS.valArr.length;z++){thisValue=""+BS.valArr[z][1];if(thisValue.indexOf(clickedValue)==0){visibleValue.value=BS.valArr[z][0];hiddenValue.value=BS.valArr[z][1];break}}selectBoxDiv=document.getElementById("p"+BS.selectBoxID);selectBoxDiv.style.display="none";if(BS.onselect){eval(BS.onselect+'("'+visibleValue.value+'",'+hiddenValue.value+")")}return true};txtNode=document.createTextNode(BS.valArr[i][0]);tdElem.appendChild(txtNode);if(BS.bold==0){tdElem.style.fontWeight="normal"}if(BS.bfontcolor!=""){tdElem.style.color=BS.bfontcolor}}}selectBoxDiv.appendChild(oTable);selectBoxDiv.style.width=textboxObjBnw.offsetWidth+(BS.scrolling?2:2)+(13)+"px";selectBoxDiv.style.display="block";selectBoxDiv.style.height=BS.maxheight+"px";selectBoxTable=document.getElementById("t"+BS.selectBoxID);selectBoxTable.style.width=textboxObjBnw.offsetWidth-(BS.scrolling?4:0)+"px";if(parseInt(selectBoxTable.offsetHeight)<parseInt(BS.maxheight)){selectBoxDiv.style.height=selectBoxTable.offsetHeight+1+"px"}}return true}function hideSelectBox(b,c){if(!isSelectingField){selectBoxDiv=document.getElementById("p"+b.selectBoxID);selectBoxDiv.style.display="none";hiddenValue=document.getElementById("h"+b.selectBoxID);visibleValue=document.getElementById("v"+b.selectBoxID);if(!visibleValue.value){hiddenValue.value="";visibleValue.value=""}else{if(hiddenValue.value){for(var a=0;a<b.valArr.length;a++){thisValue=""+b.valArr[a][1];if(thisValue.indexOf(hiddenValue.value)==0){visibleValue.value=b.valArr[a][0];return true}}}else{hiddenValue.value="";visibleValue.value=""}}}return true}function mouseOverSelectBox(){isSelectingField=true;return true}function mouseOutSelectBox(){isSelectingField=false;return true}function mouseOverSelectBoxField(a){a.className="autoSelectRowOn";a.style.color="#FFFFFF";return true}function mouseOutSelectBoxField(a){a.className="autoSelectRowOff";a.style.color="#222222";return true}function selectSelectBox(b,a,c){if(highlightText(b,0,b.value.length)){return popupSelectBox(b,a,c)}else{return false}}function toggleChecked(a,b){checkBoxElm=document.getElementById(b);if(checkBoxElm.checked){a.className="multiRowUnchecked";checkBoxElm.checked=false}else{a.className="multiRowChecked";checkBoxElm.checked=true}return true}var fontweight;var bfontColor;function createSelectBox(a){var b;if(a.bold==0){fontweight="font-weight:normal;"}else{fontweight=""}if(a.bfontcolor!=""){bfontColor="color:"+a.bfontcolor}else{bfontColor=""}if(a.lightv!=""){bgpdimg=((a.lightv=="#316AC5"||a.lightv=="blue")?";background: url(/skins/common/images/select/pulldownarrow_blue_light.gif);background-repeat":";background: url(/skins/common/images/select/pulldownarrow_pink_light.gif);")+";no-repeat;background-position:right;"}else{bgpdimg=""}if(a.bordercolor!=""){bborderColor=";border:1px solid "+a.bordercolor;bborderColor2=";border-right:0px;";bborderColor3=";border-top:0px;"}else{bborderColor="";bborderColor2="";bborderColor3=""}if(a.paddingleft!=""){bpaddingleft=a.paddingleft}else{bpaddingleft=7}if(a.onselect!=""){ponselect=a.onselect}else{ponselect=""}if(a.selectBoxID==null||a.selectBoxID==""){a.selectBoxID=def_SelectBoxID}if(a.valList==null||a.valList==""){a.valList=def_ValList}if(a.valArr==null||a.valArr==""){a.valArr=parseToArray(a.valList)}if(a.maxwidth==null||a.maxwidth==""){a.maxwidth=def_Maxwidth}if(a.maxchar==null||a.maxchar==""){a.maxchar=def_Maxchar}if(a.maxheight==null||a.maxheight==""){a.maxheight=def_Maxheight}if(a.pathToImages==null||a.pathToImages==""){a.pathToImages=def_PathToImages}try{if(!a.hasOwnProperty("autotrunc")){a.autotrunc=def_AutoTrunc}if(!a.hasOwnProperty("freetype")){a.freetype=def_Freetype}}catch(c){}if(a.defaultName==null||a.defaultName==""){a.defaultName=def_DefaultName}if(a.defaultValue==null||a.defaultValue==""){a.defaultValue=def_DefaultValue}if(a.onSelect==null||a.onSelect==""){a.onSelect=def_OnSelect;ponselect=""}else{}selectBoxDiv=document.getElementById(a.selectBoxID);b="<input  autocomplete='off'  type='text' class='autoSelectTextBox' id='v"+a.selectBoxID+"' maxlength='"+a.maxchar+"'  style='"+fontweight+bfontColor+";padding-left:"+bpaddingleft+"px;"+bborderColor+bborderColor2+"'  value='"+a.defaultName+"' ";b=b+' pevent="'+ponselect+'" onclick=\'if(document.getElementById("p'+a.selectBoxID+'").style.display!="block"){return selectSelectBox(this, event, '+a.name+");}else{hideSelectBox("+a.name+",event);this.blur()}' onfocus='' onKeyPress='return false' onblur='return hideSelectBox("+a.name+",event);' onKeyUp='return checkForEmpty(this, event, "+a.name+");' />";b=b+"<img "+(clientIE?"onmousedown":"onclick")+"='var thisTextBox=document.getElementById(\"v"+a.selectBoxID+'");return selectSelectBox(thisTextBox, event, '+a.name+");' src='"+a.pathToImages+"clear.gif' class='autoSelectDropImage' style='"+bborderColor+bgpdimg+"; "+(clientIE7?"margin-top: 1px;":"margin-top: 0px;")+"' onclick='' />&nbsp;&nbsp;&nbsp;";b=b+"<br /><div class='autoSelectDiv scrollbars' style='"+(a.scrolling?"overflow:auto":"")+";"+fontweight+bfontColor+bborderColor+bborderColor3+"' id='p"+a.selectBoxID+"'   onMouseOver='return mouseOverSelectBox();' onMouseOut='return mouseOutSelectBox();' onblur='return hideSelectBox("+a.name+",event);'></div>";b=b+"<input type='hidden' value='"+a.defaultValue+"' name='"+a.selectBoxID+"' id='h"+a.selectBoxID+"' />";selectBoxDiv.innerHTML=b;selectTextBoxDiv=document.getElementById("v"+a.selectBoxID);selectTextBoxDiv.style.width=parseInt(a.maxwidth)+"px";return true}function parseToArray(b){var a=new Array();if(b==null){b=""}a=b.split("|");for(i=0;i<a.length;i++){arr2=new Array();if(a[i].indexOf(";")>0){arr2=a[i].split(";")}else{arr2[0]=a[i];arr2[1]=a[i]}a[i]=arr2}return a}function flattenArray(a){var c="";if(a!=null&&a.length>0){for(var b=0;b<a.length;b++){if((a[b][0]!=null)&&(a[b][0]!="")){c+=a[b][0]+";";if((a[b][1]!=null)&&(a[b][1]!="")){c+=a[b][1]+"|"}else{c+=a[b][0]+"|"}}}}return c};