/*******************************************************************************************************************
TABLE.JS


UPDATES:
09 August, 2003	16:05:40
29 September, 2003    23:44:57
15 May, 2004	21:23:02
30 July, 2004	22:34:32
05 August, 2004	21:36:53
07 August, 2004
10 August, 2004	23:53:58
12 August, 2004	21:35:39
12 September, 2004	21:47:37
14 September, 2004	22:44:53
01 July, 2004  15:05:00

THESE FUNCTIONS THAT FOLLOW ARE DESIGNED TO LAYOUT THE ENTIRE PAGE OF THE TABLE FOR MOST EVERY MAJOR PAGE ON WEBSITE. 
THE getMenu() FUNCTION IS PLACED FIRST FOR EASY EDITING.
EDITING ANY OF THESE FUNCTIONS CAN RESULT IN FAILURE TO PROPERLY LOAD THE WEBSITE! EXERCISE CAUTION
WHEN EDITING THESE FUNCTIONS.

*******************************************************************************************************************/

/*******************************************************************************************************************
Function getMenu()
This function lays out the menu panel in a menu cell on the left side of the screen.
*******************************************************************************************************************/

function getMenu()
{
	document.write("<a href='index.html' class='menutopic' target='_top'>HOME</a>")
	document.write("<BR>")
	document.write("<BR>")	//put this after each "major" section
/*
	document.write("<a href='news/July_2008_Newsletter.DOC' class='menutopic' target='_top'>July Newsletter</a>")
	document.write("<BR>")
	document.write("<BR>")
	
	document.write("<a href='2008 Calendar.html' class='menutopic' target='_top'>2008 Calendar Of Events</a>")
	document.write("<BR>")
	document.write("<BR>")
	
	document.write("<a href='2009%20Calendar.html' class='menutopic' target='_top'>2009 Calendar Of Events</a>")
	document.write("<BR>")
	document.write("<BR>")
	
	document.write("<a href='2009 BCMG Training Class.html' class='menutopic' target='_top'>2009 BCMGA Training Class</a>")
	document.write("<BR>")
	document.write("<BR>")

	document.write("<a href='earthKind.html' class='menutopic' target='_top'>EarthKind</a>")
	document.write("<BR>")
	document.write("<BR>")
	
	document.write("<a href='enablingGarden.html' class='menutopic' target='_top'>Enabling Garden</a>")
	document.write("<BR>")
	document.write("<BR>")

	document.write("<a href='demoEducationStation.html' class='menutopic' target='_top'>Education Station</a>")
	document.write("<BR>")
	document.write("<BR>")
	
	document.write("<a href='citrusFruitCentral.html' class='menutopic' target='_top'>Citrus & Fruit Central</a>")
	document.write("<BR>")
	document.write("<BR>")


	document.write("<a href='general/2008/2008 Weather Station.html' class='menutopic' target='_top'>Weather Station</a>")
	document.write("<BR>")
	document.write("<BR>")
	
	
	document.write("<a href='Alerts.html' class='menutopic' target='_top'>Alerts</a>")
	document.write("<BR>")
	document.write("<BR>")

	
		
	document.write("<SPAN class='menutopic'>Programs</SPAN>") 
	document.write("<a href='programs.html' class='menulinks' target='_top'><SPAN class='menutopic'>Programs</SPAN>")
	document.write("<BR>")
		
		document.write("<a href='juniorMG.html' class='menulinks' target='_top'>Junior Master Gardener</a>")
		document.write("<BR>")
		document.write("<BR>")
		document.write("<a href='constructionPage.html' class='menulinks' target='_top'>Habitat For Humanity</a>")
		document.write("<BR>")
		document.write("<BR>")
		document.write("<a href='SpeakersBureau.html' class='menulinks' target='_top'>Speakers Bureau</a>")
		document.write("<BR>")
		document.write("<BR>")
		document.write("<a href='InformationHelpDesk.html' class='menulinks' target='_top'>Information Help Desk</a>")
		document.write("<BR>")
		document.write("<BR>")
		
		
/*    Need to update
		
	document.write("<SPAN class='menutopic'>Projects</SPAN>")
		document.write("<BR>")
		document.write("<a href='demoGardens.html' class='menulinks' target='_top'>Demo Gardens</a>")

		document.write("<BR>")

		document.write("<a href='openhouse.html' class='menulinks' target='_top'>Open House</a>")
		document.write("<BR>")
		document.write("<a href='plantsale.html' class='menulinks' target='_top'>Plant Sale</a>")
		document.write("<BR>")
		document.write("<a href='openhouse.html' class='menulinks' target='_top'>Veggie Show</a>")
		document.write("<BR>")
		document.write("<a href='openhouse.html' class='menulinks' target='_top'>Farmers Mkt</a>")
		document.write("<BR>")
		document.write("<a href='Fruitsale.html' class='menulinks' target='_top'>Fruit Sale</a>")
		document.write("<BR>")
*/
/*		document.write("<a href='jmg.html' class='menulinks' target='_top'>JMGs</a>")
		document.write("<BR>")
		document.write("<a href='workshops.html' class='menulinks' target='_top'>Workshops</a>")
		document.write("<BR>")

	document.write("<BR>")
	
*/
	

	/*document.write("<SPAN class='menutopic' target='_top'>Gardening Help</SPAN>")
		document.write("<BR>")
		document.write("<a href='articles.html' class='menulinks' target='_top'>Articles</a>")
		document.write("<BR>")
/*		document.write("<a href='gardenhelp.html' class='menulinks' target='_top'>Garden Help</a>")
		document.write("<BR>")
		document.write("<a href='links.html' class='menulinks' target='_top'>Links</a>")
		document.write("<BR>")

	document.write("<BR>")

/*	document.write("<a href='photos.html' class='menutopic' target='_top'>Photo Gallery</a>")
		document.write("<BR>")

	document.write("<BR>")
*/

/*	document.write("<SPAN class='menutopic'>Archives</SPAN>") 
	document.write("<a href='programs.html' class='menulinks' target='_top'><SPAN class='menutopic'>Programs</SPAN>")
	document.write("<BR>")

	document.write("<a href='archive.html' class='menulinks' target='_top'>Newsletters</a>")
	document.write("<BR>")
	document.write("<BR>")
	
	document.write("<a href='2006 Calendar.html' class='menulinks' target='_top'>2006 Calendar</a>")
	document.write("<BR>")
	document.write("<a href='2007 Calendar.html' class='menulinks' target='_top'>2007 Calendar</a>")
	document.write("<BR>")
	document.write("<BR>")
	
	document.write("<a href='2007 MG Training.html' class='menulinks' target='_top'>2007 BCMGA Training Class</a>")
	document.write("<BR>")
	document.write("<BR>")

/*	document.write("<a href='mgstuff.html' class='menutopic' target='_top'>For BCMGs</a>")
		document.write("<BR>")

	document.write("<BR>")

	document.write("<a href='contacts.html' class='menutopic' target='_top'>Contacts & Map</a>")
	document.write("<BR>")
*/

}

