var DaUseSubTabs = false;
var DaMessageUse = false;
var tblHt=new String("");
var DaMessage=new String("");
var TabNameAry = new Array();
var TabURLAry = new Array();
var NewFlagAry = new Array();
var TabSubNameAry = new Array();
var TabSubURLAry = new Array();
var TabTTipAry = new Array();
var TabSubTTipAry = new Array();
var RICOLATabSub_NewIconAry = new Array();
var RICOLALayerTabs_RememberLastTab = false;
var RICOLATabs_CellPadding = 9;
var RICOLATabs_TabNumber = 0;


var DaTWidth="-1856";
var DaTHeight="-1856";
var DaTabWidth="-1856";
var DaSubTabWidth=-1856;
var AlertingString=new String("");
var DaTabAlign="CENTER";
var NewFlagWidth=15;
var tabmath = -1856;
var SubTabSeperator=new String("&nbsp;&nbsp;&nbsp;<SPAN CLASS='RICOLATabs_SubTabDivider'>|</SPAN>&nbsp;&nbsp;&nbsp;");
// var RICOLATabs_NewIndicatorStr = "&nbsp;<SPAN CLASS='RICOLATabs_SubtabNewIndicator'>NEW</SPAN>";
// var RICOLATabs_Inactive_NewIndicatorStr = "&nbsp;<SPAN CLASS='RICOLATabs_SubtabNewIndicator'>NEW</SPAN>";

var RICOLATabs_Active_NewIndicatorStr = "&nbsp;<SPAN CLASS='RICOLATabs_SubtabNewIndicator'><img src='/graphics/apps/ricola1yellow/tabs/new_msg_led.gif' border='0'>&nbsp;NEW&nbsp;MSG</SPAN>";
var RICOLATabs_Inactive_NewIndicatorStr = RICOLATabs_Active_NewIndicatorStr;

// var RICOLATabs_Active_NewIndicatorStr = "&nbsp;<IMG SRC='/graphics/apps/ricola1yellow/tabs/new_tab_yellow.gif' width='18' height='9' alt='new message' border='0' valign='top'>";
// var RICOLATabs_Inactive_NewIndicatorStr = "&nbsp;<IMG SRC='/graphics/apps/ricola1yellow/tabs/new_tab_white.gif' width='18' height='9' alt='new message' border='0' onMouseOver=\"this.src='/graphics/apps/ricola1yellow/tabs/new_tab_yellow.gif';\" onMouseOut=\"this.src='/graphics/apps/ricola1yellow/tabs/new_tab_white.gif';\">";

var LTabSubNameAry=new Array();
var LTabSubURLAry=new Array();
var LTabSubTTipAry=new Array();
var RICOLALTabSub_NewIconAry = new Array();

var initTabSub=false;
var currbdef=0;
var GlobalActiveTab=0;
var GlobalActiveSubTab=0;
var NetTab=0;
var NetSubTab=0;
var UsingLayers=false;
var UsingNetscapeLayerTabs=false;
var TabLayerNamesUsedAry=new Array();
var TotalSubTabLen=-1856;
var DaUseSubTabAlign=false;
var DaSubTabAlign=new String("");
var RICOLATabsAltTabBGColor=false;

var det=navigator.userAgent.toUpperCase();

var IE4PC=(det.indexOf("WIN",0) != -1) && (det.indexOf("MSIE 4",0) != -1);
var IE5PC=(det.indexOf("WIN",0) != -1) && (det.indexOf("MSIE 5",0) != -1);
var IE6PC=(det.indexOf("WIN",0) != -1) && (det.indexOf("MSIE 6",0) != -1);
var Netscape4PC=(det.indexOf("WIN",0) != -1) && (det.indexOf("MOZILLA/4",0) != -1) && (navigator.appName == "Netscape");
var Netscape6PC=(det.indexOf("WIN",0) != -1) && (det.indexOf("NETSCAPE6",0) != -1) && (navigator.appName == "Netscape");
if (!Netscape6PC) {
	var MozillaPC=(det.indexOf("WIN",0) != -1) && (det.indexOf("GECKO",0) != -1);
} else {
	var MozillaPC=false;
}
var OperaPC=(det.indexOf("WIN",0) != -1) && (det.indexOf("OPERA",0) != -1);
var IE4MAC=(det.indexOf("MAC",0) != -1) && (det.indexOf("MSIE 4",0) != -1);
var IE5MAC=(det.indexOf("MAC",0) != -1) && (det.indexOf("MSIE 5",0) != -1);
var IE6MAC=(det.indexOf("MAC",0) != -1) && (det.indexOf("MSIE 6",0) != -1);
var Netscape4MAC=(det.indexOf("MAC",0) != -1) && (det.indexOf("MOZILLA/4",0) != -1) && (navigator.appName == "Netscape");
var Netscape6MAC=(det.indexOf("MAC",0) != -1) && (det.indexOf("NETSCAPE6",0) != -1) && (navigator.appName == "Netscape");
var OperaMAC=(det.indexOf("MAC",0) != -1) && (det.indexOf("OPERA",0) != -1);
var MozillaMAC=(det.indexOf("MAC",0) != -1) && (det.indexOf("GECKO",0) != -1);



