

//////////////////////////////////////////////////////////////////
// This NavMenu uses the following design patterns:
//
//		Factory:    NavButtonFactory returns a NavButton class for the users's browser
//		Factory:    NavButtonStyleFactory returns a NavButtonStyle class for the users's browser
//		Singleton:  A NavBar is only instantiated once
//		Container?: NavMenus contain NavBars
//		Container?: NavBars  contain NavButtons
//
//////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////
//				NavButton Style Class		           			//
//		Copyright (c) 2001, 2002, Aurigen Inc.					//
//				Date: 05/06/2002								//
//////////////////////////////////////////////////////////////////
function NavButtonStyle(styleID){

	this.name           = styleID? styleID: "stylePop";

	this.persist		= false;
	this.horzOrVert     = "V";
	this.locX           = 0;
	this.locY           = 0;
	this.offsetX        = 0;		// -1 to cause mouseover() before mouseout()
	this.offsetY        = 0;		// -1 to cause mouseover() before mouseout()

	this.btnHeight      = "20px";
	this.btnWidth       = "83px";

	this.visibility     = "visible";

	this.fgColorCold    = "#000080";
	this.fgColorHot     = "#000000";
	this.fgImgHot       = "";					// image/pentArrowHot.gif
	this.fgImgCold      = "";					// image/pentArrowCold.gif
	this.bgColorCold    = "#cccccc";
	this.bgColorHot     = "#eeeeee";
//	this.bgColorColdNN4 = this.bgColorCold;		// allows different background colors for NN4
//	this.bgColorHotNN4  = this.bgColorHot;		// allows different background colors for NN4
	this.bgImgHot       = "";
	this.bgImgCold      = "";

	this.fontFamilyCold = "sans-serif";
	this.fontFamilyHot  = "serif";
	this.fontSizeCold   = "10pt";
	this.fontSizeHot    = "10pt";
	this.fontWeightCold = "normal";			// normal,bold
	this.fontWeightHot  = "bold";			// normal,bold
	this.fontStyleCold  = "normal";			// normal,italic
	this.fontStyleHot   = "italic";			// normal,italic

	this.textAlignCold      = "left";
	this.textAlignHot       = "left";
	this.textDecorationCold = "none";		// none,underline,blink,line-through,overline
	this.textDecorationHot  = "none";	// none,underline,blink,line-through,overline

	this.borderWidthHot  = "1px";
	this.borderWidthCold = "1px";
	this.borderStyleHot  = "solid";	// solid, outset, none, ridge
	this.borderStyleCold = "solid";
	this.borderColorHot  = "#aaaaaa";
	this.borderColorCold = "#aaaaaa";

	if(document.getElementById && document.all && !window.opera){
		this.cursorHot = "hand";			// IE5+ browsers
	}else{
		this.cursorHot   = "pointer";		// WC3 browsers except IE5+
	}
	this.cursorCold  = "default";
	
//	alert(this);
}

//////////////////////////////////////
//    Copyright (c) 2001
//      All rights reserved.
//         Aurigen Inc.
//   Date: 11/8/2002, 16:17:43
//////////////////////////////////////
NavButtonStyle.prototype.styleRefs = new Array();			NavButtonStyle.prototype.addStyleRef = function(ref){
if(this.isStyleRef(ref)){return false;}else{NavButtonStyle.prototype.styleRefs[NavButtonStyle.prototype.styleRefs.length] = ref;}
return true;
}
NavButtonStyle.prototype.isStyleRef = function(ref){for(var i=0; i<NavButtonStyle.prototype.styleRefs.length; ++i){if(NavButtonStyle.prototype.styleRefs[i] == ref){return true;}
}

return false;}
NavButtonStyle.prototype.styleWrite = function(){var str = '';
if(!this.addStyleRef(this)){return;}	str += '\n<style type="text/css">';str += '\n<!--';str += '\ndiv.' + this.name + '{';
str += '\n  position:absolute;';									str += '\n  height:' + this.btnHeight + ';';str += '\n  width:' + this.btnWidth + ';';str += '\n  font-family:"' + this.fontFamilyCold + '";';	str += '\n  font-size:' + this.fontSizeCold + ';';			str += '\n  border-width:' + this.borderWidthCold + ';';	
str += '\n  border-style:' + this.borderStyleCold + ';';	str += '\n  border-color:' + this.borderColorCold + ';';	str += '\n}';str += '\na.' + this.name + '{';str += '\n  text-decoration:' + this.textDecorationCold + ';';
str += '\n  height:' + this.btnHeight + ';';str += '\n  width:' + this.btnWidth + ';';str += '\n}';str += '\n-->';str += '\n</style>';
document.write(str);}
NavButtonStyle.prototype.toString = function(){
return ("STYLE(" + this.name + ")");}

