var ns6=document.getElementById&&!document.all
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1

function FoldingList(label,body,action,status)
{ // Constructor for FoldingLists
   this.label=label;
   this.body=body;
   this.action=action;
   this.status=status;
   this.contents=new Array();
}

new FoldingList();

FoldingList.prototype.additem = AddListItem;
FoldingList.prototype.print = PrintFoldingList;
FoldingList.prototype.toggle =ToggleStatus;
//FoldingList.prototype.initialize = InitializeFoldingList;
//FoldingList.prototype.makebutton = MakeButton;

function AddListItem(parent,label,body){
   if (this.label==parent){
       var max=this.contents.length;
       this.contents[max]=new FoldingList(label,body,'',1);

   }else{
       var i;
       for (i=0; i<this.contents.length; i++)
          this.contents[i].additem(parent,label,body);
   }
}

function ToggleStatus(target){
   if (this.label==target){
       this.status=1-this.status;
   }else{
       var i;
       for (i=0; i<this.contents.length; i++)
          this.contents[i].toggle(target);
   }

}

function PrintFoldingList(level) {
 var i;
 var el;
    if (arguments.length==0)
      level=0;
    document.write('<table border="0" width="100%" CELLPADDING=0 CELLSPACING=0 STYLE="text-align:left;"><tr>');
    document.write('<td align="right" valign="top" width='+(level*17+5)+'>');
    if (this.contents.length>0)
       document.write(MakeButton(this.label));
    else
        document.write(MakeBlank());

    document.write('</B></td>\n<td>');    
    document.write(this.body + '</td>\n</tr></table>\n');

    if (this.contents.length>0){
      document.write("<div style='display:none' id='ITEM_"+this.label+"'>");
      for (i=0; i<this.contents.length; i++)
        this.contents[i].print(level+1);   
      document.write("</div>");
    } 

}

var oldItem = -1;

function ToggleFoldingListInt(num) { 
ToggleFoldingList (num.toString());
}

function ToggleFoldingList(sItem) { 


	var oButton = document.getElementById("BTN_"+sItem);
	var oItem = document.getElementById("ITEM_"+sItem);

	if ((oItem.style.display == "") || (oItem.style.display == "none")) {
		oItem.style.display = "block";
		oButton.src = eval("minus.src");

		if (oldItem != -1 && oldItem!=sItem) {
	        oButton = document.getElementById("BTN_"+oldItem);
	        oItem = document.getElementById("ITEM_"+oldItem);
		  oItem.style.display = "none";
		  oButton.src = eval("plus.src");
            }
            oldItem = sItem;

	} else {
		oItem.style.display = "none";
		oButton.src = eval("plus.src");
	}

	return false;
}



function MakeButton(sItem){
        button="<img src='images/blank.png' align='center' height='9' width='9'";
 	button=button+"border=0 id='BTN_"+sItem;

      if (ie4){
        button=button+"' vspace=3 style='cursor:hand;' onclick="+'"';}
      else {
	  button=button+"' vspace=3 style='cursor:pointer;' onclick="+'"';}

	button=button+"return ToggleFoldingList('";
	button=button+sItem+"');"+'"'+">";

        return button;
}
function MakeBlank(){
	return "<img src='images/blank.png' height='9' width='9'>";
}
function InitializeFoldingList(){
        
	plus = new Image();
	plus.src = "images/blank.png";

	minus = new Image();
	minus.src = "images/blank.png";
}
InitializeFoldingList();

