/*
Developed By: Sturgill Software Development
Created: 3/14/01
Web Site: http://www.ssdevelopment.com
By: Paul Sturgill

Description:
These functions act as objects for a Toolbar that acts like a popular VB Toolbar
*/
function Toolbar(sName , sCaption , sAlign , sFontColor , sBgcolor , sCurrentlyOpen , sWidth , sHeight)
{
var arrMod = new Array()

	this.ToolbarName = sName
	this.Caption = sCaption
	this.Align = sAlign
	this.Modules = arrMod
	this.FontColor = sFontColor
	this.BgColor = sBgcolor
	this.CurrentlyOpen = sCurrentlyOpen
	this.Width = sWidth
	this.Height = sHeight
	
}
// MODULE OBJECT
function Module(sName,sDetail,sHeaderCaption,sContent,sBgcolor,sFontcolor,sAlign,sHeaderBgColor,sHeaderFontColor)
{
	this.ModuleName = sName
	this.ContentName = sDetail
	this.HeaderCaption = sHeaderCaption
	this.Content = sContent	
	this.BgColor = sBgcolor
	this.FontColor = sFontcolor
	this.Align = sAlign
	this.HeaderBgColor = sHeaderBgColor	
	this.HeaderFontColor = sHeaderFontColor
	
}
// ******************************* Open Function
function OpenModule(sDetail, iToolbar)
{
try
{
	// close the current module first
	CloseModule(objToolbar[iToolbar].CurrentlyOpen)
	
	// then make the module that is passed in as a parameter visible
	
	if(document.all)
	{
		eval(sDetail+".style.display = ''")
	}
	else if(document.layers)
	{
		// what is equivalent so that the space is shrunk down like IE does with Display:None
	}
	else if(document.getElementById)
	{
		
		// what is equivalent so that the space is shrunk down like IE does with Display:None
		document.getElementById(sDetail).style.display = ""
	}
	// set the current module
	objToolbar[iToolbar].CurrentlyOpen = sDetail
}
catch(e)
{
	alert(e.description)
	alert("Open Module Error")
}	
}
// ******************************* Close Function
function CloseModule(sDetail)
{
	try
	{
		
			if(document.all)
			{
				eval(sDetail+".style.display = 'none'")
			}
			else if(document.layers)
			{
				// what is equivalent so that the space is shrunk down like IE does with Display:None
			}
			else if(document.getElementById)
			{
				// what is equivalent so that the space is shrunk down like IE does with Display:None
				document.getElementById(sDetail).style.display = "none"
			}
	}
	catch(e)
	{
		alert(e.description)
		alert("Close Module Error")
	}
}
function BuildToolbar()
{
var sStyleDisplay = ""
				for(var x = 0 ; x < objToolbar.length ; x++)
				{
					document.write("<TABLE BORDER=1 style='HEIGHT:" + objToolbar[x].Height + ";width:" + objToolbar[x].Width + "' >")
						document.write("<TR>")
							document.write("<TD style='vertical-align:top;text-align:" + objToolbar[x].Align + ";color:" + objToolbar[x].FontColor +";Background:" + objToolbar[x].BgColor+ "'>")
						document.write(objToolbar[x].Caption)
							
						for(var i = 0 ; i < objToolbar[x].Modules.length ; i++ )
						{
							// create the DIV that will contain the button and SPAN
							document.write("<DIV id='" + objToolbar[x].Modules[i].ModuleName + "'>")
								// this button acts as the module header
								document.write("<BUTTON style='Width:" + objToolbar[x].Width + ";Background:" + objToolbar[x].Modules[i].HeaderBgColor+ ";color:" + objToolbar[x].Modules[i].HeaderFontColor+ ";'  onclick=OpenModule('" + objToolbar[x].Modules[i].ContentName  + "'," + x + ") id=button1 name=button1>" + objToolbar[x].Modules[i].HeaderCaption + "</BUTTON>")
								// this is where the content will end up
								if(objToolbar[x].CurrentlyOpen != objToolbar[x].Modules[i].ContentName)
								{
									sStyleDisplay = "Display:None"
										// change depending on the browser
										if(document.all)
										{
											sStyleDisplay = "Display:None"
										}
										else if(document.layers)
										{
											// don't know the equivalent in NS
											sStyleDisplay = ""
										}
										else if(document.getElementById)
										{
											// don't know the equivalent in NS
											sStyleDisplay = "Display:none"
										}
								}
								else
								{
									sStyleDisplay = ""
								}
								
									document.write("<DIV id='" + objToolbar[x].Modules[i].ContentName + "' style='HEIGHT:" + objToolbar[x].Height + ";width:" + objToolbar[x].Width + ";" + sStyleDisplay + ";Background:" + objToolbar[x].Modules[i].BgColor + ";color:" + objToolbar[x].Modules[i].FontColor + ";text-align:" + objToolbar[x].Modules[i].Align + "'>")
										document.write(objToolbar[x].Modules[i].Content)
									document.write("</DIV>")
							document.write("</DIV>")
						}// end of Modules loop
						
							document.write("</TD>")
						document.write("</TR>")
					document.write("</TABLE>")
				}// end of toolbars loop
}
/*
Developed By: Sturgill Software Development
Created: 3/14/01
Web Site: http://www.ssdevelopment.com
By: Paul Sturgill

Description:
These functions act as objects for a Toolbar that acts like a popular VB Toolbar
*/