
var links = new Array();
var texts = new Array();
var iLinks = 0;
var iTexts = 0;
var iLinkBreak = 55;

var iLastSlash = fullpath.lastIndexOf("/");
// go to ".html" so we don't get ?s or #s
var pagename = fullpath.substring(iLastSlash + 1, fullpath.indexOf(".html") + 5);

var submenuroot = "";
var subpath = fullpath.substring(0, iLastSlash);
var parentDir = subpath.substring(subpath.lastIndexOf("/" ) + 1, iLastSlash);
var fileroot = pagename.substring(0, pagename.indexOf("-"))

if (fileroot == "")
	fileroot = pagename.substring(0, pagename.indexOf("."))

	
// ******************************************************************************** \\

// this is used to get out of a frame (like from our own search)
if (top.location != location)
	top.location.href = document.location.href ;

		
// ******************************************************************************** \\

function GetPageTitle()
{
  var strTitle = "Focusing on Agricultural Issues";
  strTitle += "<BR>&nbsp;<SPAN CLASS='subtitle'>";

	if (parentDir == "issue-analysis")
		strTitle += 'Issue Analysis';
	else if(parentDir == "issues")
	{
		if(pagename == "issues.html")
			strTitle += 'Instructional Units';
		else
			strTitle += logoLabel + 'Issues';
	}
	else if(parentDir == "sources")
		strTitle += 'Source &amp; Resource';
	else if(parentDir == "ag-issues-forum")
		strTitle += 'Ag Issues Forum';

   strTitle += "</SPAN>"

   return strTitle;
}

var headerHTML = "";
var logoLabel = "";
var logoImage = "";

if (parentDir == "issues" && fileroot != "issues")
{
	logoLabel = fileroot.substring(0,1).toUpperCase() + fileroot.substring(1) + " ";

	if (logoLabel == "Economy_and_trade ")
		logoLabel = "Economy &amp; Trade ";

	if (logoLabel == "Food_safety ")
		logoLabel = "Food Safety ";
	
	logoImage = fileroot;
}

headerHTML += '<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0" WIDTH="770" BACKGROUND="images/header_bg.gif" BGCOLOR="#7F7F5F">';
headerHTML += '<TR>';
headerHTML += '<TD WIDTH="90"><A HREF="../index.html"><IMG SRC="images/logo_' + logoImage + '.gif" ALT="' + logoLabel + '" TITLE="' + logoLabel + '" WIDTH="80" HEIGHT="80" BORDER="0"></A></TD>';
headerHTML += '<TD CLASS="title" VALIGN="top">&nbsp;' + GetPageTitle() + '</TD>';

headerHTML += '<TD ALIGN="right">';

function CheckSearch()
{
	var box = document.getElementById("q");
	
	if (box.value == "")
		box.value = "site:web.ics.purdue.edu/~peters";

}


headerHTML += '<form action="search-results.html" id="cse-search-box">';
headerHTML += '<input type="hidden" name="cx" value="006223856788046641950:8x29eomto6m" />';
headerHTML += '<input type="hidden" name="cof" value="FORID:9" />';
headerHTML += '<input type="hidden" name="ie" value="UTF-8" />';
headerHTML += '<input type="text" id="q" name="q" size="31" />';
headerHTML += '<input type="submit" name="sa" value="Search" onclick="CheckSearch()" />';
headerHTML += '</form>';
headerHTML += '<scr' + 'ipt type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></scr' + 'ipt>';


headerHTML += '<TABLE width="200"><TR><TD>';

