var indexOfBar = new Array();
var numBar = 0;
var displayit = null;
var titleColor = '#E2F0FC';
var menuColor = '#FFFFFF';
var mouseColor = '#F2F7FB';

function turnit(it)
{
 if (it == null) return false;

 if (it.style.display=="none")
  {
		if (displayit != null) {
    	displayit.style.display="none";
		}
   	it.style.display="";
   }
 else
  {
    it.style.display="none";
  }

 it.style.cursor = "hand";
 displayit = it;
}

function addbar(code, name, icon, href) {
  return new bar(code, name, icon, href);
}

function bar(code, name, icon, href) {
  indexOfBar[numBar] = this;
	this.code = code;
	this.name = name;
  this.icon = icon;
  this.href = href;
  this.index = numBar++;
  this.children = new Array();
  this.nChildren = 0;
}


var indexOfBar = new Array();
var numBar = 0;
var displayit = null;

function addbutton(parent, code, name, href) {
  parent.children[parent.nChildren++] = new button(code, name, href, "");
}

function addbutton(parent, code, name, href, target) {
  parent.children[parent.nChildren++] = new button(code, name, href, target);
}

function button(code, name, href, target) {
  this.code = code;
  this.name = name;
  this.href = href;
  this.target = target;
}

function initializeBar() {
  var i = 0;
  with (document) {
    for (i = 0; i < numBar; i++) {
      write("<TABLE cellSpacing=0 cellPadding=0 width='100%' border=0 bgColor=" + titleColor + ">" +
	          "  <TR>" +
		        "   <TD bgColor=" + menuColor + " colsPan=3 height=1></TD>" +
            "  </TR>" +
	          "   <TR>" +
		        "     <TD colsPan=3 height=3></TD>" +
            "   </TR>"  +
            "   <TR height=20>" +
  	        "     <TD width=1 bgColor=" + titleColor + "></TD>"  +
  	        "     <TD align=right width=16 valign='middle'>&nbsp;<IMG src='" + imgdot + "' border='0'></TD>"  +
  	        "     <TD align=left  valign='middle' class=bodyTitleNoBack>&nbsp;&nbsp;<a href=javascript:turnit(" + indexOfBar[i].code + ") class=menuTitle>" + indexOfBar[i].name + "</a></TD>"  +
            " 	</TR>"  +
            "</TABLE>"  +
            "<DIV id='" + indexOfBar[i].code +"' style='display=none'>" +
            "<TABLE cellSpacing=0 cellPadding=0 width=100% border=0 bgColor=" + titleColor + ">" +
	          "   <TR>" +
		        "     <TD colsPan=3 height=1></TD>" +
            "   </TR>"  +
	          "   <TR height='1' bgColor=" + menuColor + ">" +
		        "     <TD colsPan=3 ></TD>" +
	          "   </TR>"  +
            "</TABLE>"  +
            "<TABLE cellSpacing=0 cellPadding=0 width='100%' border=0 bgColor=" + menuColor + ">" +
            "   <TR height=20 valign=middle onmouseover=\"this.style.backgroundColor='" + mouseColor + "'\" onmouseout=\"this.style.backgroundColor='" + menuColor + "'\">" +
  	        "     <TD align=left valign='middle' width='32'>&nbsp;<IMG src='" + indexOfBar[i].icon +"' border='0'></TD>" +
  	        "     <TD align=left valign='middle' width='*'  class=bodyTitleNoBack>" + 
		        "       <A class=bodyText href='" + indexOfBar[i].href + "'><FONT id=lf_1 class=menuSubTitle>" + indexOfBar[i].name + "</FONT></A>" +
	          "     </TD>"  +
	          "   </TR>"  +
            "</TABLE>"
            );

      for (j=0; j < indexOfBar[i].nChildren; j++) {
        write("<TABLE cellSpacing=0 cellPadding=0 width='100%' border=0 bgColor=" + menuColor + ">" +
              "   <TR onmouseover=\"this.style.backgroundColor='" + mouseColor + "'\" onmouseout=\"this.style.backgroundColor='" + menuColor + "'\">" +
		          "     <TD width='14' bgColor=" + menuColor + "></TD>" +
              "     <TD width='1' background=" + imgvdl + "></TD>" +
		          "     <TD width=30><IMG id=li_1 src='" + imghdl + "' align=absMiddle></TD>" +
		          "     <TD vAlign=bottom height=18>" +
			        "       <A class=menuContent href='" + indexOfBar[i].children[j].href + "' target= " + indexOfBar[i].children[j].target + "><FONT id=lf_1 class=menuContent>" + indexOfBar[i].children[j].name + "</FONT></A>" +
		          "     </TD>"  +
	            "   </TR>"  +
              " </TABLE>"
        );
      }

      write("<TABLE cellSpacing=0 cellPadding=0 width='100%' border=0>" +
	          "   <TR height='4' bgColor=" + menuColor + ">"  +
		        "     <TD></TD>"  +
	          "   </TR>"  +
            "</TABLE>"  +
            "</DIV>"
            );
    }
    write("<TABLE cellSpacing=0 cellPadding=0 width=100% border=0 bgColor=" + titleColor + ">" +
	        "   <TR>" +
		      "     <TD bgColor=" + titleColor + " colsPan=3 height=1></TD>" +
          "   </TR>"  +
          "</TABLE>"  +
          "<TABLE cellSpacing=0 cellPadding=0 width=100% height=* border=0>"  +
          "</TABLE>"
          );
  }
}

function addLinkedBar(img, href, name) {
      document.write("<TABLE cellSpacing=0 cellPadding=0 width='100%' border=0 bgColor=" + titleColor + ">" +
	          "  <TR>" +
		        "   <TD bgColor=" + menuColor + " colsPan=3 height=1></TD>" +
            "  </TR>" +
	          "   <TR>" +
		        "     <TD colsPan=3 height=3></TD>" +
            "   </TR>"  +
            "   <TR height=20>" +
  	        "     <TD width=1 bgColor=" + titleColor + "></TD>"  +
  	        "     <TD align=right width=16 valign='middle'>&nbsp;<IMG src='" + img + "' border='0'></TD>"  +
  	        "     <TD align=left  valign='middle' class=body_text>&nbsp;&nbsp;<a href=" + href + " class=menuTitle>" + name + "</a></TD>"  +
            " 	</TR>"  +
            "</TABLE>");
}