// ********************************************************************************************************************

	if (Netscape6PC) {
		document.write("	<STYLE TYPE='text/css'>.TabTopLayersHide { visibility : hidden; display: none;	}  .TabTopLayersShow { visibility : visible;  display: block;	} </STYLE> ");
	} else {
		document.write("	<STYLE TYPE='text/css'>\n\t\t.TabTopLayersHide { visibility : hidden; display: none;	} \n\t\t .TabTopLayersShow { visibility : visible;  display: inline;	} \n\t </STYLE> ");
	}


	var ie4 = (document.all) ? true : false;
	var ns4 = (document.layers) ? true : false;
	var ns6 = (document.getElementById && !document.all) ? true : false;

	function hidelayerTab(lay) {
		if (ie4) { document.all[lay].style.visibility = "hidden"; document.all[lay].style.display = "none";}
		if (ns4) { document.layers[lay].visibility = "hide";}
		if (ns6) {document.getElementById([lay]).style.display = "none"; document.getElementById([lay]).style.visibility = "hidden";}
	}
	function showlayerTab(lay) {
		if (ie4) { document.all[lay].style.visibility = "visible"; document.all[lay].style.display = "inline";}
		if (ns4) { document.layers[lay].visibility = "show";}
		if (ns6) { document.getElementById([lay]).style.display = "block"; document.getElementById([lay]).style.visibility = "visible";}
	}


// ********************************************************************************************************************

	function ActiveLayerP(inLayerToBe,inSubLayerToBe) {
		var z=0;
		GlobalActiveTab=inLayerToBe;
		(!inSubLayerToBe) ? GlobalActiveSubTab=1 : GlobalActiveSubTab=inSubLayerToBe;
		(!inSubLayerToBe) ? inSubLayerToBe="0" : inSubLayerToBe= parseInt(inSubLayerToBe) - 1;
		var inLayerToBe = parseInt(inLayerToBe) - 1;
		var holdingstr= new String("");
		if (!initTabSub) {
			for (i=0; i<TabNameAry.length; i++ ) {
				holdingstr="CurrentMainTab" + i.toString() + "_0";
				hidelayerTab(holdingstr);
				if (inLayerToBe == i) { showlayerTab(holdingstr); }
				holdingstr="CurrentBodyTab" + i.toString() + "_0";
				hidelayerTab(holdingstr);
				if (inLayerToBe == i) { showlayerTab(holdingstr); }
			}
		} else {
			for (i=0; i<TabNameAry.length; i++ ) {
				z=LTabSubNameAry[i].length;
				if (z == 0) { z = 1; }
				for (k=0; k<z; k++) {
					holdingstr="CurrentMainTab" + i.toString() + "_" + k.toString();
					hidelayerTab(holdingstr);
					if ((inLayerToBe == i) && (inSubLayerToBe == k)) { showlayerTab(holdingstr); }
					holdingstr="CurrentBodyTab" + i.toString() + "_" + k.toString();
					hidelayerTab(holdingstr);
					if ((inLayerToBe == i) && (inSubLayerToBe == k)) { showlayerTab(holdingstr); }
				}
			}
		}
		var currentHash = new String(window.location.hash);
		if (RICOLALayerTabs_RememberLastTab && ((currentHash == "") || (currentHash.indexOf("#RicolaTab_") != -1))) {
			window.location.hash = "#RicolaTab_" + inLayerToBe + "_" + inSubLayerToBe;
		}

	}

// ********************************************************************************************************************

function LayerTabs_RememberLastTab() {
	RICOLALayerTabs_RememberLastTab = true;
	return true;
}

// ********************************************************************************************************************

function RICOLATabs_PermissionForNew() {
	var allowableApps = new Array("/myu/","/set/","/igen143/","/ricola_test/");
	var cLoc = new String(window.location.pathname);
	var cReg;
	for (var i=0; i < allowableApps.length; i++) {
		cReg = new RegExp(allowableApps[i]);
		if (cLoc.search(cReg) != -1) {
			return true;
		}
	}
	return false;
}


// ********************************************************************************************************************

function RICOLATabs_StripChars(inItem) {
	inItem = inItem.toString();
//	inItem = inItem.replace(/ /g, "&nbsp;");
	return inItem;
}

// ********************************************************************************************************************