function NavButtonStyleNN4(styleID){this.base = NavButtonStyle;
this.base(styleID);}
NavButtonStyleNN4.prototype = new NavButtonStyle();		
NavButtonStyleNN4.prototype.styleWrite = function(){var str = '';if(!this.addStyleRef(this)){return;}	str += '\n<style type="text/css">';
str += '\n<!--';str += '\ndiv.' + this.name + '{';str += '\n  position:absolute;';							str += '\n  height:' + this.btnHeight + ';';str += '\n  width:' + this.btnWidth + ';';
str += '\n  font-family:"' + this.fontFamilyCold + '";';str += '\n  font-size:' + this.fontSizeCold + ';';str += '\n  clip:rect(\'';str += 			'0' + ',';str += 			this.btnWidth + ',';str += 			this.btnHeight + ',';
str += 			'0';str += 			'\');';str += '\n  text-align:' + this.textAlignCold + ';';str += '\n  visibility:' + this.visibility + ';';str += '\n}';
str += '\na.' + this.name + '{';str += '\n  color:' + this.fgColorCold + ';';str += '\n  text-decoration:none;';str += '\n}';
str += '\n-->';str += '\n</style>';document.write(str);}


function NavButtonStyleFactory(styleID){this.styleID = styleID;}
NavButtonStyleFactory.prototype.getRef = function(){
if(document.getElementById) {return    new NavButtonStyle(this.styleID);} else if(document.all) {return    new NavButtonStyle(this.styleID);} else if(document.layers) {
return new NavButtonStyleNN4(this.styleID);} else {return    new NavButtonStyle(this.styleID);}
}

NavButtonStyleFactory.prototype.toString = function(){return ("BTNSTYLEFAC(" + this.title + ")");}

msgBrowserHeightIdentified = false;	msgBrowserWidthIdentified  = false;	



function NavMenu(locX, locY, styleID){
this.barRefs = new Array();this.menuNum = NavMenu.prototype.menuNums.length;NavMenu.prototype.menuNums[this.menuNum] = this.menuNum;this.name    = "men" + this.menuNum;
this.styleRef  = new NavButtonStyle(styleID? styleID: "style0");this.locX = locX? locX: this.locX = this.styleRef.locX;this.locY = locY? locY: this.locY = this.styleRef.locY;}

NavMenu.prototype.menuNums = new Array();	NavMenu.prototype.addButton = function(barName, title, target, parentBarNum, parentBtnNum, pStyleRef, pHorzOrVert, pPersist){var styleRef   = pStyleRef? pStyleRef: styleDefault;var parentBtn     = this.getRef(parentBarNum, parentBtnNum);
var horzOrVert = (pHorzOrVert != null)? pHorzOrVert: styleRef.horzOrVert;var persist    = pPersist? pPersist: null;var barRef    = NavBar.prototype.addBar(this, barName, parentBtn, horzOrVert, styleRef, persist);var btnFacRef = new NavButtonFactory(this, barRef, parentBtn, title, target);var btnRef    = btnFacRef.getRef();
return btnRef;}

NavMenu.prototype.getRef = function(barNum, btnNum){var btn = null;if(barNum == null){btn = null;}else if(btnNum == null){
btn = this.getRefBtn(barNum);}else{btn = this.getRefBarBtn(barNum, btnNum);}
return btn;}

