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