/* *********************************************************
	Date:			3/18/2005
	Name:			writeHdrBar
	Purpose:	Puts the Pool Shop headers on the page.
						Function is called from web page.
						The title string and chosen style for the header bar being generated is passed in that function call. 
 						This acts as a SSI that you can change the text and style of the header bar by passing a variable. 
  
	Inputs:  	headerTxt:  Text that will appear in the header bar.	
						barStyle:		Graphical style of the bar you want.  Your choices are:
													plain
													swoopDownLeft
													swoopDownRight
													swoopUpLeft
													swoopUpRight
													swoopDown
													swoopUp
													leanLeft
													leanRight
													crissCross
					
	
	Returns:  HTML table containing the graphics and text that make up the header bar. 
********************************************************* */

function writeHdrBar(barStyle, headerTxt)
{

	var imgLoc = "/images/";		// Location of images used to make up the header bar.
	var barImgsH = "31";				// Height of images that make up the bar.
	var leftImgW = "26";				// Width of the left image on the header bar.
	var rightImgW = "37";				// Width of the right image on the header bar.
	var spacerImg = "1x1.gif" 	// Image to be used as a spacer.
	
	// Images that can be used to construct different variations of bars.
	var barEnd = new Array(7) 
		barEnd[0] = "tblHdr_Dwrd_Left.gif"; 
		barEnd[1] = "tblHdr_Dwrd_Right.gif"; 
		barEnd[2] = "tblHdr_Uprd_Left.gif"; 
		barEnd[3] = "tblHdr_Uprd_Right.gif"; 
		barEnd[4] = "tblHdr_CrisCros_Left.gif"; 
		barEnd[5] = "tblHdr_CrisCros_Right.gif"; 
		barEnd[6] = "tblHdr_Plain_Left.gif";
		barEnd[7] = "tblHdr_Plain_Right.gif";
		
	// Will be populated with the chosen images.
	var endImgs = new Array(1)
		endImgs[0] = "";	// Left barEnd img.
		endImgs[1] = "";  // Right barEnd img.
		
	// Pick the correct left and right images to be used on bar ends.
	switch(barStyle) 
	{
	case(barStyle = "plain"): 
		endImgs[0] = barEnd[6];
		endImgs[1] = barEnd[7];
	break			
	case(barStyle = "swoopDownLeft"): 
		endImgs[0] = barEnd[0];
		endImgs[1] = barEnd[7];
	break
	case(barStyle = "swoopDownRight"): 
		endImgs[0] = barEnd[6];
		endImgs[1] = barEnd[1];
	break									
	case(barStyle = "swoopUpLeft"): 
		endImgs[0] = barEnd[2];
		endImgs[1] = barEnd[7];
	break								
	case(barStyle = "swoopUpRight"): 
		endImgs[0] = barEnd[6];
		endImgs[1] = barEnd[3];
	break
	case(barStyle = "swoopDown"): 
		endImgs[0] = barEnd[0];
		endImgs[1] = barEnd[1];
	break
	case(barStyle = "swoopUp"): 
		endImgs[0] = barEnd[2];
		endImgs[1] = barEnd[3];
	break
	case(barStyle = "leanLeft"): 
		endImgs[0] = barEnd[2];
		endImgs[1] = barEnd[1];
	break
	case(barStyle = "leanRight"): 
		endImgs[0] = barEnd[0];
		endImgs[1] = barEnd[3];
	break
	case(barStyle = "crissCross"): 
		endImgs[0] = barEnd[4];
		endImgs[1] = barEnd[5];
	break								
	default:  // default will be "plain"
		endImgs[0] = barEnd[6];
		endImgs[1] = barEnd[7];
	break
	}
	
	////////////////////////////////////////////////
	
	// Check to see if nothing was input into the function for the header text.
	// If nothing was entered as headerTxt in function call make sure it is blank...
	if (headerTxt == null)
	{
		headerTxt = "";
	}
	
	// Construct the HTML to be written to the page:
	var hdrBar = "<TABLE width='100%' HEIGHT='" + barImgsH + "' border='0' cellpadding='0' cellspacing='0'>" ;
		hdrBar += "<TR>";
			hdrBar += "<TD width='" + leftImgW + "' HEIGHT='" + barImgsH + "' BACKGROUND='" + imgLoc + endImgs[0] + "'><IMG SRC='" + imgLoc + spacerImg + "'></TD>";
			hdrBar += "<TD Class='CellHdrTxt' HEIGHT='" + barImgsH + "' ALIGN='LEFT' BACKGROUND='" + imgLoc + "tblHeader_Center.gif'>";
				hdrBar += "<IMG SRC='" + imgLoc + spacerImg + "' ALIGN='LEFT'>";
				hdrBar += headerTxt;
			hdrBar += "</TD>";
			hdrBar += "<TD width='" + rightImgW + "' HEIGHT='" + barImgsH + "' BACKGROUND='" + imgLoc + endImgs[1] + "'><IMG SRC='" + imgLoc + spacerImg + "'></TD>";
		hdrBar += "<TR>";
	hdrBar += "</TABLE>";
	
	// Write the HTML to the page.
	document.write(hdrBar);
	
}