headerHTML += '<TD WIDTH="65" CLASS="utilmenu" VALIGN="bottom" ALIGN="center"><A HREF="javascript:PrintFullPage();">Print Page</A></TD>';
//headerHTML += '<TD WIDTH="85" CLASS="utilmenu" VALIGN="bottom" ALIGN="center"><A HREF="javascript:PrintFullPage();">Print Full Page</A></TD>';
headerHTML += '<TD WIDTH="10" CLASS="utilmenu" VALIGN="bottom" ALIGN="center">|</TD>';
//headerHTML += '<TD WIDTH="110" CLASS="utilmenu" VALIGN="bottom" ALIGN="center"><A HREF="javascript:PrintPageContent();">Print Page Content</A></TD>';
//headerHTML += '<TD WIDTH="10" CLASS="utilmenu" VALIGN="bottom" ALIGN="center">|</TD>';
headerHTML += '<TD WIDTH="55" CLASS="utilmenu" VALIGN="bottom" ALIGN="center"><A HREF="sitemap.html">Sitemap</A>&nbsp;</TD>';
headerHTML += '</TD></TR></TABLE></TD>';

headerHTML += '</TR>';
headerHTML += '</TABLE>';


function PrintFullPage()
{
	window.print();
} 

function PrintPageContent()
{
	document.getElementById('print_hide').style.display = "none"; 
	PrintFullPage(); 
	document.getElementById('print_hide').style.display = "block"; 
} 

// ******************************************************************************** \\

function MakeTable()
{
	var strHREF = "";
	var intBreakPos = 0;

	for (var k=0; k<tabledata.length; k++)
	{
		document.write('<TR BGCOLOR="#FFFFCC">');
		document.write('<TD><B>' + tabledata[k].title + '</B>' + tabledata[k].desc + '</TD>');
	
		if (tabledata[k].href == "")
			document.write('<TD>&nbsp;</TD>');
		else
		{
			strHREF = tabledata[k].href;
			intBreakPos = strHREF.indexOf('<BR>');
			
			// If <BR> is in the HREF, remove it for the URL
			if (intBreakPos > 1)
				strHREF = tabledata[k].href.substring(0,intBreakPos) + tabledata[k].href.substring(intBreakPos + 4);
			
			document.write('<TD WIDTH="50%"><A HREF="' + strHREF + '" TARGET="_blank">' + tabledata[k].href + '</A></TD>');
		
		}
		document.write('</TR>');
	}
}

function MakeTableData(title, desc, href)
{
	this.title = title;
	this.desc = desc;

	// Add a break after the 55th character
	if (href.length > iLinkBreak)
		href = href.substring(0,iLinkBreak) + '<BR>' + href.substring(iLinkBreak);
		
	this.href = href;
}

function MakeSubItemLink(label, path, href)
{
	this.label = label;
	this.path = path;
	this.href = href;
}

function MakeSubItemText(title, text)
{
	this.title = title;
	this.text = text;
}

// *******************  \\

function MakeMenuItem(width, label, parent, href)
{
	this.width = width;
	this.label = label;
	this.parent = parent;
	this.href = href;
}

var mainmenu = new Array();
var m = 0;
var s = 0;

mainmenu[m++] = new MakeMenuItem(50,  "HOME", "", "home.html");
mainmenu[m++] = new MakeMenuItem(55,  "Preface", "", "preface.html");
// // //mainmenu[m++] = new MakeMenuItem(81,  "Introduction", "", "introduction.html");
mainmenu[m++] = new MakeMenuItem(160, "Professionalism Standard", "", "professionalism-standard.html");
mainmenu[m++] = new MakeMenuItem(100, "Issue Analysis", "issue-analysis/", "issue-analysis.html");
mainmenu[m++] = new MakeMenuItem(110,  "Instructional Units", "issues/", "issues.html");
mainmenu[m++] = new MakeMenuItem(125, "Source & Resource", "sources/", "sources.html");
mainmenu[m++] = new MakeMenuItem(115, "Ag Issues Forum", "ag-issues-forum/", "ag-issues-forum.html");

var submenu = new Array();

