function Folder(folderDescription, hreference,parentid,target) {
//constant data;
this.desc = folderDescription;
this.parentid=parentid;
this.hreference = hreference;
this.target=target;
this.id = index;
this.navObj = 0;
this.iconImg = 0;
this.nodeImg = 0;
this.isLastNode = 0;
// dynamic data
this.isRoot = true;
this.isOpen = true;
this.iconSrc=imageURL+"ftv2folderopen.gif";
this.iconRoot =imageURL+"ftv2folderopen.gif";
this.children = new Array;
this.nChildren = 0;
// methods
this.initialize = initializeFolder;
this.setState = setStateFolder;
this.addChild = addChild;
this.createIndex = createEntryIndex;
this.hide = hideFolder;
this.display = display;
this.renderOb = drawFolder;
this.totalHeight = totalHeight;
this.subEntries = folderSubEntries;
this.outputLink = outputFolderLink;
}
function setStateFolder(isOpen) {
var subEntries;
var totalHeight;
var fIt = 0;
var i = 0;
if(isOpen == this.isOpen)
return;
if(browserVersion == 2) {
totalHeight = 0
for(i = 0; i < this.nChildren; i++)
totalHeight = totalHeight + this.children[i].navObj.clip.height;
subEntries = this.subEntries();
if(this.isOpen)
totalHeight = 0 - totalHeight;
for(fIt = this.id + subEntries + 1; fIt < nEntries; fIt++)
indexOfEntries[fIt].navObj.moveBy(0, totalHeight);
}
this.isOpen = isOpen;
propagateChangesInState(this);
}
function propagateChangesInState(folder) {
var i = 0;
if(folder.isOpen) {
if(folder.nodeImg) {
if(folder.isLastNode)
folder.nodeImg.src = imageURL+"ftv2mlastnode.gif";
else
folder.nodeImg.src = imageURL+"ftv2mnode.gif";
}
if(this.isRoot)
folder.iconImg.src = imageURL+"ftv2_mail.gif";
else
folder.iconImg.src = imageURL+"ftv2folderopen.gif";
for(i = 0; i < folder.nChildren; i++)
folder.children[i].display();
}
else {
if(folder.nodeImg) {
if(folder.isLastNode)
folder.nodeImg.src = imageURL+"ftv2plastnode.gif";
else
folder.nodeImg.src = imageURL+"ftv2pnode.gif";
}
if(this.isRoot)
folder.iconImg.src = imageURL+"ftv2_mail.gif";
else
folder.iconImg.src = imageURL+"ftv2folderclosed.gif";
for(i = 0; i < folder.nChildren; i++)
folder.children[i].hide();
}
}
function hideFolder() {
if(browserVersion == 1) {
if(this.navObj.style.display == "none")
return;
this.navObj.style.display = "none";
}
else {
if(this.navObj.visibility == "hiden")
return;
this.navObj.visibility = "hiden";
}
this.setState(0);
}
function initializeFolder(level, lastNode, leftSide) {
var i = 0;
var j = 0;
var numberOfFolders;
var numberOfDocs;
nc = this.nChildren;
this.createIndex();
var nc;
var auxEv = "";
if(browserVersion > 0)
auxEv = "<A HREF='JavaScript: clickOnNode("+this.id+")'>";
else
auxEv = "<A>";
if(level > 0) {
if(lastNode) { //the last 'brother' in the children array
this.renderOb(leftSide + auxEv + "<IMG NAME='nodeIcon" + this.id + "' SRC='"+imageURL+"ftv2mlastnode.gif' WIDTH=16 HEIGHT=22 BORDER=0></A>");
leftSide = leftSide + "<IMG SRC=\'"+imageURL+"ftv2blank.gif\' WIDTH=16 HEIGHT=22>";
this.isLastNode = 1;
}
else {
this.renderOb(leftSide + auxEv + "<IMG NAME='nodeIcon" + this.id + "'SRC=\'"+imageURL+"ftv2mnode.gif\' WIDTH=16 HEIGHT=22 BORDER=0></A>");
leftSide = leftSide + "<IMG SRC=\'"+imageURL+"ftv2vertline.gif\' WIDTH=16 HEIGHT=22>";
this.isLastNode = 0;
}
}
else {
this.renderOb("");
}
if(nc > 0) {
level = level + 1;
for(i = 0; i < this.nChildren; i++) {
if(i == this.nChildren-1)
this.children[i].initialize(level, 1, leftSide);
else
this.children[i].initialize(level, 0, leftSide);
}
}
}
function drawFolder(leftSide) {
if(browserVersion == 2) {
if(!doc.yPos)
doc.yPos = 8;
doc.write("<LAYER ID='folder" + this.id + "' TOP=" + doc.yPos + " VISIBILITY=hiden>");
}
doc.write("<TABLE")
if(browserVersion == 1)
doc.write(" ID='folder" + this.id + "' STYLE='position:block;' ");
doc.write(" BORDER=0 CELLSPACING=0 CELLPADDING=0>");
doc.write("<TR><TD>");
doc.write(leftSide);
this.outputLink();
doc.write("<IMG NAME='folderIcon" + this.id + "' ");
if(leftSide == '') {
doc.write("SRC='" + this.iconRoot+"' BORDER=0></A>");
}
else {
doc.write("SRC='" + this.iconSrc+"' BORDER=0></A>");
}
doc.write("</TD><TD NOWRAP>");
doc.write("<DIV CLASS=\"fldrroot\">");
if(leftSide == '') {
if(USETEXTLINKS) {
this.outputLink();
doc.write('<font size="2" color="'+floderColor+'">'+this.desc + "</font></A>");
}
else
doc.write(this.desc);
}
else {
doc.write("<A HREF='JavaScript: clickOnNode("+this.id+")'>");
doc.write('<font size="2" color="'+floderColor+'">'+this.desc + "</font></A>");
}
doc.write("</DIV>");
doc.write("</TD>");
doc.write("</TABLE>");
if(browserVersion == 2) {
doc.write("</LAYER>");
}
if(browserVersion == 1) {
this.navObj = doc.all["folder"+this.id];
this.iconImg = doc.all["folderIcon"+this.id]
this.nodeImg = doc.all["nodeIcon"+this.id]
}
else if(browserVersion == 2) {
this.navObj = doc.layers["folder"+this.id];
this.iconImg = this.navObj.document.images["folderIcon"+this.id];
this.nodeImg = this.navObj.document.images["nodeIcon"+this.id];
doc.yPos = doc.yPos + this.navObj.clip.height;
}
}