function LSubTab(inTab, inSubTabName)
{
	var i=0;
	DaUseSubTabs=false;
	if (!inTab || (inTab > TabNameAry.length)) {
		alert("Error #39:  In the LSubTab(w,x,y,z) function, ");
	}
	inTab=parseInt(inTab);
	if (!initTabSub) {
		for (i=0; i < TabNameAry.length; i++)
		{
			LTabSubNameAry[i]=new Array();
			LTabSubURLAry[i]=new Array();
			LTabSubTTipAry[i]=new Array();
			RICOLALTabSub_NewIconAry[i] = new Array();
		}
		initTabSub=true;
	}
	inTab--;
	i=LTabSubNameAry[inTab].length;
	LTabSubNameAry[inTab][i]=inSubTabName;
//	LTabSubURLAry[inTab][i]="javascript: void ActiveLayerP(" + (inTab + 1) + ","  + (i + 1) +");";
	LTabSubURLAry[inTab][i]="ActiveLayerP(" + (inTab + 1) + ","  + (i + 1) +"); return false;"; // Changing from HREF to OnClick

	LTabSubTTipAry[inTab][i]="-1856";
	RICOLALTabSub_NewIconAry[inTab][i] = false;
	for (var x=2; x < arguments.length; x++) {
		if (arguments[x].toString().search(/^new:\s*1\s*$/i) != -1) {
			if (RICOLATabs_PermissionForNew()) {
				RICOLALTabSub_NewIconAry[inTab][i] = true;
			}
		} else {
			LTabSubTTipAry[inTab][i] = arguments[x].toString();
		}
	}
}

// ********************************************************************************************************************


function LTab(DaTabName, DaNewFlag, DaToolTip)
{
	var cLen = TabNameAry.length;
	TabNameAry[cLen] = DaTabName;
//	TabURLAry[cLen] = "javascript: void ActiveLayerP(" + (cLen + 1) + ");";
	TabURLAry[cLen] = "ActiveLayerP(" + (cLen + 1) + "); return false;";	 // Changing from HREF to OnClick

	TabTTipAry[cLen] = "-1856";
	NewFlagAry[cLen] = false;

	for (var x=1; x < arguments.length; x++) {
		if (arguments[x].toString().search(/^new:\s*1\s*$/i) != -1) {
			if (RICOLATabs_PermissionForNew()) {
				NewFlagAry[cLen] = true;
			}
		} else if (arguments[x].toString().search(/^\s*url:\s*\S+\s*$/i) != -1) {
			TabURLAry[cLen] = arguments[x].toString().replace(/^\s*url:\s*(\S+)\s*$/i, "$1");
		} else if (arguments[x].toString().search(/^\s*[01]\s*$/) == -1) {
			TabTTipAry[cLen] = arguments[x].toString();
		}
	}
}

// ********************************************************************************************************************


function Tab(inTabName, inTabURL, inNewFlag, inToolTip)
{
	var cLen = TabNameAry.length;
	TabNameAry[cLen] = inTabName;
	TabURLAry[cLen] = inTabURL;

	TabTTipAry[cLen] = "-1856"
	NewFlagAry[cLen] = false

	for (var x=2; x < arguments.length; x++) {
		if (arguments[x].toString().search(/^new:\s*1\s*$/i) != -1) {
			if (RICOLATabs_PermissionForNew()) {
				NewFlagAry[cLen] = true;
			}
		} else if (arguments[x].toString().search(/^\s*[01]\s*$/) == -1) {
			TabTTipAry[cLen] = arguments[x].toString();
		}
	}
}

// ********************************************************************************************************************


function UseSubTabs() {
	return true;
}

// ********************************************************************************************************************


function UseAltTabBGColor() {
	RICOLATabsAltTabBGColor=true;
}

// ********************************************************************************************************************


function SubTab(inTabName, inTabURL) {
	DaUseSubTabs = true;
	DaMessageUse = false;
	var currentNum = TabSubNameAry.length;
	TabSubNameAry[currentNum] = inTabName;
	TabSubURLAry[currentNum] = inTabURL;

	RICOLATabSub_NewIconAry[currentNum] = false;
	TabSubTTipAry[currentNum] = "-1856"

	for (var i=2; i < arguments.length; i++) {
		if (arguments[i].toString().search(/^new:\s*1\s*$/i) != -1) {
			if (RICOLATabs_PermissionForNew()) {
				RICOLATabSub_NewIconAry[currentNum] = true;
			}
		} else {
			TabSubTTipAry[currentNum] = arguments[i].toString();
		}
	}
}

// ********************************************************************************************************************


function MessageBar(inMessage)
{
	DaUseSubTabs = false;
	initTabSub=false;
	DaMessageUse = true;
	inMessage = inMessage.toString().replace(/<\/?font[^>]*>/gi, "");
	DaMessage=inMessage;
}

// ********************************************************************************************************************


function TabsHeight(inHeight) {
	DaTHeight=inHeight;
}

// ********************************************************************************************************************


function TabsWidth(inWidth) {
	inWidth = inWidth.toString().replace(/^\s+|\s+$/g, "");
	if (!inWidth.match(/[^0-9]/)) {
		inWidth = inWidth + "px";
	}
	DaTWidth=inWidth;
}

// ********************************************************************************************************************