NavMenu.prototype.getRefBarBtn = function(barNum, btnNum){var btn = null;if(barNum != null && btnNum != null){if(barNum<this.barRefs.length && btnNum<this.barRefs[barNum].btnRefs.length)btn = this.barRefs[barNum].btnRefs[btnNum];
}
return btn;}
NavMenu.prototype.getRefBtn = function(btnNum){
var btn      = null;var btnCount = 0;var i = 0;var j = 0;if(btnNum != null){
while(i<this.barRefs.length){while(j<this.barRefs[i].btnRefs.length){if(btnCount>=btnNum) break;++j;++btnCount;
}
if(btnCount>=btnNum) break;j = 0;++i;}

btn = this.barRefs[i].btnRefs[j];}
return btn;}

NavMenu.prototype.styleWrite = function(){for(var i=0; i<this.barRefs.length; ++i){this.barRefs[i].styleWrite();}
}

NavMenu.prototype.bodyWrite = function(){for(var i=0; i<this.barRefs.length; ++i){this.barRefs[i].bodyWrite();}
}

NavMenu.prototype.toString = function(){return ("MENU(" + this.menuNum + ")");}

function NavBar(menuRef, barName, parentBtn, horzOrVert, styleRef, persist){
this.btnRefs    = new Array();this.menuRef    = menuRef;this.menuRef.barRefs[this.menuRef.barRefs.length] = this;this.name       = "bar" + barName;this.parentBtn  = parentBtn;this.horzOrVert = horzOrVert;
this.persist    = persist? persist: (this.name == "bar0"? true: false);this.styleRef   = styleRef;this.locX       = menuRef.locX;this.locY       = menuRef.locY;}

NavBar.prototype.addButton = function(thsBtn){this.btnRefs[this.btnRefs.length] = thsBtn;}
NavBar.prototype.getBar = function(menuRef, barNum){var barName = "bar" + barNum;
for(var i=0; i<menuRef.barRefs.length; ++i){if(menuRef.barRefs[i].name == barName){return menuRef.barRefs[i];}
}
return null;
}
NavBar.prototype.addBar = function(menuRef, barNum, parentBtn, horzOrVert, persist, styleRef){var barRef = NavBar.prototype.getBar(menuRef, barNum);if(barRef == null){barRef = new NavBar(menuRef, barNum, parentBtn, horzOrVert, persist, styleRef);
}
return barRef;}
NavBar.prototype.styleWrite = function(){for(var i=0; i<this.btnRefs.length; ++i){
this.btnRefs[i].styleWrite();}
}
NavBar.prototype.bodyWrite = function(){for(var i=0; i<this.btnRefs.length; ++i){
this.btnRefs[i].bodyWrite();}
}
NavBar.prototype.show = function(){for(var i=0; i<this.btnRefs.length; ++i){
this.btnRefs[i].show();}
}
NavBar.prototype.hide = function(){for(var i=0; i<this.btnRefs.length; ++i){
this.btnRefs[i].hide();}
}
NavBar.prototype.toString = function(){return ("BAR(" + this.name + ")");
}

function NavButtonFactory(menuRef, barRef, parentBtn, title, target){this.menuRef    = menuRef;this.barRef     = barRef;this.parentBtn  = parentBtn;
this.title      = title;this.target     = target;this.styleRef   = barRef.styleRef;}
NavButtonFactory.prototype.getRef = function(){
if(document.getElementById) {return new NavButton(this.menuRef, this.barRef, this.parentBtn, this.title, this.target, this.styleRef);} else if(document.all) {return new NavButton(this.menuRef, this.barRef, this.parentBtn, this.title, this.target, this.styleRef);} else if(document.layers) {
return new NavButtonNN4(this.menuRef, this.barRef, this.parentBtn, this.title, this.target, this.styleRef);} else {return new NavButton(this.menuRef, this.barRef, this.parentBtn, this.title, this.target, this.styleRef);}
}

NavButtonFactory.prototype.toString = function(){return ("BTNFAC(" + this.title + ")");}