/*******************************************************************************************************************
function detectBrowser()

The purpose is to detect if the user is using a Mozilla/Netscape browser. If yes, then the mozilla_style.css file is 
loaded in. As this website was designed with the MS Explorer user in mind, we will tweak that file for use with Mozilla
browsers in the file name below. The mainstyle.css is loaded no matter what browser is being used.
*******************************************************************************************************************/


function detectBrowser()
{
	if(navigator.appName == "Netscape")
	{
		document.write("<LINK href='mozilla_style.css' rel='stylesheet' type='text/css'>")
	}
}



/*******************************************************************************************************************
function getMail(name,dom,linktext,sub,hyper)


This little function will help for security of the eMail address that appear on the website. Though not necessarily 
full-proof (or foolproof?), it does offer an obstacle. This is to protect the eMail address from spiders on the web 
do crawl around source codes for webpages and copy down internet address for their huge banks of eMail addresses, for
spamming purposes. You don't have to use this code, but it's one less block in the road against spam. Usually, these
spiders cannot read scripting.

Here's a quick overview of how this works:

Using the function: Let's say we use the function, paste where you want to add it:
						<SCRIPT>getMail("","","","","")</SCRIPT>
	(Assuming the page defaults to JavaScript.) This will send an eMail to the default values.
	Change these as necessary. 

	DON'T DELETE ANY OF THE DOUBLE QUOTES!!!

	Let's assume that we are sending an eMail to the starhopper@tcu.edu .
	In our example, the function would be entered:
				<SCRIPT>getMail("starhopper","tcu","email","Cool site!","")</SCRIPT>	
	The first two parameters are self explanatory. The user will click the eMail address, and 
	the subject line of the eMail will be "Cool site!".

BE SURE THE DEFAULT VALUES AT THE BEGINNING OF THE FUNCTION ARE FILLED!!!

The names of the parameters above are as follows:

name =  the name of the person who is being eMailed
	In our example, the name parameter is assigned a value of "starhopper". If this is left blank "", or 
	"webmaster"	is entered, it goes to the webmaster by default.

dom = domain of the eMail address
	In our example, the domain is "tcu.edu". If This is left blank, or "", the default domain, domDefault, 
	will apply.

linktext = text that user sees when he 'clicks' on it
	You can enter text into the "". If you type "email" or "eMail", the text will be the eMail address of the 
	recipient. Type "emailw" for the text to show the "eMail" plus the eMail address.
	If you do not fill the "", a default text will appear, whatever is assigned to the variable 
	linkTextDefault.
	Note: You must have linkText filled, either when you call the function, or at the linkTextDefault 
	(it is wise to fill the latter).

sub = when the user's eMail appears, this text will appear in the subject line, when applicable
	The line that appears in the subject line when the user's eMail starts. You can enter this in as a parameter
	when you call getMail(), use the subDefault bye leaving the paramter in the function as "", or if you desire 
	no link text type "none" for the sub parameter when you call the function.

hyper = whether the text the user sees is a hyperlink
	This allow the text the user sees to appear as a hyper link that the user clicks on. It defaults to a hyper-
	link, as per the hyperDefault variable, when the value in the function is a blank "" or "true". If you don't 
	want the link to be a hyperlink, type "false" where you call the function.

BE SURE THE DEFAULT VALUES AT THE BEGINNING OF THE FUNCTION ARE FILLED!!!

!!!!DON'T DELETE QUOTATION MARKS FROM WHEN YOU CALL THE FUNCTION!!!!
*******************************************************************************************************************/