function SubTabAlign(inAlign) {
	DaUseSubTabAlign=true;
	DaSubTabAlign=inAlign;
}

// ********************************************************************************************************************


function TabsAlign(inAlign)
{
	if (inAlign) {
		inAlign=inAlign.toUpperCase();
		if ((inAlign == "CENTER") || (inAlign == "LEFT") || (inAlign == "RIGHT")) {
			DaTabAlign=inAlign;
		} else {
			alert("Error #91: The Value '" + inAlign + "' is not a valid parameter for the TabsAlign() function.  Please pass in either 'LEFT', 'CENTER', or 'RIGHT'.");
		}
	}
}

/***********************************************************************************************/

function WriteOutTabs(DaActiveTab,DaActiveSubTab,cwidth)
{
	RICOLATabs_TabNumber++;
	var i=0;
	var k=0;
	var toutputstr=new String("");
	var toutputstr2=new String("");
	var toutputstr3=new String("");
	var PercentWidth = 100 / (TabNameAry.length + 1);
	var AltTabBGColor = (RICOLATabsAltTabBGColor)? "2" : "";

	if (Netscape4PC) {
		document.write("<TABLE BORDER='0' CELLSPACING='0' CELLPADDING='0' WIDTH='" + cwidth + "'>\n<TR>\n");
	} else {
		document.write("<TABLE BORDER='0' CELLSPACING='0' CELLPADDING='0' WIDTH='100%'>\n<TR>\n");
	}
	if (TabNameAry.length == 0) {
		alert("Regular Tabs Error #19: There are no tabs defined.  Please use the \"Tab\" function [Tab(Name,URL,Flag)] before calling this function (ActiveTab).  Refer to http://home.www.uprr.com/emp/it/hf/ricola/tabs/index.shtml for more information.\n\nThank You.");
		return false;
	}
	(DaActiveTab == 0)? toutputstr="act" : toutputstr="inact";

	if (TabURLAry[0].search(/^ActiveLayerP/i) != -1) {		// If Layers Version
		document.write("\t<TD ALIGN='RIGHT'><A href=\"#\" onClick=\"" + TabURLAry[0] + "\"><IMG SRC='/graphics/apps/ricola1yellow/tabs/tab" + AltTabBGColor + "_beg_" + toutputstr + ".gif' WIDTH='6' HEIGHT='24' BORDER='0'/></A></TD>\n");
	} else {
		document.write("\t<TD ALIGN='RIGHT'><A HREF=\"" + TabURLAry[0] + "\"><IMG SRC='/graphics/apps/ricola1yellow/tabs/tab" + AltTabBGColor + "_beg_" + toutputstr + ".gif' WIDTH='6' HEIGHT='24' BORDER='0'/></A></TD>\n");
	}


	for (i=0; i< TabNameAry.length; i++) {
		(TabTTipAry[i] != "-1856") ? toutputstr=" TITLE=\"" + TabTTipAry[i] + "\" " : toutputstr="";
		if (i == DaActiveTab) {
			if (TabURLAry[i].search(/^ActiveLayerP/i) != -1) {		// If Layers Version
				toutputstr=" CLASS=\"tabactive_cell\"><A CLASS=\"tabactive_name\" id=\"TabNameLink_" + RICOLATabs_TabNumber + "_" + (i + 1) + "\" href=\"#\" onClick=\"" + TabURLAry[i] + "\" " + toutputstr;
			} else {
				toutputstr=" CLASS=\"tabactive_cell\"><A CLASS=\"tabactive_name\" id=\"TabNameLink_" + RICOLATabs_TabNumber + "_" + (i + 1) + "\" HREF=\"" + TabURLAry[i] + "\" " + toutputstr;
			}
		} else {
			if (TabURLAry[i].search(/^ActiveLayerP/i) != -1) {		// If Layers Version
				toutputstr=" CLASS=\"tabinactive_cell\"><A CLASS=\"tabinactive_name\" id=\"TabNameLink_" + RICOLATabs_TabNumber + "_" + (i + 1) + "\" onMouseOver=\"this.className='tabinactive_name_Highlight';\" onMouseOut=\"this.className='tabinactive_name';\" href=\"#\" onClick=\"" + TabURLAry[i] + "\" " + toutputstr;
			} else {
				toutputstr=" CLASS=\"tabinactive_cell\"><A CLASS=\"tabinactive_name\" id=\"TabNameLink_" + RICOLATabs_TabNumber + "_" + (i + 1) + "\" onMouseOver=\"this.className='tabinactive_name_Highlight';\" onMouseOut=\"this.className='tabinactive_name';\" HREF=\"" + TabURLAry[i] + "\" " + toutputstr;
			}
/*			if (Netscape6PC) {
				toutputstr+=" onClick=\"this.className='tabinactive_name';\" ";
			}
*/
		}

		(!Netscape4PC)? toutputstr=" WIDTH='" + DaTabWidth + "' " + toutputstr : toutputstr=" WIDTH='" + DaTabWidth + "' " + toutputstr;

		toutputstr2 = "";
		if (NewFlagAry[i]) {
			if (i == DaActiveTab) {
				toutputstr2 = RICOLATabs_Active_NewIndicatorStr;
			} else {
				toutputstr2 = RICOLATabs_Inactive_NewIndicatorStr;
			}
		}
//		toutputstr2 = (NewFlagAry[i])? RICOLATabs_NewIndicatorStr : "";

//		(NewFlagAry[i]) ? toutputstr2="&nbsp;</A><A HREF=\"" + TabURLAry[i] + "\"><IMG SRC='/graphics/apps/ricola1yellow/tabs/new_" + toutputstr3 + ".gif' WIDTH='15' HEIGHT='13' BORDER='0' ALT='NEW'>" : toutputstr2="";
// Removes New Icon

		document.write("\t<TD nowrap='NOWRAP' HEIGHT='24' ALIGN='center' " + toutputstr + " >" + RICOLATabs_StripChars(TabNameAry[i]) + toutputstr2 + "</A></TD>\n");

		if (((i + 1) == TabNameAry.length) && (i == DaActiveTab)) {
			toutputstr="end_act";
			if (TabURLAry[i].search(/^ActiveLayerP/i) != -1) {		// If Layers Version
				toutputstr2="<A HREF=\"#\" onClick=\"" + TabURLAry[i] + "\">";
			} else {
				toutputstr2="<A HREF=\"" + TabURLAry[i] + "\">";
			}
			toutputstr3="</A>";
		} else if ((i + 1) == TabNameAry.length) {
			toutputstr="end_inact";
			if (TabURLAry[i].search(/^ActiveLayerP/i) != -1) {		// If Layers Version
				toutputstr2="<A HREF=\"#\" onClick=\"" + TabURLAry[i] + "\">";
			} else {
				toutputstr2="<A HREF=\"" + TabURLAry[i] + "\">";
			}
			toutputstr3="</A>";
		} else if ((i + 1) == DaActiveTab) {
			toutputstr="inact_act";
			toutputstr2="";
			toutputstr3="";
		} else if (i == DaActiveTab) {
			toutputstr="act_inact";
			toutputstr2="";
			toutputstr3="";
		} else {
			toutputstr="inact_inact";
			toutputstr2="";
			toutputstr3="";
		}

		document.write("     <TD nowrap>" + toutputstr2 + "<IMG SRC='/graphics/apps/ricola1yellow/tabs/tab" + AltTabBGColor + "_" + toutputstr + ".gif'  HEIGHT='24' BORDER='0' />" + toutputstr3 + "</TD>\n");
	}

	tabmath = CalcTabMath();
	if (DaTWidth > tabmath) {
		if (Netscape4PC) {
			document.writeln("<TD WIDTH='" + (DaTWidth - tabmath - 23) + "'>&nbsp;</TD>");
		} else {
			document.writeln("<TD WIDTH='" + (DaTWidth - tabmath) + "'>&nbsp;</TD>");
		}
	} else {
		document.writeln("<TD WIDTH='100%' NOWRAP class='tab_toptier_spacer'>&nbsp;</TD>");
	}
	// The blank Cell that is above the last endtab.gif from the subtab row
	document.write("     <TD WIDTH='9'><IMG SRC='/graphics/space.gif' BORDER='0' WIDTH='9' HEIGHT='1' /></TD>\n</TR>\n");
	document.writeln("</TABLE>");
	/*
	Subtabs
	*/
	document.write("<TABLE BORDER='0' CELLSPACING='0' CELLPADDING='0' WIDTH='100%' >\n<TR>\n");
	document.write("     <TD HEIGHT='24' NOWRAP CLASS='RICOLATabs_SubTabRow' ALIGN='CENTER'>&nbsp;");

	if (DaMessageUse) {
		document.write("<SPAN CLASS='RICOLATabs_Message'>" + DaMessage + "</SPAN>");
	} else if ((DaUseSubTabs) && (TabSubNameAry.length != 0)) {
		for (i=0; i < TabSubNameAry.length; i++) {
			if (i == DaActiveSubTab) {
				toutputstr=" HREF=\"" + TabSubURLAry[i] + "\" CLASS=\"RICOLATabs_SubTabOn\" ID=\"SubLayerID" + (DaActiveTab + 1) + "_" + (i + 1) + "\" "
			} else {
				toutputstr=" HREF=\"" + TabSubURLAry[i] + "\" CLASS=\"RICOLATabs_SubTabOff\" ID=\"SubLayerID" + (DaActiveTab + 1) + "_" + (i + 1) + "\"  onMouseOver=\"this.className='RICOLATabs_SubTabHighlight';\" onMouseOut=\"this.className='RICOLATabs_SubTabOff';\" ";
				if (Netscape6PC) { toutputstr+=" onClick=\"this.className='RICOLATabs_SubTabOff';\" "; }
			}
			if (TabSubTTipAry[i] != "-1856") { toutputstr+=" TITLE=\"" + TabSubTTipAry[i] + "\" " ; }
			document.write("<A " + toutputstr + ">" + TabSubNameAry[i]);
			if (RICOLATabSub_NewIconAry[i]) {
				if (i == DaActiveSubTab) {
					document.writeln(RICOLATabs_Active_NewIndicatorStr);
				} else {
					document.writeln(RICOLATabs_Inactive_NewIndicatorStr);
				}
			}
			document.writeln("</A>");
			if ((i + 1) != TabSubNameAry.length) { document.writeln(SubTabSeperator); }
		}
	} else if (initTabSub) {    // Using Layers for Subtabs
		for (i=0; i < LTabSubNameAry[DaActiveTab].length; i++) {
			if (i == DaActiveSubTab) {
				toutputstr=" CLASS='RICOLATabs_SubTabOn' "
			} else {
				toutputstr=" HREF='#' onClick='" + LTabSubURLAry[DaActiveTab][i] + "' CLASS='RICOLATabs_SubTabOff' onMouseOver=\"this.className='RICOLATabs_SubTabHighlight';\" onMouseOut=\"this.className='RICOLATabs_SubTabOff';\" ";
				if (Netscape6PC) { toutputstr+=" onClick=\"this.className='RICOLATabs_SubTabOff';\" "; }
			}

			if (LTabSubTTipAry[DaActiveTab][i] != "-1856") { toutputstr+=" TITLE='" + LTabSubTTipAry[DaActiveTab][i] + "' " ; }
			document.write("<A " + toutputstr + ">" + LTabSubNameAry[DaActiveTab][i]);

			if (RICOLALTabSub_NewIconAry[DaActiveTab][i]) {
				if (i == DaActiveSubTab) {
					document.writeln(RICOLATabs_Active_NewIndicatorStr);
				} else {
					document.writeln(RICOLATabs_Inactive_NewIndicatorStr);
				}
			}
			document.writeln("</A>");

			if ((i + 1) != LTabSubNameAry[DaActiveTab].length) { document.writeln(SubTabSeperator); }
		}
	}
	document.writeln("&nbsp;</TD>");
	document.writeln("<TD WIDTH='9'><IMG SRC='/graphics/apps/ricola1yellow/tabs/tab_end_sublay.gif' WIDTH='9' HEIGHT='24' /></TD>\n\n</TR>\n</TABLE>\n");
}


