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 = "";
else
auxev = "";
if(level > 0) {
if(lastnode) { //the last 'brother' in the children array
this.renderob(leftside + auxev + "");
leftside = leftside + "";
this.islastnode = 1;
}
else {
this.renderob(leftside + auxev + "");
leftside = leftside + "";
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("");
}
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;
}
}
