<script language = "JavaScript">
//carrier list
document.all.selectableIDList.length = 0;
var i;
var GetUsersID;
var GetSelectedUserID="";
for (i=0;i < onecount; i++)
{
document.all.selectableIDList.options[document.all.selectableIDList.length] = new Option (subcat[i][1],subcat[i][0]);
}
function addConfirmer() {
//select carrier
for (i = 0; i < document.all.selectableIDList.options.length; i++) {
if (document.all.selectableIDList.options(i).selected == true) {
j = document.all.selectedIDList.options.length - 1;
for (; j >= 0; j--) {
if (document.all.selectableIDList.item(i).value == document.all.selectedIDList.item(j).value) {
break;
}
}
if (j<0) {
newOpt = new Option(document.all.selectableIDList.item(i).text, document.all.selectableIDList.item(i).value);
document.all.selectedIDList.add(newOpt);
}
}
}
}
function addAll() {
//select all carrier
removeAll();
for (i = 0; i < document.all.selectableIDList.options.length; i++) {
//if (document.all.selectableIDList.options(i).selected == true) {
j = document.all.selectedIDList.options.length - 1;
//if (j<0) {
newOpt = new Option(document.all.selectableIDList.item(i).text, document.all.selectableIDList.item(i).value);
document.all.selectedIDList.add(newOpt);
//}
//}
}
}
function removeConfirmer() {
//Delete selected carrier
myindex = -1;
for (i = document.all.selectedIDList.options.length - 1; i > myindex; i--) {
if (document.all.selectedIDList.options(i).selected == true) {
document.all.selectedIDList.remove(i);
}
}
}
function removeAll() {
//Delete selected carrier
myindex = -1;
for (i = document.all.selectedIDList.options.length - 1; i > myindex; i--) {
//if (document.all.selectedIDList.options(i).selected == true) {
document.all.selectedIDList.remove(i);
//}
}
}
function moveUpDn(direction) {
//Up or Down
myindex = 0;
for (; myindex < document.all.selectedIDList.options.length; myindex++) {
var text = document.all.selectedIDList.options(myindex).text;
if ( text.charAt(0) != '*'){
myindex--;
//if (myform.selectedIDList.options(myindex).value == myform.operatorID.value) {
break;
}
}
if (myindex == document.all.selectedIDList.options.length) {
myindex = -1;
}
index = document.all.selectedIDList.options.length;
count = 0;
for (i = document.all.selectedIDList.options.length - 1; i > myindex; i--) {
if (document.all.selectedIDList.options(i).selected == true) {
count++;
index = i;
}
}
if (count == 1) { // Select One only
if (direction < 0 && index > myindex + 1) { // Up
newOpt = new Option(document.all.selectedIDList.item(index).text, document.all.selectedIDList.item(index).value);
newOpt.selected = true;
document.all.selectedIDList.remove(index);
document.all.selectedIDList.add(newOpt, index + direction);
}
if (direction > 0 && index < document.all.selectedIDList.options.length - 1) { // Down
newOpt = new Option(document.all.selectedIDList.item(index).text, document.all.selectedIDList.item(index).value);
newOpt.selected = true;
document.all.selectedIDList.remove(index);
document.all.selectedIDList.add(newOpt, index + direction);
}
}
}