// ********************************************************************************************************************************


function CalculateTabWidth() {
	var CharConv={ "I":2,"i":2,"j":2,"l":2,"|":2,"f":3,"t":3," ":4,"&nbsp;":4,"r":4,"F":5, "L":5,"z":5,"J":6,"E":6,"T":6,"Z":6,"a":6,"b":6,"c":6,"d":6,"e":6,"g":6,"h":6,"j":6,"n":6,"o":6,"p":6,"q":6,"s":6,"u":6,"v":6,"y":6,"1":6,"2":6,"3":6,"4":6,"5":6,"6":6,"7":6,"8":6,"9":6,"0":6,"A":7,"B":7,"C":7,"D":7,"G":7,"H":7,"N":7,"P":7,"S":7,"U":7,"Y":7,"x":7,"K":8,"O":8,"Q":8,"R":8,"V":8,"X":8,"M":9,"w":9,"m":10,"W":12 };
	var k=0;
	if (Netscape4PC) {
		k=2;
	} else {
		(Netscape6PC)? k=2 : k=1;
	}
	for (i in CharConv) {

		CharConv[i]+=k;
	}

	var tempHold=0;
	var maxLength=0;
	var currcount=0;
	var holderstr=new String("");
	for (k=0; k<TabNameAry.length; k++)
	{
		currcount=0;
		for (y=0; y<TabNameAry[k].length; y++ ) {
			if (TabNameAry[k].slice(y,y+1) == "<") {
				for (xy=0; xy < TabNameAry[k].length; xy++)
				{
					if (TabNameAry[k].slice(y,y+1) == ">") {
						y++;
						xy = TabNameAry[k].length;
					} else {
						y++;
					}
				}
			}
			(CharConv[TabNameAry[k].slice(y,y+1)])? tempHold=CharConv[TabNameAry[k].slice(y,y+1)] : tempHold=8;
			currcount+=tempHold;
		}
		if (NewFlagAry[k]) { currcount+= CharConv["&nbsp;"] + NewFlagWidth; }
		if (maxLength < currcount) { maxLength = currcount }
	}
	DaTabWidth= maxLength;
	if ((DaUseSubTabs) && (TabSubNameAry.length != 0)) {
		TotalSubTabLen=0;
		for (k=0; k<TabSubNameAry.length; k++) {
			currcount=0;
			for (y=0; y<TabSubNameAry[k].length; y++ ) {
				(CharConv[TabSubNameAry[k].slice(y,y+1)])? tempHold=CharConv[TabSubNameAry[k].slice(y,y+1)] : tempHold=8;
				currcount+=tempHold;
			}
			currcount+=23;		// Seperator Length
			if (maxLength < currcount) { maxLength = currcount }
			TotalSubTabLen+=currcount;
		}
		DaSubTabWidth=maxLength;
	}

}