// ISSUE ANALYSIS
submenu[s++] = new MakeMenuItem("10%", "Teaching Materials", "issue-analysis", "teaching-materials.html");
submenu[s++] = new MakeMenuItem("10%", "Strategies", "issue-analysis", "strategies.html");
submenu[s++] = new MakeMenuItem("10%", "Terms", "issue-analysis", "terms.html");
submenu[s++] = new MakeMenuItem("10%", "What is<BR> an Issue?", "issue-analysis", "what-is-an-issue.html");
submenu[s++] = new MakeMenuItem("10%", "Issue From<BR> a Problem", "issue-analysis", "an-issue-from-a-problem.html");
submenu[s++] = new MakeMenuItem("10%", "Analyze<BR> Issue", "issue-analysis", "analyze-issue.html");
submenu[s++] = new MakeMenuItem("10%", "Gather<BR> Information", "issue-analysis", "gather-information.html");
submenu[s++] = new MakeMenuItem("10%", "Determine<BR> Risks", "issue-analysis", "determine-risks.html");
submenu[s++] = new MakeMenuItem("10%", "Analysis<BR> Techniques", "issue-analysis", "analysis-techniques.html");
submenu[s++] = new MakeMenuItem("10%", "Prepare<BR> Issue", "issue-analysis", "prepare-issue.html");
// // //submenu[s++] = new MakeMenuItem(85, "Teaching Resources", "issue-analysis", "teaching-resources.html");

//ISSUES
submenu[s++] = new MakeMenuItem(100, "Environmental", "issues", "environmental-issues.html");
submenu[s++] = new MakeMenuItem(80,  "Technology", "issues", "technology-issues.html");
submenu[s++] = new MakeMenuItem(75,  "Animal", "issues", "animal-issues.html");
submenu[s++] = new MakeMenuItem(85,  "Career", "issues", "career-issues.html");
submenu[s++] = new MakeMenuItem(105, "Economy & Trade", "issues", "economy_and_trade-issues.html");
submenu[s++] = new MakeMenuItem(85,  "Policy", "issues", "policy-issues.html");
submenu[s++] = new MakeMenuItem(80,  "Food Safety", "issues", "food_safety-issues.html");
submenu[s++] = new MakeMenuItem(115, "Biotechnology", "issues", "biotechnology-issues.html");

// AG ISSUES FORUM
submenu[s++] = new MakeMenuItem(110, "Beginning Steps", "ag-issues-forum", "beginning-introduction.html");
submenu[s++] = new MakeMenuItem(105, "Initial Set-up", "ag-issues-forum", "setup-plan-call-write.html");
submenu[s++] = new MakeMenuItem(95,  "Presentation", "ag-issues-forum", "presentation.html");
submenu[s++] = new MakeMenuItem(130, "Contacting the Public", "ag-issues-forum", "public-relation.html");
submenu[s++] = new MakeMenuItem(90,  "Ending Steps", "ag-issues-forum", "ending-evaluation.html");
submenu[s++] = new MakeMenuItem(90,  "Worksheets", "ag-issues-forum", "worksheets.html");
submenu[s++] = new MakeMenuItem(85,  "Sponsors", "ag-issues-forum", "sponsors.html");

//SOURCES
submenu[s++] = new MakeMenuItem(90,  "Past Issues", "sources", "past-local.html");
submenu[s++] = new MakeMenuItem(100, "Current Issues", "sources", "current-all.html");
submenu[s++] = new MakeMenuItem(100, "Other Resources", "sources", "other-sites.html");
submenu[s++] = new MakeMenuItem(440, "", "sources", "");


// ***************************************************** \\

var mainmenuHTML = "";
mainmenuHTML += '<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0" WIDTH="770" BGCOLOR="#083152" style="background:#083152 url(images/corner_mainmenu.gif); background-repeat:no-repeat ">';
mainmenuHTML += '<TR>';

for (var i=0; i<mainmenu.length; i++)
{
	mainmenuHTML += '<TD WIDTH="' + mainmenu[i].width + '" ALIGN="center" CLASS="mainmenu'

	thisParent = mainmenu[i].parent;

	if (thisParent.lastIndexOf("/" ))
		thisParent = thisParent.substring(0,thisParent.length -1);

	if (pagename == mainmenu[i].href || parentDir == thisParent)
		mainmenuHTML += '_active';
	 
	mainmenuHTML += '"><A HREF="' + mainmenu[i].parent + mainmenu[i].href + '">&nbsp;' + mainmenu[i].label + '&nbsp;</A></TD>';

	if (i != mainmenu.length - 1)
		mainmenuHTML += '<TD WIDTH="6" HEIGHT="30" ALIGN="center" CLASS="mainmenu">|</TD>';
}