function NavButton(menuRef, barRef, parentBtn, title, target, styleRef){
if(title == null){return;}			this.menuRef   = menuRef;this.barRef    = barRef;this.parentBtn = parentBtn;this.btnNum    = barRef.btnRefs.length;
this.name      = menuRef.name + "_" + barRef.name + "_btn" + this.btnNum;this.ancName   = menuRef.name + "_" + barRef.name + "_anc" + this.btnNum;this.imgName   = menuRef.name + "_" + barRef.name + "_img" + this.btnNum;this.title     = title;this.target    = target;
this.locX      = barRef.locX;this.locY      = barRef.locY;this.styleRef  = styleRef;this.fgImgHot  = this.styleRef.fgImgHot;this.fgImgCold = this.styleRef.fgImgCold;this.bgImgHot  = this.styleRef.bgImgHot;
this.bgImgCold = this.styleRef.bgImgCold;this.bgColorHot  = this.styleRef.bgColorHot;this.bgColorCold = this.styleRef.bgColorCold;this.childBar = null;	this.locBtn   = null;
this.btnRef   = 0;this.btnStyle = 0;this.ancRef   = 0;this.ancStyle = 0;this.imgRef   = 0;

if(barRef.btnRefs.length > 0){this.locBtn = barRef.btnRefs[barRef.btnRefs.length-1];	}else if(this.parentBtn){
this.locBtn           = this.parentBtn;	this.parentBtn.childBar = this.barRef;	}else{this.locBtn = null;}

this.barRef.addButton(this);}
NavButton.prototype.styleWrite = function(){
this.styleRef.styleWrite();}
NavButton.prototype.bodyWrite = function(){var str = '';
status = "Wait: write button.";str += '\n <div id="' + this.name + '"';str += ' class="' + this.styleRef.name + '">';str += 		'\n <a href="' + this.target + '" id="' + this.ancName + '"';str += 			' class="' + this.styleRef.name + '">';
if(this.fgImgCold != ""){str += 			'\n<img src=' + '"' + this.fgImgCold + '"' + '" id="' + this.imgName + '" name="' + this.imgName + '"' + ' border="0">';}
str += 			this.title;str += 		'</a>';str += '</div>';
document.write(str);this.setControls();this.abut();this.setCold();
status = "Done: write button";}
NavButton.prototype.setControls = function(){this.btnRef   = document.getElementById(this.name);
this.btnStyle = this.btnRef.style;this.ancRef   = eval(document.getElementById(this.ancName));this.ancStyle = this.ancRef.style;this.imgRef   = eval(document.getElementById(this.imgName));this.btnRef.that        = this;this.btnRef.onmouseover = this.setHotExt;
this.btnRef.onmouseout  = this.setColdExt;this.btnRef.onclick     = this.onclickExt;this.loadImages();}
NavButton.prototype.getHeight = function(){
var hght;if( this.btnRef.offsetHeight ) {								hght = this.btnRef.offsetHeight;} else if( this.btnRef.clientHeight ) {									hght = this.btnRef.clientHeight;
} else {hght = 0;if (!msgBrowserHeightIdentified){msgBrowserHeightIdentified = true; alert("Alert, WC3 Browser.\nSorry, some features on our web site are not available for your browser.\n\nWe were unable to detect the height property of some objects.\n\nElse conditon height: " + hght);}
}

return hght;}
NavButton.prototype.getWidth = function(){var wdth;if( this.btnRef.clientWidth ) {					
wdth = this.btnRef.clientWidth;} else if( this.btnRef.offsetWidth ) {			wdth = this.btnRef.offsetWidth;} else {
wdth = 0;if (!msgBrowserWidthIdentified){msgBrowserWidthIdentified = true; alert("Alert, WC3 Browser.\nSorry, some features on our web site are not available for your browser.\n\nWe were unable to detect the width property of some objects.\n\nElse conditon width: " + wdth);}
}
return wdth;}

NavButton.prototype.moveTo = function(x, y){this.locX = x;this.locY = y;this.btnStyle.left      = x + "px";		this.btnStyle.top       = y + "px";		
this.btnStyle.pixelLeft = x;			this.btnStyle.pixelTop  = y;			return true;}
NavButton.prototype.abut = function(refBtn){
var locBtn = null;if(refBtn){locBtn = refBtn;}else{locBtn = this.locBtn;
}
if(this.barRef.horzOrVert == "H"){this.abutRight(locBtn);}else if(this.barRef.horzOrVert == "V" && this.barRef.parentBtn.barRef.horzOrVert == "V" && this.btnNum == 0){this.abutRight(locBtn);
}else if(this.barRef.horzOrVert == "V"){this.abutBottom(locBtn);}else{this.abutBottom(locBtn);}
}