// **********************************************************************************************************************

function CalcTabMath() {
	return (((DaTabWidth + 23) * TabNameAry.length) + 19);
}

// **********************************************************************************************************************

function RICOLATabs_innerTableCellPadding(inNum) {
	RICOLATabs_CellPadding = inNum;
}

// **********************************************************************************************************************

function ActiveTab(DaActiveTab,DaActiveSubTab)
{
	UsingLayers=false;
	var tmoStr=new String("");
	(DaActiveTab)? DaActiveTab-- : DaActiveTab = 0;
	(DaActiveSubTab)? DaActiveSubTab-- : DaActiveSubTab = 0;
	if (DaActiveTab >= TabNameAry.length) { DaActiveTab = (TabNameAry.length - 1); }
	if (DaActiveSubTab >= TabSubNameAry.length) { DaActiveSubTab = (TabSubNameAry.length - 1); }
	CalculateTabWidth();
	tabmath = CalcTabMath();
	if (DaTWidth == "-1856") {
		tmoStr=" WIDTH='97%' ";
	} else {
	 	if (DaTWidth < tabmath) {
			tmoStr=" WIDTH='" + tabmath + "' "
		} else {
			tmoStr=" WIDTH='" + DaTWidth + "' ";
		}
	}
	document.write("<TABLE BORDER='0' CELLPADDING='0' CELLSPACING='0' " + tmoStr + " ALIGN='" + DaTabAlign + "' ID='MajorTable'><TR><TD>");
	WriteOutTabs(DaActiveTab,DaActiveSubTab);
	if (DaTHeight != "-1856")
	{
		tmoStr=" HEIGHT='" + DaTHeight + "' ";
	} else { tmoStr=""; }

	document.write("</TD></TR><TR><TD>");
	document.writeln("\n<TABLE BORDER='0' CELLSPACING='0' CELLPADDING='" + RICOLATabs_CellPadding + "' class='RicolaTabsBodySection' " + tmoStr + " style='width:100%;'>\n<TR>\n     <TD id='RicolaTabsBodySectionFirstCell'>");
}

