var MNU_COUNT = 3;
var oCrumbs = null;
var oLeftNav = null;

function MenuBar() {
	this.Menus = new Array();
	this.show = menuShow;
	this.hide = menuHide;
	this.init = menuInit;
}
	
function menuInit() {

	this.off = new Layer("menu0");
	for (i=1; i<MNU_COUNT+1; i++) {
		this.Menus[this.Menus.length] = new Layer("menu"+i);
		
	}
}

function menuShow(index) {
	index = index-1;
	if (isReady) {
		for (i=0; i<this.Menus.length; i++) {
			if (i == index) {
				ro.on('nav'+(i+1));
				this.Menus[i].show();
				this.off.show();
			} else {
				ro.off('nav'+(i+1));
				if(this.Menus[i]!=this.Menus[section-1]){
					this.Menus[i].hide();}
			}
		}
	}
}

function menuHide() {
	
	if (isReady) {
		for (i=0; i<this.Menus.length; i++) {
			ro.off('nav'+(i+1));
			if(this.Menus[i]!=this.Menus[section-1]){
			
			this.Menus[i].hide();}
		}
		this.off.hide();
	}
}

function CrumbTrail() {
	this.crumbs = new Array();
	for (i=0; i<arguments.length; i+=2) {
		this.addCrumb(arguments[i], arguments[i+1]);
	}
	this.write = writeCrumbTrail;
}

function addCrumb(sLabel, sURL) {
	this.crumbs[this.crumbs.length] = new Crumb(sLabel, sURL);
}

function Crumb(sLabel, sURL) {
	this.label = sLabel;
	this.URL = sURL;
}

function writeCrumbTrail() {
	document.write('<div id="crumbs"><span class="crumb">');
	for (i=0; i<this.crumbs.length; i++) {
		if (this.crumbs.length-1 != i) {
			document.write('<a href="'+this.crumbs[i].URL+'" class="crumb"><u>'+this.crumbs[i].label+'</u></a> > ');
		} else {
			document.write(this.crumbs[i].label);
		}
	}
	document.write('</span></div>');
}

CrumbTrail.prototype.addCrumb = addCrumb;

/* Left navigation stack */
function NavStack() {
	this.multiline = false;
	this.links = new Array();
	this.addLink = addLink;
	this.write = writeNavStack;
}

function addLink(sLabel, sURL, bCurrent, sTarget) {
	this.links[this.links.length] = new Link(sLabel, sURL, bCurrent, sTarget);
}

function Link(sLabel, sURL, bCurrent, sTarget) {
	this.label = sLabel;
	this.URL = sURL;
	this.current = bCurrent;
	this.target = sTarget;
}

function writeNavStack() {
	document.writeln('<div id="dLeft">');
	document.writeln('<table cellpadding="0" cellspacing="2" border="0" width="145">');
	for (i=0; i<this.links.length; i++) {
		oLink = this.links[i];
		sTarget = (oLink.target)?' target="'+oLink.target+'"':"";
		if (oLink.current) {
			document.writeln('<tr><td><img src="/images/mnu_on.gif" width="5" height="9" alt="" border="0"></td><td width="98%"><a>'+oLink.label+'</a></td></tr>');
		} else {
			document.writeln('<tr><td><img name="lt:lnk_'+i+'" src="/images/mnu.gif" width="5" height="9" alt="" border="0"></td><td width="98%"><a href="'+oLink.URL+'" class="menu" onmouseover="ro.on(\'lt:lnk_'+i+'\')" onmouseout="ro.off(\'lt:lnk_'+i+'\')"'+sTarget+'>'+oLink.label+'</a></td></tr>');
		}
	}
	document.writeln('</table>');		
	document.writeln('</div>');		
}