function getMail(name,dom,linktext,sub,hyper)
{	


	//set defaults for the following 5 values; don't change names of variables!!!

	webmaster = "brazoria-tx"			//webmaster account
	domDefault = "tamu.edu"				//default domain
	linkTextDefault = "email"			//default text to select link
	subDefault = "Brazoria Master Gardeners"	//default subject line
	hyperDefault = "true"				//default "true" to make hyperlink;DO NOT CHANGE!



	//DO NOT TAMPER WITH BELOW CODES!!!

	//set the addressee, if needed
	if((name.length == 0)||(name == "webmaster"))
	{
		name=webmaster
	}


	//set the domain of the addressee; go to domDefault as necessary
	if(dom.length == 0)
	{
		dom = domDefault
	}else
		dom = dom

	//create the eMail address
	link = name + "@" + dom


	//set a default subject line for eMail, this doesn't necessarily apply for all eMail services
	if(sub == "none")
	{
		sub = ""
	}else	
	if(sub.length == 0)
	{
		sub = subDefault
	}else
		sub = sub


	//set default linktext (text that user clicks on)
	if(linktext.length == 0)
	{
		linktext = linkTextDefault
	}
	if((linktext == "email")||(linktext == "eMail"))
	{
		linktext = link
	}
	if(linktext == "emailw")
	{
		linktext = "eMail "+link
	}else
	{
		linktext = linktext
	}

	
	//this will print the information into the webpage!!!
	if((hyper == "true")||(hyper.length == 0))
	{
		//The upper line includes a subject, the lower line deletes it.
		//The lower line works w/ Outlook Express & Mozilla Thuderbird!
//		document.write("<a href='mailto:"+link+"?subject="+sub+"'>"+linktext+"</a>")
		document.write("<a href='mailto:"+link+"'>"+linktext+"</a>")

	}else
	if(hyper == "false")
	{
		document.write(link)
	}
}


/*******************************************************************************************************************
function openTable(pic,description)

This function lays out the overall design of the pages that link it. The two parameters in the parentheses are the
filename and description for the little picture in the upper left hand corner. The picture should be no larger than 
100px across by 84px high. The description should be brief, and may include parentheses () or square brackets []. 
When listed in the parameters, on the webpage you should see something of the form 
	
	openTable("images/logo_small.bmp","Master Gardener Logo [small]")

This is an appropriate way to open the page. Note that the pic's filename is listed in double quotations " ". 
The description is also listed in double quotations, though a separate set. The name of the file and the description
MUST appear with quotations to do so! Failure to do so will result in failure in layint out the page on the computer's
part. Double quotations may only appear around the filename or description and may NOT be part. If it is necessary to 
include some quotation mechanism in the parameters, use single quotes. I recommend not using any quotation at all, 
if avoidable. 

Furthermore, even though it might be possible to leave no parameters, it is not recommended to. The first little section
of code, in the conditional if-statement, will provide for NO parameters in the openTable function, when the parentheses
are left blank. Don't rely on it always working! As a rule, follow the form as shown in the example above for 
the parameters of the picture. The function starts by assigning values for the blank parameters. (The || means "or".)

Afterwards, the table begins laying out. This is just HTML inserted into JavaScript functions. Double quotations may
not appear in the document.write() functions, except at the very beginning and very end. If quotes are needed within, 
use the single quote. Failure to do this properly will cause the page to draw an error! 

The logo, BCMGA appear in their own individual DIV tags; these span the width of the cell. The menu follows, taking the
rest of the cell downward. A divider cell is to the right, and it is very narrow. The content of the page appears in the
"content" cell, and this is drawn from the webpage itself, such as "index.html". After the content is filled in by the 
webpage, that page calls the endTable() function (see below). NOTHING may appear after the last line of this function!
*******************************************************************************************************************/