/* ******************************************************************************************************************** */

function LActiveTab(DaActiveTab,DaActiveSubTab)
{
	if (Netscape4PC) {
		UsingNetscapeLayerTabs=true;
	}
	UsingLayers=true;
	var tmoStr=new String("");
	GlobalActiveSubTab=DaActiveSubTab;
	GlobalActiveTab=DaActiveTab;
	if ((DaActiveTab) && (DaActiveTab > 2)) {
		DaActiveTab--;

	} else {
		DaActiveTab = 1;
	}
	((DaActiveSubTab) && (DaActiveSubTab > 1))? DaActiveSubTab-- : DaActiveSubTab = 0;
	if ((DaActiveTab >= TabNameAry.length) && (TabNameAry.length !=0 )) { DaActiveTab = (TabNameAry.length - 1); }
	if ((DaActiveSubTab >= TabSubNameAry.length) && (TabSubNameAry.length !=0)) {
		DaActiveSubTab = (TabSubNameAry.length - 1);
	}

	CalculateTabWidth();
	tabmath = CalcTabMath();
	var cwidth=0;
	((DaTWidth == "-1856") || (DaTWidth < tabmath)) ? tmoStr=" WIDTH='100%' ": tmoStr=" WIDTH='" + DaTWidth + "' ";
	if (DaTWidth == "-1856") {
		tmoStr=" WIDTH='100%' ";
		cwidth="100%";
	} else {
	 	if (DaTWidth < tabmath) {
			tmoStr=" WIDTH='" + tabmath + "' "
			cwidth=tabmath;
		} else {
			tmoStr=" WIDTH='" + DaTWidth + "' ";
			cwidth=DaTWidth;
		}
	}

	document.write("<TABLE BORDER='0' CELLPADDING='0' CELLSPACING='0' " + tmoStr + " BORDERCOLOR='Navy' ALIGN='" + DaTabAlign + "'>");
	document.write("<TR><TD>");
	if (Netscape4PC) {
		document.write("<ILAYER ID='MajorLayer' NAME='MajorLayer'  HEIGHT='48' WIDTH='" + cwidth + "'></ILAYER>");
		document.write("</TD></TR></TABLE>");
	}
	var i=0;
	var k=0;
	var z=-1856;
	for (i=0; i< TabNameAry.length; i++ ) {
		z=-1856;
		(initTabSub)? z=LTabSubNameAry[i].length : z=0;
		for (k=0; k< z; k++) {
			TabLayerNamesUsedAry[TabLayerNamesUsedAry.length]="CurrentMainTab" + i + "_" + k;
			if (Netscape4PC) {
				document.write("<LAYER NAME='CurrentMainTab" + i + "_" + k + "'  LEFT='" + document.layers.MajorLayer.pageX + "' TOP='" + document.layers.MajorLayer.pageY + "' Z-INDEX='29'  VISIBILITY='show' >");
				WriteOutTabs(i,k,cwidth);
			} else {
				document.write("<DIV CLASS='TabTopLayersShow' ID='CurrentMainTab" + i + "_" + k + "' STYLE='z-index: 1; position: relative; width: 100%;'>");
				WriteOutTabs(i,k);
			}


			if (Netscape4PC) {
				document.write("</LAYER>");
			} else {
				document.write("</DIV>");
			}

		}
		if (z == 0) {
			TabLayerNamesUsedAry[TabLayerNamesUsedAry.length]="CurrentMainTab" + i + "_0";
			if (Netscape4PC) {
				document.write("<LAYER NAME='CurrentMainTab" + i + "_0'  LEFT='" + document.layers.MajorLayer.pageX + "' TOP='" + document.layers.MajorLayer.pageY + "' Z-INDEX='29'  VISIBILITY='show'  >");
			} else {
				document.write("<DIV CLASS='TabTopLayersShow' ID='CurrentMainTab" + i + "_0' STYLE='z-index: 1; position: relative; width: 100%;'>");
			}

			WriteOutTabs(i);
			if (Netscape4PC) {
				document.write("</LAYER>");
			} else {
				document.write("</DIV>");
			}

		}
	}

	if (DaTHeight != "-1856")
	{
		tmoStr=" HEIGHT='" + DaTHeight + "' ";
	}
	if (!Netscape4PC) {
		document.write("</DIV></TD>");
		document.write("</TR>");
		document.write("<TR>\n<TD>\n");
		document.writeln("\n<TABLE BORDER='0' CELLSPACING='0' CELLPADDING='" + RICOLATabs_CellPadding + "' class='RicolaTabsBodySection' " + tmoStr + " style='width:100%;'>\n<TR>\n     <TD VALIGN=\"top\" id='RicolaTabsBodySectionFirstCell'>");
	}
}