/*
mainmenuHTML += '<TD>test</TD>';
mainmenuHTML += '<TD>test</TD>';
*/
mainmenuHTML += '</TR></TABLE>';


// ******************************************************************************** \\


var submenuHTML = "";

submenuHTML += '<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0" WIDTH="770" BGCOLOR="#CCCC99">';
submenuHTML += '<TR>';
submenuHTML += '<TD WIDTH="23" BGCOLOR="#083152"><IMG SRC="images/spacer.gif" WIDTH="23" HEIGHT="30"></TD>';
submenuHTML += '<TD WIDTH="23" BGCOLOR="#CCCC99" style="background:url(images/corner_submenu.gif); background-repeat:no-repeat;"><IMG SRC="images/spacer.gif" WIDTH="23" HEIGHT="30"></TD>';
submenuHTML += '<TD WIDTH="724"><TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0" WIDTH="724" BGCOLOR="#CCCC99"><TR>';

if (parentDir != "" && parentDir != "HTML")
{
	for (var j=0; j<submenu.length; j++)
	{
		if (submenu[j].parent == parentDir)
		{
			submenuroot = submenu[j].href.substring(0, submenu[j].href.indexOf("_"))
			submenuHTML += '<TD WIDTH="' + submenu[j].width + '" ALIGN="center" CLASS="submenu';

			if (pagename == submenu[j].href || fileroot == submenuroot)  //  || fileroot + "_issues.html" == submenu[j].href)
				submenuHTML += '_active';
			
			submenuHTML += '"><A HREF="' + parentDir + "/" + submenu[j].href + '">' + submenu[j].label + '</A></TD>';
		}
	}

	submenuHTML += '</TR></TABLE></TD>';
	submenuHTML += '</TR><TR><TD WIDTH="23" BGCOLOR="#083152"><IMG SRC="images/spacer.gif" WIDTH="23" HEIGHT="1"></TD>';
	submenuHTML += '<TD WIDTH="737" BGCOLOR="#CCCC99" COLSPAN="11"><IMG SRC="images/spacer.gif" WIDTH="737" HEIGHT="1"></TD></TR>';

}
else
{
	submenuHTML += '</TR></TABLE></TD>';
   //submenuHTML += '<TD WIDTH="737" BGCOLOR="#CCCC99"><IMG SRC="images/spacer.gif" WIDTH="723" HEIGHT="31"></TD>';
}

submenuHTML += '</TR></TABLE>';


// ******************************************************************************** \\

var wrapperStartPage = "";
wrapperStartPage += '<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0" WIDTH="770">';
wrapperStartPage += '<TR>';
wrapperStartPage += '<TD>';


var wrapperStartBody = "";
wrapperStartBody += '<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0" WIDTH="770">';
wrapperStartBody += '<TR>';
wrapperStartBody += '<TD BGCOLOR="#083152"><IMG SRC="images/spacer.gif" WIDTH="23" HEIGHT="400"></TD>';
wrapperStartBody += '<TD BGCOLOR="#CCCC99"><IMG SRC="images/spacer.gif" WIDTH="23" HEIGHT="1"></TD>';
wrapperStartBody += '<TD WIDTH="724" VALIGN="top" BGCOLOR="#FFFFCC">';

wrapperStartBody += '<TABLE CELLPADDING="15" CELLSPACING="0" BORDER="0" WIDTH="100%">';
wrapperStartBody += '<TR>';
wrapperStartBody += '<TD style="background:url(images/corner_content.gif); background-repeat:no-repeat;">';

// ******************************************************************************** \\


document.write('<LINK REL="stylesheet" TYPE="text/css" HREF="includes/styles.css">');
document.write(wrapperStartPage);
document.write('<DIV ID="print_hide">');
document.write(headerHTML);
document.write(mainmenuHTML);
document.write(submenuHTML);
document.write('</DIV>');
document.write(wrapperStartBody);