NavButton.prototype.abutBottom = function(locBtn){if(locBtn){this.locX = locBtn.locX;this.locY = locBtn.locY + locBtn.getHeight() + this.styleRef.offsetY;}
this.moveTo(this.locX, this.locY);
}
NavButton.prototype.abutRight = function(locBtn){if(locBtn){this.locY = locBtn.locY;this.locX = locBtn.locX + locBtn.getWidth() + this.styleRef.offsetX;
}
this.moveTo(this.locX, this.locY);}
NavButton.prototype.abutTop = function(locBtn){}

NavButton.prototype.abutLeft = function(locBtn){}
NavButton.prototype.setHotExt = function(){this.that.setHot();
}
NavButton.prototype.setHot = function(){this.barRef.show();
if(this.childBar){this.childBar.show();}
if(this.barRef.parentBtn){this.barRef.parentBtn.barRef.show();}
this.btnStyle.backgroundColor = this.bgColorHot;this.btnStyle.color           = this.styleRef.fgColorHot;
this.btnStyle.fontFamily      = this.styleRef.fontFamilyHot;this.btnStyle.fontSize        = this.styleRef.fontSizeHot;this.btnStyle.fontWeight      = this.styleRef.fontWeightHot;this.btnStyle.fontStyle       = this.styleRef.fontStyleHot;this.btnStyle.textAlign       = this.styleRef.textAlignHot;this.btnStyle.textDecoration  = this.styleRef.textDecorationHot;
this.btnStyle.borderWidth     = this.styleRef.borderWidthHot;this.btnStyle.borderColor     = this.styleRef.borderColorHot;this.btnStyle.borderStyle     = this.styleRef.borderStyleHot;this.btnStyle.cursor          = this.styleRef.cursorHot;
this.ancStyle.color = this.styleRef.fgColorHot;if(this.fgImgHot != ""){this.imgRef.src = this.fgImgHot}
this.btnStyle.backgroundImage = 'url("' + this.bgImgHot + '")';
return true;}
NavButton.prototype.setColdExt = function(){
this.that.setCold();}
NavButton.prototype.setCold = function(){
if(!this.barRef.persist){this.barRef.hide();}
if(this.childBar && !this.childBar.persist){this.childBar.hide();}
if(this.barRef.parentBtn && !this.barRef.parentBtn.barRef.persist){this.barRef.parentBtn.barRef.hide();}
this.btnStyle.backgroundColor = this.bgColorCold;
this.btnStyle.color           = this.styleRef.fgColorCold;this.btnStyle.fontFamily      = this.styleRef.fontFamilyCold;this.btnStyle.fontSize        = this.styleRef.fontSizeCold;this.btnStyle.fontWeight      = this.styleRef.fontWeightCold;this.btnStyle.fontStyle       = this.styleRef.fontStyleCold;this.btnStyle.textAlign       = this.styleRef.textAlignCold;
this.btnStyle.textDecoration  = this.styleRef.textDecorationCold;this.btnStyle.borderWidth     = this.styleRef.borderWidthCold;this.btnStyle.borderColor     = this.styleRef.borderColorCold;this.btnStyle.borderStyle     = this.styleRef.borderStyleCold;this.btnStyle.cursor = this.styleRef.cursorCold;
this.ancStyle.color  = this.styleRef.fgColorCold;if(this.fgImgCold != ""){this.imgRef.src = this.fgImgCold}
this.btnStyle.backgroundImage = 'url("' + this.bgImgCold + '")';
return true;}
NavButton.prototype.show = function(){this.btnStyle.visibility = "visible";}

NavButton.prototype.hide = function(){this.btnStyle.visibility = "hidden";}
NavButton.prototype.onclickExt = function(){
window.location = this.that.target;return false;}
NavButton.prototype.loadImages = function(){this.loadImage(this.fgImgHot);
this.loadImage(this.fgImgCold);return;}
NavButton.prototype.loadImage = function(imgPathName){if(imgPathName != ""){
var img = new Image();img.src = imgPathName;}
return imgPathName;}