// ******************************************************************************************************

function BeginTabBody(inTab, inSubTab)
{
	if (inTab) {
		inTab--
	} else {
		alert("Error #5:  no parameters specified in BeginTabBody(x,y) Function.  Please specify the main tab and the sub-tab (if applicable).  Thank you");
	}
	if ((inSubTab) && (inSubTab > 0)) {
		inSubTab--
	} else {
		inSubTab=0;
	}
	if ((Netscape4PC) && (currbdef == 0)) {

		currbdef=40;

	}
	if (Netscape4PC) {
		NetTab=inTab;
		NetSubTab=inSubTab;
		currbdef++;
	} else {
		document.write("<DIV CLASS='TabTopLayersShow' ID='CurrentBodyTab" + inTab + "_" + inSubTab + "' STYLE='z-index: 1; position: relative; width: 100%;'>");
	}
}

// ******************************************************************************************************

function EndTabBody()
{
	if (!Netscape4PC) {
		document.write("</DIV>");
	}
}

// ******************************************************************************************************

function EndTabBodyLast()
{
	if (!Netscape4PC) {
		var currentHash = new String(window.location.hash);
		if (RICOLALayerTabs_RememberLastTab && (currentHash.search(/^#RicolaTab_\d+_\d+$/) != -1)) {
			ActiveLayerP(parseInt(currentHash.replace(/^#RicolaTab_(\d+)_\d+$/, "$1"), 10) + 1, parseInt(currentHash.replace(/^#RicolaTab_\d+_(\d+)$/, "$1"), 10) + 1);
		} else {
			ActiveLayerP(GlobalActiveTab,GlobalActiveSubTab);
		}
	}
}

/******************************************************************************************************************/

function NetscapeCompliance()
{
	if (!Netscape4PC) {
		return false;
	}
	if (UsingLayers) {
		ActiveLayerP(GlobalActiveTab,GlobalActiveSubTab);
	} else {
		document.write("</TD></TR></TABLE>");
		document.write(" </TD></TR></TABLE> ");
	}
}

/******************************************************************************************************************/


function TabsLayersSubmit() {
	if (Netscape6PC) {
			var i=0;
		var k=0;
		var z=0;
		var temphold=new String("");
		for (i=0; i<TabNameAry.length; i++ ) {
			if (LTabSubNameAry[i]) {
				z=LTabSubNameAry[i].length;
			} else {
				z = 1;
			}
			for (k=0; k<z; k++) {
				temphold="CurrentBodyTab" + i.toString() + "_" + k.toString();
				showlayerTab(temphold);
			}
		}
	}

}


/******************************************************************************************************************/
