home *** CD-ROM | disk | FTP | other *** search
- var ibarOC = window.dialogArguments;
- var fEnableAdd = true;
-
- function fnBuildTable()
- {
- var newHTML = "";
- var iCount = ibarOC.count;
- newHTML = "<SELECT style='width:370px; margin-bottom:5px ' ALIGN=MIDDLE ID='idSelectRemove' onkeydown='fnEnableButton();' onclick='fnEnableButton();' NAME='REMOVE' SIZE=8>";
- fEnableAdd = true;
- if (iCount==0)
- {
- newHTML = newHTML + "<OPTION VALUE='" + i + "'>There is nothing to rearrange.";
- fEnableAdd = false;
- }
- else for (var i=0; i < iCount; i++)
- {
- var itemClsid = ibarOC.item(i);
- newHTML = newHTML + "<OPTION VALUE='" + i + "'>" + itemClsid.title;
- }
- newHTML = newHTML + "</SELECT>";
- idRemove.disabled = true;
- idMoveUp.disabled = true;
- idMoveDown.disabled = true;
- idCurrent.innerHTML = newHTML;
- }
-
- function fnEnableButton()
- {
- var i = idSelectRemove.selectedIndex;
- if (fEnableAdd && i!=-1)
- {
- idMoveUp.disabled = (i==0);
- idMoveDown.disabled = (i==(idSelectRemove.options.length-1));
- idRemove.disabled = false;
- }
- }
-
- function fnMoveUp(x)
- {
- if (idMoveUp.disabled==true)
- return;
-
- var y = x-1;
- if (x>=1)
- {
- var oText = idSelectRemove.options.item(y).innerText;
- idSelectRemove.options.item(y).innerText = idSelectRemove.options.item(x).innerText;
- idSelectRemove.options.item(x).innerText = oText;
- idSelectRemove.selectedIndex = y;
- ibarOC.Reorder(x, y);
- fnEnableButton();
- }
- }
-
- function fnMoveDown(x)
- {
- if (idMoveDown.disabled==true)
- return;
-
- var y = x+1;
- if (y<ibarOC.count)
- {
- var oText = idSelectRemove.options.item(x).innerText;
- idSelectRemove.options.item(x).innerText = idSelectRemove.options.item(y).innerText;
- idSelectRemove.options.item(y).innerText = oText;
- idSelectRemove.selectedIndex = y;
- ibarOC.Reorder(x, y);
- fnEnableButton();
- }
- }
-
- function fnRemove(x)
- {
- if (idRemove.disabled==true)
- return;
-
- idSelectRemove.options.remove(x);
- ibarOC.Remove(x);
-
- if (ibarOC.count==0)
- {
- fnBuildTable();
- }
- else
- {
- idSelectRemove.selectedIndex = (x<ibarOC.count) ? x : x -1
- }
- }
-
-
-