function ReceiveServerData(i,a){a.innerHTML="";var f=i.split("||");AddSelectAll(a);var c=document.createElement("option");c.value=" ";c.innerHTML=" ";a.appendChild(c);for(var d=0;d<f.length-1;++d){var e=f[d].split("|"),h=e[0],g=e[1],b=document.createElement("option");b.value=g;b.innerHTML=h;a.appendChild(b)}}function AddSelectAll(b){if(b.size<1){var a=document.createElement("option");a.value="";a.innerHTML="";b.appendChild(a)}}function additem(d,e,c,f){var b=document.getElementById(d),a=document.getElementById(e),g=document.getElementById(c);if(b.selectedIndex>0){move(b,a);removeitembyname(a,f);SortD(a)}buildHidden(g,a)}function buildHidden(b,c){b.value="";for(var a=0;a<c.length;a++)b.value+=c.options[a].value+","}function buildDropDown(e,d){if(e!=null&&d!=null){removeItems(d);var b=e.value.split(",");b.sort();for(var f=b.length,a=0;a<f;a++){var c=b[a];c!=""&&addItemToTarget(d,c,c)}}}function removeItems(a){if(a!=null&&a.options.length!=null)for(var c=a.options.length,b=c;b>=0;b--)a.options[b]=null}function removeitembyname(a,c){for(var b=0;b<a.length;b++)a.options[b].text==c&&a.remove(b);BumpUp(a)}function addItemToTarget(b,d,c){var a=new Option;a.value=c;a.text=d;b.options[b.length]=a}function additembyname(a,c){if(a!=null&&a.length==0){var b=new Option;b.value="";b.text=c;a.options[a.length]=b}}function removeitem(d,c,e){for(var a=document.getElementById(d),f=document.getElementById(c),b=0;b<a.length;b++)if(a.options[b].selected&&a.options[b].value!=""&&a.length>0){a.options[b]=null;break}BumpUp(a);a.length==0&&additembyname(a,e);buildHidden(f,a)}function move(a,b){if(a!=null&&b!=null)if(a.options.selectedIndex>=0){var c=new Option;c.text=a.options[a.options.selectedIndex].text;c.value=a.options[a.options.selectedIndex].value;for(var f=b.length,e=false,d=0;d<f;d++)if(b.options[d]!=null)if(c.text==b.options[d].text){e=true;break}if(e!=true){b.options[b.length]=c;f++}}}function BumpUp(b){var a=0;while(a<b.length){if(b.options[a].text=="")b.options[a]=null;a++}}function SortD(a){arrTexts=[];for(i=0;i<a.length;i++)arrTexts[i]=a.options[i].text;arrTexts.sort();for(i=0;i<a.length;i++){a.options[i].text=arrTexts[i];a.options[i].value=arrTexts[i]}}