NavButton.prototype.toString = function(){return ("BTN(" + this.name + ")");}

function NavButtonNN4(menuRef, barRef, parentBtn, title, target, styleRef){this.base = NavButton;
this.base(menuRef, barRef, parentBtn, title, target, styleRef);}

NavButtonNN4.prototype = new NavButton();		NavButtonNN4.prototype.setControls = function(){this.btnRef = eval("window.document." + this.name);this.ancRef = eval("window.document." + this.ancName);this.imgRef = eval("window.document." + this.imgName);
this.btnRef.that = this;this.btnRef.onmouseover = this.setHotExt;this.btnRef.onmouseout  = this.setColdExt;
this.btnRef.onclick     = this.onclickExt;}
NavButtonNN4.prototype.getHeight = function(){var hght;if(this.btnRef.clip && this.btnRef.clip.height ) {			
hght = this.btnRef.clip.height;} else {hght = 0;if (!msgBrowserHeightIdentified){msgBrowserHeightIdentified = true;	alert("Alert, WC3 Browser.\nSorry, some features on our web site are not available for your browser.\n\nWe were unable to detect the height property of some objects.\n\nElse conditon height: " + hght);}
}

return hght;}
NavButtonNN4.prototype.getWidth = function(){var wdth;
if(this.btnRef.clip && this.btnRef.clip.width ) {			wdth = this.btnRef.clip.width;} else {wdth = 0;if (!msgBrowserWidthIdentified){msgBrowserWidthIdentified = true;	alert("Alert, WC3 Browser.\nSorry, some features on our web site are not available for your browser.\n\nWe were unable to detect the width property of some objects.\n\nElse conditon width: " + wdth);}

}
return wdth;}
NavButtonNN4.prototype.moveTo = function(x, y){
this.btnRef.moveTo(x, y);return true;}
NavButtonNN4.prototype.setHotExt = function(){this.that.setHot();		
return false;}
NavButtonNN4.prototype.setHot = function(){
this.barRef.show();if(this.childBar){this.childBar.show();}
if(this.barRef.parentBtn){this.barRef.parentBtn.barRef.show();}
if(this.fgImgHot != ""){this.imgRef.src = this.fgImgHot}

this.btnRef.bgColor = (this.bgColorHot != ""? this.bgColorHot: null);this.btnRef.background.src = this.bgImgHot;return true;}

NavButtonNN4.prototype.setColdExt = function(){this.that.setCold();		return false;}
NavButtonNN4.prototype.setCold = function(){
if(!this.barRef.persist){this.barRef.hide();}
if(this.childBar && !this.childBar.persist){this.childBar.hide();}
if(this.barRef.parentBtn && !this.barRef.parentBtn.barRef.persist){this.barRef.parentBtn.barRef.hide();}

if(this.fgImgCold != ""){this.imgRef.src = this.fgImgCold;}
this.btnRef.bgColor = (this.bgColorCold != "")? this.bgColorCold: null;this.btnRef.background.src = this.bgImgCold;return true;
}
NavButtonNN4.prototype.show = function(){this.btnRef.visibility = "show";}

NavButtonNN4.prototype.hide = function(){this.btnRef.visibility = "hide";}


function Timekeep(){this.strSuffix = "\n ";this.list = new Array();}
Timekeep.prototype.start = function(title){
this.list[title] = new Stopwatch(title);}
Timekeep.prototype.stop = function(title){this.list[title].stop();}

Timekeep.prototype.toString = function(){var str = "";for(var title in this.list){str += this.list[title].toString() + this.strSuffix;}

return str;}
function Stopwatch(title){this.title = title;
this.start();this.end = this.beg;}
Stopwatch.prototype.start = function(){this.beg = (new Date()).getTime();
}
Stopwatch.prototype.stop = function(){this.end = (new Date()).getTime();}

Stopwatch.prototype.toString = function(){return (this.title + "(ms)" + " = " + (this.end - this.beg));}

