/***********************************************************************************
 * @Name	buttons.js
 * @author 	Kris Kline
 * 
 * @Purpose	This script handles putting the buttons onto the page (the ones for
 *		each page, and the ones just for county pages)
 * 
 * Date Created:	18 FEB 2003
 * Date Modified:	18 FEB 2003
 **********************************************************************************/

var STR_MAP_COMMENT_CLASS="mapComments";
var STR_MAP_INFO_CLASS="mapInfo";

var N_NUM_BUTTONS_MAIN=3;

var N_NUM_BOTTONS_MAIN_DATA=2;
var N_BUTTONS_MAIN_DATA_NAME=0;
var N_BUTTONS_MAIN_DATA_ADDR=1;

var N_BUTTONS_MAIN_WIDTH=160;

var arrButtonsMain=new Array(N_NUM_BUTTONS_MAIN);

arrButtonsMain[0] = new Array(2);
arrButtonsMain[0][N_BUTTONS_MAIN_DATA_NAME]="Median Flow Report";
arrButtonsMain[0][N_BUTTONS_MAIN_DATA_ADDR]=
		"http://ks.water.usgs.gov/Kansas/pubs/reports/wrir.02-4292.html";

arrButtonsMain[1] = new Array(2);
arrButtonsMain[1][N_BUTTONS_MAIN_DATA_NAME]="All Available Hydrology" +
						"<BR>Median Values";
arrButtonsMain[1][N_BUTTONS_MAIN_DATA_ADDR]="index.php?test=AAH";

arrButtonsMain[2] = new Array(2);
arrButtonsMain[2][N_BUTTONS_MAIN_DATA_NAME]="Flood Frequency Report";
arrButtonsMain[2][N_BUTTONS_MAIN_DATA_ADDR]=
		"http://ks.water.usgs.gov/Kansas/pubs/reports/wrir.00-4079.html";


/*********************************************************************
 * @Function	putButtonsTop
 * @Script	buttons.js
 * @author 	Kris Kline
 *
 * This method puts the buttons onto the page
 *
 * @param bState	true if this is for the state, false if county
 ********************************************************************/
function putButtonsTop(bState)
{
	document.writeln("<TABLE>");

	if(!bState)
	{
		document.writeln("<TR>");
		document.writeln("	<TD" +
					" ALIGN=CENTER>");
    		document.write  (	"&nbsp;&nbsp;");
		document.write  (	"<A HREF=\"ks/index.php\" >" + 
				 	"Return To State Map" + 
				 	"</A>");
		document.write	(	"&nbsp;&nbsp;");
		document.writeln("	</TD>");
		document.writeln("</TR>");
	} // if(strCnty!="ks")

	document.writeln("<TR>");
	document.writeln("	<TD>");
	document.writeln("	&nbsp;");
	document.writeln("	</TD>");
	document.writeln("</TR>");

	document.writeln("<TR>");
	document.write  ("	<TD" +
				" ALIGN=CENTER>");
	document.write	(	"&nbsp;&nbsp;");
	document.write	(	"<A HREF=\"explanation.html\">" + 
				"<img src='studies/strmstats/ks/glossary_first.gif' border='0'>" +
				"</A>");
	document.writeln(	"&nbsp;&nbsp;");
	document.writeln("	</TD>");
	document.writeln("</TR>");

	document.writeln("</TABLE>");

} // putButtonsTop


/*********************************************************************
 * @Function	putButtonsMainSpaceRow
 * @Script	buttons.js
 * @author 	Kris Kline
 *
 * This method puts the main buttons' spacing row onto the page
 *
 * @param nHeight	The height of the row
 * @param nSpan		The number of columns in the row
 ********************************************************************/
function putButtonsMainSpaceRow(nHeight, nSpan)
{
	document.writeln("<TR>");
	document.writeln("	<TD" +
				" HEIGHT=" + nHeight +
				" ALIGN=CENTER" + 
				" COLSPAN=" + nSpan +
				">");
	document.writeln("	&nbsp;");
	document.writeln("	</TD>");
	document.writeln("</TR>");
} //  putButtonsMainSpaceRow


/*********************************************************************
 * @Function	putButtonsMainSpaceCell
 * @Script	buttons.js
 * @author 	Kris Kline
 *
 * This method puts the main buttons' spacing cell onto the table
 *
 * @param nWidth	The width of the row
 ********************************************************************/
function putButtonsMainSpaceCell(nWidth)
{
	document.writeln("<TD" +
			 " WIDTH=" + nWidth +
			 " ALIGN=CENTER" +
			 ">");
	document.writeln("</TD>");
} //  putButtonsMainSpaceCell


/*********************************************************************
 * @Function	putButtonsMain
 * @Script	buttons.js
 * @author 	Kris Kline
 *
 * This method puts the buttons onto the page
 *
 * @param strCnty	The county name
 ********************************************************************/
function putButtonsMain(strCnty)
{
	document.writeln("<TABLE" +
			 " BORDER=0" +
			 " CELLPADDING=0" +  
			 " CELLSPACING=0" + 
			 ">");
	
	//putButtonsMainSpaceRow(50, N_NUM_BUTTONS_MAIN * 2 - 1);

	document.writeln("	<TR>");

	for(var x=0; x<N_NUM_BUTTONS_MAIN && x<arrButtonsMain.length; x++)
	{
		document.writeln("<TD"+
				 " WIDTH=" + N_BUTTONS_MAIN_WIDTH +
				 " ALIGN=CENTER" +
				 ">");
		
		document.writeln("<FONT" +
				 ">" +
				 "<B>");

		document.writeln("<A" +
				 " HREF=\"" + arrButtonsMain[x][N_BUTTONS_MAIN_DATA_ADDR] + "\"" + 
				 ">" +
				 arrButtonsMain[x][N_BUTTONS_MAIN_DATA_NAME] +
				 "</A>");

		document.writeln("</B>" +
				 "</FONT>");

		document.writeln("</TD>");

		if(x+1<N_NUM_BUTTONS_MAIN)
			putButtonsMainSpaceCell(50);
	}

	document.writeln("	</TR>");

	putButtonsMainSpaceRow(50, N_NUM_BUTTONS_MAIN * 2 - 1);

	document.writeln("</TABLE>");

} // putButtonsMain


/*********************************************************************
 * @Function	putButtons
 * @Script	buttons.js
 * @author 	Kris Kline
 *
 * This method puts all of the buttons onto the page
 *
 * @param bState	true if this is for the state, false if county
 * @param strTest	The current test
 * @param strDir	The current directory
 ********************************************************************/
function putButtons(bState,strTest,strDir)
{

	document.writeln("<CENTER>");
	
	putButtonsTop(bState);

	document.writeln("<BR>");

	putButtonsMain( );

	document.writeln("</CENTER>");
	
} // putButtons