  var printList = new Array();
  
  function doSetTimeout(doWhat,delay) {
    setTimeout(doWhat, delay);
  }
  
  function add2List(subFolders) {
    var cTP = belenusHome.getProperty("Tree","CurrentTreePath",null) ;//currentTreePath
    var cL = belenusHome.getQueryField(belenusHome.getProperty("Global","ItemData","Field=Label&ItemPath="+cTP),"Label");//currentLabel
    var alreadyExist = -1;
    for(i in belenusHome.printList) {
      if(belenusHome.printList[i][0] == cTP) alreadyExist = i;
    }
    if(alreadyExist == -1) {
      belenusHome.printList[belenusHome.printList.length] = new Array(
        cTP,
        cL,
        subFolders);
    } else {
      belenusHome.printList[alreadyExist] = new Array(
        cTP,
        cL,
        subFolders);      
    }
  }
  
  function delEntry(index) {
    if(index != -1) {
      var newPrintList = new Array();
      var internalCount = 0;
      for(i in belenusHome.printList) {
        if(i != index) {
          newPrintList[internalCount++] = belenusHome.printList[i];
        }
      }
      belenusHome.printList = newPrintList;
    }
  }
  
  function entryUp(index) {
    if(index > 0) {
      var newPrintList = new Array();
      var entry4Move = belenusHome.printList[index];
      var j = 0;
      for(i in belenusHome.printList) {
        if(i != index) {
          newPrintList[j++] = belenusHome.printList[i];
        }
      }
      var h = 0;
      var tmp = new Array();
      for(var k = 0; k < newPrintList.length; k++) {
        if(k == index-1) {
          tmp[h++] = entry4Move;
        }
        tmp[h++] = newPrintList[k];
      }
      belenusHome.printList = tmp;      
    }
  }
  
  function entryDown(index) {
    if(index != belenusHome.printList.length-1) {
      var newPrintList = new Array();
      var entry4Move = belenusHome.printList[index];
      var j = 0;
      for(i in belenusHome.printList) {
        if(i != index) {
          newPrintList[j++] = belenusHome.printList[i];
        }
      }
      var h = 0;
      var tmp = new Array();
      for(var k = 0; k < newPrintList.length; k++) {
        tmp[h++] = newPrintList[k];
        if(k == index) {
          tmp[h++] = entry4Move;
        }
      }
      belenusHome.printList = tmp;      
    }
  }
  
  function updateSelectBoxView() {
    var lastSelectedEntry = null;
    if(document.getElementById("selectBox").selectedIndex != -1) {
      lastSelectedEntry = document.getElementById("selectBox").options[document.getElementById("selectBox").selectedIndex].value;
    }
    
    document.getElementById("selectBox").options.length = 0;
    for(i in belenusHome.printList) {
      var text = belenusHome.printList[i][1];
      if(belenusHome.printList[i][2] == true) text+=" *";
      document.getElementById("selectBox").options[i] = new Option(text,belenusHome.printList[i][0],false,false);
    }
    
    for(var j = 0; j < document.getElementById("selectBox").length; j++) {
      if(document.getElementById("selectBox").options[j].value == lastSelectedEntry) {
        document.getElementById("selectBox").options[j].selected = true;
      }
    }
  }
  
  function delAllEntries() {
    belenusHome.printList = new Array();
  }
  
  function sendAway() {
    var sendAways = "";
    for(i in belenusHome.printList) {
      sendAways += belenusHome.printList[i][0];
      if(belenusHome.printList[i][2]) sendAways += "/*";
      sendAways += ",";
    }
    if(sendAways.lastIndexOf(",") == sendAways.length-1) sendAways = sendAways.substring(0,sendAways.length-1);
    var theFrame = parent.printJobsHiddenFrame;
    theFrame.document.getElementById("pdf").value = document.getElementById("pdfName").value;
    theFrame.document.getElementById("email").value = document.getElementById("eMail").value;
    theFrame.document.getElementById("treepathes").value = sendAways;
    theFrame.document.getElementById("printServerDataForm").setAttribute("action",belenusHome.printServerURL);
    theFrame.document.getElementById("attach").value = document.getElementById("attach").checked;
    var langs=new Array();
    var formLength = frames['langsFrame'].document.forms[0];
    for(var i = 0; i < formLength.length; i++) {
      if(formLength.elements[i].checked == true) langs[langs.length] = formLength.elements[i].value;
    }
    theFrame.document.getElementById("languages").value = langs.join(",");
    theFrame.document.getElementById("printServerDataForm").submit();
  }
  
  function switchToViewerMode(entry) {
    if(entry != -1) {
      
      var tmp = belenusHome.printList[entry][0];
      belenusHome.eventHandler("TreeSelectionCleared",null);
      belenusHome.printServer = false;
      belenusHome.doSetTimeout("belenusHome.eventHandler('OpenLink','URL=parts:"+tmp+"')",500);
      for(h in belenusHome.header.document.getElementById("ddb").options) { // opts is defined at the header_lib.js.. 
        if(belenusHome.header.document.getElementById("ddb").options[h][1] == "printServer") {
          belenusHome.header.document.getElementById("ddb").options[h].text = belenusHome.ld["selectMenu7on"];
          // ddb is the name of the dropdown box.... also defined in the navigation.js
          break;
        }
      }
    }
  }