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