/***********************************************************************************
 * @Name	header.js
 * 
 * @Purpose	This script handles putting the header onto the page
 * 
 * Date Created:	31 JAN 2003
 * Date Modified:	31 JAN 2003
 **********************************************************************************/

init_array=14;
init_pics=1;
var www_usgs_home = "http://www.usgs.gov";
var www_kswrd_home = "http://ks.water.usgs.gov/index.shtml";
var www_125_years = "http://www.usgs.gov/125/";

var the_server=document.URL;
	var str_pos=the_server.indexOf("ks.water.usgs.gov");
	the_server=the_server.substring(0,str_pos)+"ks.water.usgs.gov/";

var strHeaderColors = new Array(init_pics);

var imgHeaders = new Array(init_pics);
var imgSpacer=the_server + "Kansas/pics/banners/header_graphic_spacer.gif";
var imgUSGS=the_server + "Kansas/pics/banners/header_graphic_usgsIdentifier_white.jpg";
imgHeaders[0]=the_server + "Kansas/pics/banners/ks.ban.2005.jpg";		// Home
img125years =the_server + "Kansas/pics/banners/B1_7.5.jpg";                // 125 year banner


strHeaderColors[0]="000000"; //"006633";


var strHeaderColorsSelected = new Array(init_pics);

strHeaderColorsSelected[0]="006633"; //"99FFCC"; 


var STR_HEADER_BUTTON_DIR=the_server + "Kansas/pics/menu/";
var STR_HEADER_BUTTON="bar_";
var STR_HEADER_BUTTON_EXT="gif";

var N_HEADER_BUTTON_H = 24;			// The height for the header buttons

var arrHeaderButtonImages;

/****************************************************************************************
 * @Function	preloadHeaderButtons
 * @Script	header.js
 *
 * This method preloads the header button pictures, for better performance
 *
 ***************************************************************************************/
function preloadHeaderButtons()
{      
	arrHeaderButtonImages=new Array(init_array);

	for(x=0; x<init_array; x++)  
	{
            
		
			arrHeaderButtonImages[x]=new Image( );

         			
			arrHeaderButtonImages[x].src = 		STR_HEADER_BUTTON_DIR
												+ STR_HEADER_BUTTON
												+ eval(x)
												+ "."
   												+ STR_HEADER_BUTTON_EXT;
	      
	}
	
} // preloadHeaderButtons


preloadHeaderButtons(0);


/****************************************************************************************
 * @Function	isValidTab
 * @Script	header.js
 *
 * This method checks to see if the tab number is a valid tab number
 *
 * @param nTab		The tab number
 * @return True if it is a valid tab number, false otherwise
 ***************************************************************************************/
function isValidTab(nTab)
{
	if( nTab>=0 &&
		nTab<init_array
		)
		return true;
	else
		return false;
} // isValidTab









/****************************************************************************************
 * @Function	putContentTable
 * @Script	header.js
 *
 * This method puts the content table onto the page
 *
 * @param nTab		The tab number for the current page
 ***************************************************************************************/
function putContentTable(nTab,nSidePan,space)
{
	
	document.writeln("<TABLE" +
						" CELLPADDING=0" +
						" CELLSPACING=0" +
						" BORDER=0" +
						" WIDTH=100%" + //866 
						">");


    	document.writeln("	<TR>");


	document.writeln("<TD" +
						" VALIGN=TOP" +
						" ALIGN=LEFT" +
                                                " height=4" +
                                                " WIDTH=100%" +
                                                " BGCOLOR=#FFFFFF"  +             //" BGCOLOR=#F7F7F1" +
                                                " class=extreemsmall" +
						">");

	document.writeln("</TD>");
        document.writeln("</TR>");
      document.writeln("</TABLE>");
} // putContentTable


/****************************************************************************************
 * @Function	setupHeaderTabTable
 * @Script	header.js
 *
 * This method sets up the header tabs table
 *
 * @param nCols		The number of clumns for the header tab table
 * @param nTab		The tab number for the current page
 ***************************************************************************************/
function setupHeaderTabTable(nCols, nTab)
{
	document.writeln("<TABLE" +
						" CELLPADDING=0" +
						" CELLSPACING=0" +
						" BORDER=0" +
                                                " WIDTH=100%" + /* lets menu stretch */
						" BGCOLOR=#" + strHeaderColorsSelected[0] + /*nTab*/
                                                
						" WIDTH=608" +
						">");
						
} // setupHeaderTabTable


/****************************************************************************************
 * @Function	putHeaderTabTableSpaceRow
 * @Script	header.js
 *
 * This method puts the spacing row into the header tab table
 *
 * @param nCols		The number of columns for the header tab table
 ***************************************************************************************/



