
// ******************************************************************
//                            FUNCTIONS
// ******************************************************************
function BrowserAge()
{
if ((self.navigator.appName=="Netscape"&&self.navigator.appVersion>="5") 
	||(self.navigator.appName=="Microsoft Internet Explorer"&&self.navigator.appVersion>="4")) 
{return "new";}
else {return "old";}
}
// ------------------------------------------------------------------
function FlashProblem()
{
if (self.navigator.appName=="Netscape") {return "problem"; }
else { return "ok";}
}
// ------------------------------------------------------------------
function UnderliningOff()
{
	var age = BrowserAge();
	switch(age) {
		case 'old': break
		case 'new': 
			document.write(" style='text-decoration: none' ")
			break
	}
}
// ------------------------------------------------------------------
function BestViewedMessage()
{
	var age = BrowserAge();
	switch(age) {
		case 'new': break
		case 'old': 
			var bestviewedmessage = "This web page is best viewed by "
			+"Netscape 6+ or Microsoft Internet Explorer 5+.  Please "
			+"upgrade your browser."
			text_format(
			bestviewedmessage,
			"4","Arial Black","ffff00","yes");
			document.write()
			break
	}
}
// ------------------------------------------------------------------
function html_begin(pt) 
{
	document.write("<html><head>");
	document.write("<title>"+pt+"</title>");
	document.write("<style type='text/css'>");
	document.write("a:hover {color:#ff0000}");
	document.write("</style>");
	document.write("</head>");
}
// ------------------------------------------------------------------
function html_end()
{document.write("</html>")}
// ------------------------------------------------------------------
function body_begin(bkcolor,bkimage,masthead_bgcolor)
{
	document.write("<body ");
	document.write(" bgcolor=#"+bkcolor); 
	document.write(" link=#"+masthead_bgcolor); 
	document.write(" alink=#"+masthead_bgcolor); 
	document.write(" vlink=#"+masthead_bgcolor); 
	document.write(" background="+bkimage);
	document.write(" >");
}
// ------------------------------------------------------------------
function body_end()
{
	document.write("</body>");
}
// ------------------------------------------------------------------
function menu(menu_width,
	font_size,font_face,font_color,boldon,bgcolor,
	border,bordercolor,columnwidths,topiclinks)
{
	document.write("<table border="+border
		+" bordercolor="+bordercolor
		+" width="+menu_width
		+">");
	document.write("<tr>");

	document.write("<td align=center"
		+" bgcolor=#"+bgcolor+">");
	text_format("MENU >>>",font_size,font_face,font_color,boldon);
	document.write("</td>");

	for (var counterRow in topiclinks){
		document.write("<td align=center"
			+" bgcolor=#"+bgcolor+">");
		targettext = topiclinks[counterRow][0][1];
		targetlength = topiclinks[counterRow][0][1].length;
		targettext = targettext.substr(2,targetlength-2);
		document.write("<a");
		UnderliningOff()
		document.write(" href=#"+counterRow+">");
		text_format(targettext,font_size,font_face,font_color,boldon);
		document.write("</a>");
		document.write("</td>");
	}
	document.write("<tr>");
	document.write("</table>");
}
// ------------------------------------------------------------------
function masthead(
	masthead_width,masthead1_width,masthead2_width,masthead3_width,
	masthead_bgcolor,
	masthead_image1,masthead_image1_alt,masthead_link1,masthead_image2,masthead_link2,
	masthead_highlight,
	masthead_text,masthead_fontsize,masthead_face,masthead_color,
	bordercolor,border,logoTopTextColor,logoLowerTextColor,logoBackColor)
{
	// Begin Table
	document.write("<table width="+masthead_width
		+" border="+border
		+" bgcolor="+masthead_bgcolor
		+" bordercolor="+bordercolor);
	document.write(" style=\"border-style:\'solid\'\" >");
	document.write("<tr>");

	// Left Image
	document.write("<td width="+masthead1_width+" bgcolor="+masthead_bgcolor);
	document.write(" style=\"border-width:1px\" ");

	document.write(" onmouseover=\"this.style.borderStyle=\'solid\'; "); 
	document.write(" this.style.borderColor=\'"+masthead_highlight+"'; "); 
	document.write(" this.style.borderWidth=\'3px'\" "); 

	document.write(" onmouseout=\"this.style.borderStyle=\'solid\'; "); 
	document.write(" this.style.borderColor=\'"+bordercolor+"'; "); 
	document.write(" this.style.borderWidth=\'1px'\" "); 

	document.write(" align=center>");

	if (masthead_link1.length > 0) {document.write("<a ");
			UnderliningOff()	
			document.write("href="+masthead_link1+">")
	}
	
	if (masthead_image1.substr((masthead_image1.length-3),3)!='swf')
	{
		document.write("<img src="+masthead_image1);
		document.write(" onmouseover=\"this.style.borderStyle=\'none\'\" "); 
		document.write(">");
	}
	else
	{
		var x = FlashProblem();
		if (x == "problem")
		{
			document.write("<img src="+masthead_image1_alt);
			document.write(" onmouseover=\"this.style.borderStyle=\'none\'\" "); 
			document.write(">");
		}
		else
		{
			document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' ");
			document.write("codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,29,0' ");
			document.write("width='200' height='65' id='logo'>");
			document.write("<param name='movie' value='"+ masthead_image1 +"'>");
			document.write("<param name='quality' value='high'>");
			document.write("<param name='menu' value='false'>");
			document.write("<embed src='"+ masthead_image1 +"' quality='high' ");
			document.write("menu='false' pluginspage='http://www.macromedia.com/go/getflashplayer' ");
			document.write("type='application/x-shockwave-flash' width='200' height='65' id='logo' ");
			document.write("swLiveConnect='true'></embed></object>");
			window.document.logo.SetVariable('topTextColor', logoTopTextColor);
			window.document.logo.SetVariable('lowerTextColor', logoLowerTextColor);
			window.document.logo.SetVariable('backColor', logoBackColor);
		}
	}
	
	if (masthead_link1.length > 0) {document.write("</a>")}
	document.write("</td>");

	// Middle Text
	document.write("<td width="+masthead2_width+" align=center style='font-weight:700'>");
	document.write("<font size="+masthead_fontsize+
		" face=" + masthead_face+" color=#"+masthead_color+">");
	document.write(masthead_text);
	document.write("</font>");
	document.write("</td>");

	// Right Image

	document.write("<td width="+masthead3_width+" bgcolor="+masthead_bgcolor);
	document.write(" style=\"border-width:1px\" ");

	document.write(" onmouseover=\"this.style.borderStyle=\'solid\'; "); 
	document.write(" this.style.borderColor=\'"+masthead_highlight+"'; "); 
	document.write(" this.style.borderWidth=\'3px'\" "); 

	document.write(" onmouseout=\"this.style.borderStyle=\'solid\'; "); 
	document.write(" this.style.borderColor=\'"+bordercolor+"'; "); 
	document.write(" this.style.borderWidth=\'1px'\" "); 

	document.write(" align=center>");
	
	if (masthead_link2.length > 0) {document.write("<a ");
			UnderliningOff()	
			document.write("href="+masthead_link2+">")
	}
		document.write("<img src="+masthead_image2);
		document.write(" onmouseover=\"this.style.borderStyle=\'none\'\" "); 
		document.write(">");
	
	if (masthead_link2.length > 0) {document.write("</a>")}
	document.write("</td>");

	// End Table
	document.write("</tr>");
	document.write("</table>");
}
// ------------------------------------------------------------------
function menu_begin(menu_width,border,bordercolor)
{
	document.write("<table width="+menu_width
		+" border="+border
		+" bordercolor=#"+bordercolor	
		+">");
	document.write("<tr>");
}
// ------------------------------------------------------------------
function menu_end()
{
	document.write("</tr></table>");
}
// ------------------------------------------------------------------
function column_begin(column_width,bordercolor)
{
	document.write("<td width="+column_width
		+" valign=top"
		+">");
	document.write("<table width=100%"
		+">");
}
// ------------------------------------------------------------------
function section_begin(column_width,bordercolor)
{
	document.write("<td width="+column_width
		+" valign=top"
		+">");
	document.write("<table width=100%"
		+" bgcolor=#"+bordercolor
		+">");
}
// ------------------------------------------------------------------
function section_end()
{
	document.write("</table></td>");
}
// ------------------------------------------------------------------
function column_end()
{
	document.write("</table></td>");
}
// ------------------------------------------------------------------
function table_spacing(level,n) {
	if (level=1) {
		for (var i=1; i<=n; i++) {
			document.write("<tr><td></td></tr>");	
		}		
	}
}
// ------------------------------------------------------------------
function text_format(text,font_size,font_face,font_color,boldon,highlight_color)
{
		if (boldon=="yes") {document.write("<b>")}
		document.write("<font size="+font_size+" face="+font_face+" color=#"+font_color);
		if (highlight_color!="")
		{
			if (boldon=="no"){original_bold='normal';} else {original_bold='bold';}
			document.write(" onmouseover=\"this.style.fontWeight='bolder'; this.style.color=\'"+highlight_color+ "\'\" ");
			document.write(" onmouseout=\"this.style.fontWeight='"+original_bold+"'; this.style.color=\'"+font_color+ "\'\" ");
		}
		document.write(">");
		document.write(text);
		document.write("&nbsp&nbsp");
		document.write("</font>");
		if (boldon=="yes") {document.write("</b>")}
}
// ------------------------------------------------------------------
function image_link(src,link,alt)
{
		document.write("<a href="+link+">");
		document.write("<img align=middle alt="+alt+" src="+src+" border=0>");
		document.write("</a>");
		document.write("&nbsp&nbsp");
}
// ------------------------------------------------------------------
function column_item(indent,linkicon,level,desc,link,linklength,boldon,
	font_size,font_face,font_color,bgcolor,highlight_color,
	texttype,text,
	textfont_size,textfont_face,textfont_color,textfont_boldon,
	spacing,documentimage,formimage,webimage,logo,attn,note,noteimage,
	picturebgcolor,sectionnumber,upimage,bordercolor)
{	
		// Section Heading

		if (level==1) {
			document.write("<tr><td"
			+" bgcolor=#"+bordercolor+">");
			document.write("<a "
			+" name="+sectionnumber+"></a>");
			document.write("</td><tr>");
		}

		// Insert Space Before Item	
		table_spacing(level,spacing)

		// Begin Item
		document.write("<tr>");
		document.write("<td  ");
		document.write("bgcolor=#");

        if (desc.length == 0){
			document.write(picturebgcolor);
			document.write(" align = center");
		}
		else {
			document.write(bgcolor)
		}		
		document.write(">");

		// Indentation
		for (var i=1; i<=indent; i++) {
			document.write("&nbsp");
		}	
		
		// Image Link?		
		switch(linkicon) {
			case 'c':
				image_link(classhoursimage,link,"Class");
				break;
			case 'd':
				image_link(documentimage,link,"Document");
				break;
			case 'e':
				image_link(emailimage,link,"Email");
				break;
			case 'f':
				image_link(formimage,link,"Form");
				break;
			case 'h':
				image_link(officehoursimage,link,"Hours");
				break;
			case 'o':
				image_link(officelocationimage,link,"Office_Location");
				break;
			case 't':
				image_link(telephoneimage,link,"Telephone");
				break;
			case 'w':
				image_link(webimage,link,"Webpage");
				break;
		}
		
		// Clickable Item

		if (level==1) {
			document.write("<a");
			UnderliningOff()
			document.write(" href=#home>");
		}
		if (linklength > 0) {
			document.write("<a ");
			UnderliningOff()
			document.write(" href="+link+">");
		}
		if (linklength > 0) 
			{text_format(desc,font_size,font_face,font_color,boldon,highlight_color);}
			else {text_format(desc,font_size,font_face,font_color,boldon,"");}
		
		if (linklength > 0||level==1) {document.write("</a>")}
		// Note Before Icons?
		if (text.length > 0) {
				if (texttype == "n"){
					text_format(text,textfont_size,textfont_face,textfont_color,textfont_boldon,"");
				}
		}		
		// Logo
		if (logo.length > 0) {			
			if (desc.length == 0 && linklength>0){document.write("<a href="+link+">");	}
					
			document.write("<img align=center style=\"border-style:none\" src="+logo);

			if (desc.length == 0 && linklength>0)			
			{
				document.write(" onmouseover=\"this.style.borderStyle=\'double\'; "); 
				document.write(" this.style.borderColor=\'"+highlight_color+"'\" "); 
				document.write(" onmouseout=\"this.style.borderStyle=\'none\'; "); 
				document.write(" this.style.borderColor=\'"+highlight_color+"'\" "); 
			}
			document.write(">");	

			if (desc.length == 0 && linklength>0){document.write("</a>");}

			document.write("&nbsp&nbsp");
		}

		// Attn Icon
		if (attn.length > 0) {
			document.write("<img align=middle src="+attn+" border=0>");
			document.write("&nbsp&nbsp");
		}
		// Note After Icons?
		if (text.length > 0) {
				if (texttype == "b"){
					document.write("<br>");	
					// Indentation
					for (var i=1; i<=indent; i++) {
							document.write("&nbsp");
					}
					text_format(text,textfont_size,textfont_face,textfont_color,textfont_boldon,"");
					document.write("<br>");	
				}
		}

		// End Item
		document.write("</td></tr>");
}
// ---------------------------------------------------------------------
function section_contents(topiclinks,
	spacing,
	itemindent,
	itemboldon,noteboldon,
	itemfontsize,notefontsize,
	itemfontface,notefontface,
	itemfontcolor,notefontcolor,
	cellbgcolor,itemhighlightcolor,
	x,documentimage,formimage,webimage,noteimage,
	menupicturebgcolor,sectionnumber,upimage,sectionbordercolor
	)
{	
	for (var counterRow in topiclinks) {

		var picturebgcolor = menupicturebgcolor[x];
		var linkicon = topiclinks[counterRow][0];

		var level = topiclinks[counterRow][1].substring(0,1);

		var desclength=topiclinks[counterRow][1].length;
		var desc = topiclinks[counterRow][1].substr(2,desclength-2);

		var link = topiclinks[counterRow][2];
		var linklength=link.length;

		var textlength = topiclinks[counterRow][3].length;	

		if (textlength > 0) {
			var texttype = topiclinks[counterRow][3].substring(0,1);
			var text = topiclinks[counterRow][3].substr(2,textlength-2);
			}
			else {
				var texttype = "";
				var text     = "";
			}	

		var logo = topiclinks[counterRow][4];
		var attn = topiclinks[counterRow][5];
		var note = topiclinks[counterRow][6];

		column_item(itemindent[x][level-1],
			linkicon,level,desc,link,linklength,
			itemboldon[x][level-1],
			itemfontsize[x][level-1],
			itemfontface[x][level-1],
			itemfontcolor[x][level-1],
			cellbgcolor[x][level-1],
			itemhighlightcolor[x][level-1],
			texttype,
			text,
			notefontsize[x][level-1],
			notefontface[x][level-1],
			notefontcolor[x][level-1],
			noteboldon[x][level-1],
			spacing[x][level-1],
			documentimage,formimage,webimage,logo,attn,note,noteimage,
			picturebgcolor,sectionnumber,upimage,sectionbordercolor);
	}		
}
// ***********************************************************************