function openTable(pic,description)
{
	/*first, if the openTable function is called and there exists no picture OR no description elements in the
		parameters, set them to the default as stated below! This will not work if a picture is misplaced!*/
	if((!pic)||(!description))
	{
		pic = "images/logo_small.bmp"
		description = "Master Gardener Logo [small]"
	}

	//begin making the table layout
	document.write("<TABLE class='layout' cellspacing=0>")

		document.write("<TR>")	
			document.write("<TD class='menu'>")

				//insert picture, depending on page, and description
				document.write("<DIV id='pixcell'><BR>")
				document.write("<IMG src='"+pic+"' title='"+description+"'>")
				document.write("</DIV>")

				//BCMGA intitals under picture
				document.write("<DIV id='initials'>BCMGA</DIV>")
				
				//begins building menu section
				document.write("<BR>")
				document.write("<DIV id='menuPadding'>")
				getMenu()
				document.write("</DIV>")
			document.write("</TD>")
			//close menu cell
		
			//the divider cell, which may be dropped down the page		
			document.write("<TD class='divider'></TD>")

			//open content cell, where the "text" appears
			document.write("<TD class='content'>")
			//text inserted here by individual web pages
			//DO NOT ADD ANY NEW CONTENT HERE!!!!
}





/*******************************************************************************************************************
function endTable()

This function simply closes the table layout design. First it ends the content cell. Then it ends the row (the page is
layed out in a table of one row. Then it closes the table. Editing need not be done to this function.
*******************************************************************************************************************/

function endTable()
{	
			//close content cell
			document.write("</TD>")

		//close the 1 row table layout, and then the table
		document.write("</TR>")
	document.write("</TABLE>")
	//ends table
	//DO NOT ADD ANY NEW CONTENT HERE!!!!
}





//////////////////////IMAGES CODE BEGIN\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

/***********************************************************************
function addpic(thumb,img,note)

addpic() will add thumbnail images that, when clicked, will open another
image in its own window. When the user hovers the cursor over the thumbnail
a note will appear over the image.

Suppose we want to add a picture of a duck! We have a thumbnail "duck_little"
and a large image "duck_big", and a comment or note "this is a duck!". The
line inserted where we want the duck to appear is:

		addpic("duck_little.pic","duck_big.pic","this is a duck!")

Pictures are added using this function just like typing in the <img> tags
between the anchor tags. Lastly, to insert quotes into the note (if desired)
you must write a backslash preceeding the quotation mark that will appear in
the text box. For example, "I like traffic lights!" would be entered:
				"\"I like traffic lights!\""

DO NOT EDIT THE BELOW LINES OF CODE!!!
***********************************************************************/



function addpic(thumb,img,note)
{
	//create hyperlink
	hyperlink="<a href='javascript:showPic(\"" +img+ "\")'>"
	document.write(hyperlink)

	if((!note)||(note.length = 0))
	{
		note = ""
	}

	//display the image in the webpage
	showImg="<img src='"+thumb+"' border='0' name="+img+" title='"+note+"' align='left'>"
	document.write(showImg)

	//close hyperlink
	document.write("</a>")
}

function showPic(img)
{
	//get size of image, requires declaring the image is an image!
	var pic = new Image();
	pic.src = img
	x=pic.width
	y=pic.height
	
	xWidth=parseInt(x)
	yHeight=parseInt(y)

	//dimensions = "width=" +xWidth+ ",height=" +yHeight
	//document.write(dimensions)

	picWindow = window.open(img, "picWin", "width=500,height=500,resizable=yes")
	picWindow.focus()
	
	//x=0
	//y=0
	//dimensions=""
}

////////////////////////END IMAGES CODE\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