/****************************************************************************************
 * @Function	putHeaderTabSelectedTab
 * @Script	header.js
 *
 * This method puts the selected tab cell into the table
 *
 * @param nTab		The selected tab number
 ***************************************************************************************/
function putHeaderTabSelectedTab(nTab)
{
	document.write  ("<TD" +
						" BGCOLOR=#" + strHeaderColorsSelected[0] +/* nTab*/
						
                                                " WIDTH=100%" +
						" ALIGN=center" +
						">");
if (nTab > 10)
{
document.write ("<img" +
						" src=\"" +     
								STR_HEADER_BUTTON_DIR +
								STR_HEADER_BUTTON +
								nTab +
								"." +
								STR_HEADER_BUTTON_EXT +
								"\"" + 



"WIDTH=608 HEIGHT=" + N_HEADER_BUTTON_H + " BORDER=0 ALT=\"\" USEMAP=\"#menu_Map\">");
document.write ("<MAP NAME=\"menu_Map\">"); 
document.write ("<AREA SHAPE=\"poly\" ALT=\"Ground-Water\" COORDS=\"236,24, 377,24, 518,23, 659,23, 659,0, 521,0, 384,1, 246,1, 236,24\" HREF=\"" + the_server + "Kansas/ground-water.html" + "\" >");
document.write ("<AREA SHAPE=\"poly\" ALT=\"Water-Quality\" COORDS=\"146,24, 231,23, 242,0, 157,0, 146,24\" HREF=\"" + the_server + "Kansas/water-quality.html" + "\" >");
document.write ("<AREA SHAPE=\"poly\" ALT=\"Surface-Water\" COORDS=\"51,23, 141,23, 152,1, 62,0, 51,23\" HREF=\"" + the_server + "Kansas/surface-water.html" + "\" >");
document.write ("<AREA SHAPE=\"poly\" ALT=\"Home\" COORDS=\"0,23, 47,23, 57,0, 0,1, 0,23\" HREF=\"" + the_server + "index.shtml" + "\" >" +
"</MAP>");
}
else
{
document.write ("<img" +
						" src=\"" +     
								STR_HEADER_BUTTON_DIR +
								STR_HEADER_BUTTON +
								nTab +
								"." +
								STR_HEADER_BUTTON_EXT +
								"\"" + 
"WIDTH=608 HEIGHT=" + N_HEADER_BUTTON_H + " BORDER=0 ALT=\"\" USEMAP=\"#menu_Map\">");
document.write ("<MAP NAME=\"menu_Map\">");

document.write ("<AREA SHAPE=\"poly\" title=\"Search\" ALT=\"Search\" COORDS=\"551,24, 608,23, 608,0, 561,1, 551,24\" HREF=\"" + the_server + "Kansas/search.html" + "\" >");
document.write ("<AREA SHAPE=\"poly\" title=\"About Us\" ALT=\"About Us\" COORDS=\"482,24, 548,23, 559,0, 493,0, 482,24\" HREF=\"" + the_server + "Kansas/about.html" + "\" >");
document.write ("<AREA SHAPE=\"poly\" title=\"Education\" ALT=\"Education\" COORDS=\"414,23, 480,24, 491,0, 425,0, 414,23\" HREF=\"" + the_server + "Kansas/education.html" + "\" >");
document.write ("<AREA SHAPE=\"poly\" title=\"Publication\" ALT=\"Publication\" COORDS=\"326,23, 411,23, 422,0, 336,0, 326,23\" HREF=\"" + the_server + "Kansas/pubs.html" + "\" >");
document.write ("<AREA SHAPE=\"poly\" title=\"Research Lab\" ALT=\"Research Lab\" COORDS=\"238,24, 323,23, 334,0, 249,0, 238,24\" HREF=\"" + the_server + "Kansas/researchlab.html" + "\" >");
document.write ("<AREA SHAPE=\"poly\" title=\"Studies\" ALT=\"Studies\" COORDS=\"125,23, 236,23, 246,1, 136,0, 125,23\" HREF=\"" + the_server + "Kansas/studies.html" + "\" >");
document.write ("<AREA SHAPE=\"poly\" title=\"Water Data\" ALT=\"Water Data\" COORDS=\"50,24, 123,24, 133,1, 60,1, 50,24\" HREF=\"" + the_server + "Kansas/waterdata.html" + "\" >");
document.write ("<AREA SHAPE=\"poly\" title=\"Home\" ALT=\"Home\" COORDS=\"0,23, 47,23, 57,0, 0,1, 0,23\" HREF=\"" + the_server + "index.shtml"  + "\" >" +
"</MAP>");
}
                      									
	document.writeln("</TD>");

} // putHeaderTabSelectedTab



/****************************************************************************************
 * @Function	putHeaderTabTableTabRow
 * @Script	header.js
 *
 * This method puts the tab row into the tab table
 *
 * @param nTab		The tab number for the current page
 ***************************************************************************************/
