function switchListOpts(g,e,c,d){var a,i,h,b,f;for(a=0;a<g.length;a++){b=g.options[a];if(d){h=(d==b.value)}else{h=((c)?b.selected:true)}if(h){i=a;f=true;for(nidx=0;nidx<e.length;nidx++){if(e.options[nidx].value==b.value){f=false;break}}if(f){e.options[e.length]=new Option(b.text,b.value)}g.options[a]=null;a--}}if(d){if(g.options[i]!=null){g.options[i].selected=true}else{if(length>0&&g.options[length-1]!=null){g.options[length-1].selected=true}}}}function moveListOpts(g,a){var e,c,b,d,f;switch(a){case 1:case 2:b=((1==a)?-1:1);for(c=1;c<g.options.length;c++){e=((1==a)?c:(g.options.length-c-1));if(g.options[e].selected){if(!g.options[e+b].selected){f=((b>0)?g.options[e]:g.options[e].nextSibling);g.insertBefore(g.options[e+b],f)}}}break;case 3:d=g.options.length;c=0;e=d;while(c<d){c++;e--;if(g.options[e].selected){g.insertBefore(g.options[e],g.options[0]);e++}}break;case 4:d=g.options.length;c=0;e=-1;while(c<d){c++;e++;if(g.options[e].selected){g.appendChild(g.options[e]);e--}}break;default:break}}function makeCSV(b,a,d){var c;if(a==null){return}c="";if(b.length>0){c=b.options[0].value;for(nidx=1;nidx<b.length;nidx++){c+=d+b.options[nidx].value}}a.value=c}function initOpts(b,d,a,f){var e,c;if(a!=null){e=a.split(f);for(c=0;c<e.length;c++){switchListOpts(b,d,true,e[c])}}};