function putHeaderTabTableTabRow(nTab,menu)
{


	document.writeln("<TR>");
	
	
              if(nTab<14)
		{
//alert(nTab);		
		 putHeaderTabSelectedTab(nTab);
			
		}
	
	document.writeln("</TR>");
	
} // putHeaderTabTableTabRow


/****************************************************************************************
 * @Function	putHeaderTabs
 * @Script	header.js
 *
 * This method puts the header tabs onto the page
 *
 * @param nTab		The tab number for the current page
 ***************************************************************************************/
function putHeaderTabs(nTab,menu)
{



	var numColumns=(init_pics)

	
	setupHeaderTabTable(numColumns, nTab);
	
	putHeaderTabTableTabRow(nTab,menu);

	document.writeln("</TABLE>");
} // putHeaderTabs


/****************************************************************************************
 * @Function	putHeaderTop
 * @Script	header.js
 *
 * This method puts the top of the header onto the page
 *
 * @param nTab		The tab number for the current page
 ***************************************************************************************/
function putHeaderTop(nTab)
{
<!-- BEGIN USGS Header Template -->
	document.writeln("<TABLE" +             
                                                " WIDTH=100%" + //660 
                                                " BORDER=0" +
						" CELLSPACING=0" +
						" CELLPADDING=0" +
						">");
	
	document.writeln("<TR>");



	document.writeln("<TD>");
 
	document.writeln("<TABLE" +             
                                                " WIDTH=100%" + 
                                                " BORDER=0" +
						" CELLSPACING=0" +
						" CELLPADDING=0" +
						">");	
       document.writeln("<tr>");
       document.writeln("<td" +
                                                " width=178" + 
                                                " align=\"left\">");
       document.write("<a href=\"http://www.usgs.gov\" target=\"_blank\">");
       document.write("<img " +         
                                                " src=\"" + imgUSGS + "\"" +
                                                " alt=\"Link to USGS home page.\"" +
                                                " width=178" +
                                                " height=72" +
                                                " border=0></a></td>");
       document.writeln("<td width=100% class=banner>");
       document.writeln("<TABLE" +             
                                                " WIDTH=150" + 
                                                " BORDER=0" +
                                                " align=\"right\"" +
						" CELLSPACING=0" +
						" CELLPADDING=0" +
						" class=ccsa>");	

       document.writeln("<tr class=ccsa>");

       document.writeln("<td><img" +
                                                        " src=\"" + imgSpacer + "\"" +
                                                        " width=1" +
                                                        " height=72" +
                                                        " alt=\"\"></td>");
       document.writeln("<td><a" + 
                                                        " href=\"http://www.usgs.gov\"" +
                                                        " target=\"_blank\"" +
                                                        " class=ccsa>USGS Home</a><br>");
       document.writeln("<a" +
                                                        " href=\"http://www.usgs.gov/ask/index.html\"" +
                                                        " target=\"_blank\""+
                                                       " class=ccsa>Contact USGS</a><br>");
       document.writeln("<a" +                         
                                                        " href=\"http://www.usgs.gov/search\"" + 
                                                        " target=\"_blank\"" +
                                                        " class=ccsa>Search USGS</a> </td>");

       document.writeln("</tr>");
       document.writeln("</table>");
       document.writeln("</td>");
       document.writeln("</tr>");
       document.writeln("</table>");
       document.writeln("<img" +                 
                                                        " src=\"" + imgSpacer + "\"" +
                                                        " width=1" +
                                                        " height=1" +
                                                        " alt=\"\"></td>"); 

       document.writeln("</tr>");
       document.writeln("<tr>");
       document.writeln("<td WIDTH=100% HEIGHT=24 class=siteTitle>U.S. Geological Survey Kansas Water Science Center</td>");  
       document.writeln("</tr>");

<!-- END USGS Header Template -->

	document.writeln("	<TR >");
	document.writeln("		<TD" +          " CLASS=extreemsmall" +
							" WIDTH=100%" + 
							" HEIGHT=2" +
							" BGCOLOR=#ffffff"  +             //" BGCOLOR=#F7F7F1" +
							">");
	document.writeln("		</TD>"); 	

	document.writeln("	</TR>");






	document.writeln("</TABLE>");
} // putHeaderTop


/****************************************************************************************
 * @Function	putHeader
 * @Script	header.js
 *
 * This method puts the entire header onto the page
 *
 * @param nTab		The tab number for the current page
 ***************************************************************************************/
function putHeader(nTab,nSidePan,menu,space)
{


	if(!isValidTab(nTab))
		nTab=0;
//alert ntab;	
	putHeaderTop(nTab);
	putHeaderTabs(nTab,menu);
	putContentTable(nTab,nSidePan,space);


} // putHeader

function clickStation(url_default, x, y)
{
   window.document.location = url_default
}

