// side_bar: Side bar creation script
// 
// Javascript 1.2
// 
// Set of Utilities to create a side bar and bottom bar components
// Should be easily modifiable for use with any site.
// The side bar call assumes that it occurs inside a <TABLE>
// definition- this is to allow the use of a large table for
// the entire page- a small column enclosing the side bar and
// a larger column enclosing the content. Here is a template page
// definition employing both a side and a bottom bar:
// 
//			<HTML>
//			<HEAD>
//			<TITLE>Yer Title</TITLE>
//			<SCRIPT SRC="./jscript/moose_over.js"></SCRIPT>
//			<SCRIPT SRC="./jscript/side_bar.js"></SCRIPT>
//			</HEAD>
//			<BODY BACKGROUND="images/web_background.jpg">
//			<TABLE>
//				<TD WIDTH=15></TD>
//				<TD VALIGN=TOP>
//				<SCRIPT>
//			    <!--
//				write_bar("")
//			    //-->
//				</SCRIPT>
//				</TD>
//				<TD WIDTH=30></TD>
//				<TD>
//				<H1>Content Goes Here</H1>
//				</TD>
//			</TABLE>
//			<SCRIPT>
//			<!--
//				tail_bar("", 1)
//			//-->
//			</SCRIPT>
//			
//			</FONT>
//			</BODY>
//			</HTML>
// 
// 
// 
// Feel free to use and modify this script but please leave the
// credit comments at the header and drop me a note:
// mcdermoj@ohsu.edu
// 
// JEMWorks Design Division, 2000


	page_list = new Array(
		"Entry",
		"Meeting",
		"Proposal",
		"Ceremony",
		"Future",
		"Information",
		"Links",
		"Guestbook",
		"About Us"
	)
	
	index_list = new Array(
	    "bar_entry",
		"bar_meeting",
		"bar_proposal",
		"bar_ceremony",
		"bar_future",
		"bar_info",
		"bar_links",
		"bar_guest",
		"bar_aboutus"
	)
	
	index2_list = new Array(
		"entry",
		"meeting",
		"proposal",
		"ceremony",
		"future",
		"info_main",
		"links",
		"guestbook",
		"aboutus"
	)
	
	html_list = new Array(
		"entry.html",
		"meeting.html",
		"proposal.html",
		"ceremony.html",
		"future.html",
		"info_main.html",
		"links.html",
		"guestbook.html",
		"aboutus.html"
	)
	
	comment_list = new Array(
	    "Back to Main Page",
		"How We Met",
		"The Story of the Proposal",
		"The Trimmings",
		"Our dreams, plans, etc.",
		"Information on the event",
		"Interesting and related links",
		"Sign in on our Guestbook",
		"Who Are We?"
	)
	
	sub_entry = 0
	sub_meeting = new Array(
		"Story Part I",
		"meeting_part1.html",
		"How I found Happiness...",
		"Story Part II",
		"meeting_part2.html",
		"She Loves Me?",
		"Story Part III",
		"meeting_part3.html",
		"US!",
		"Slide Show- High",
		"meeting.html",
		"Higher Bandwidth Slide Show",
		"Slide Show- Low",
		"meeting.html",
		"Lower Bandwidth Slide Show"
	)
	sub_proposal = new Array(
		"Preface",
		"proposal_story1.html",
		"A Preface to the Proposal",
		"Ring Quest",
		"proposal_story2.html",
		"Searching out and finding the perfect ring",
		"Proposal Proper",
		"proposal_story3.html",
		"(red truck???)"
	)
	sub_ceremony = new Array(
		"Invitations",
		"invitation.html",
		"View Our Invitations",
		"Thoughts",
		"ceremony_thoughts.html",
		"Thoughts about the ceremony",
		"Party",
		"ceremony_party.html",
		"Our Wedding Party"
	)
	sub_future = 0
	sub_info_main = new Array(
		"Gift Registry",
		"info_registry.html",
		"Where Are We Registered (and for what)?"
	)
	sub_links = new Array(
		"Maps & Directions",
		"link_maps.html",
		"How to get there and around there",
		"Lodging & Camping",
		"link_lodge.html",
		"Where to stay in the area",
		"Things to Do",
		"link_activity.html",
		"Places to visit, sights, activities and vineyards",
		"Portland",
		"link_portland.html",
		"JaSonyas Guide to the Big City",
		"Wedding Related",
		"link_wedding.html",
		"Food, Ceremony, Traditions, etc. Related to the Event!",
		"Links by You!",
		"link_forall.html",
		"Add Own Links in several categories",
		"Other Links",
		"link_misc.html",
		"Links that just dont fit"
	)
	sub_guestbook = 0
	sub_aboutus = 0
	
	
bottom_bar = new Array(
	"Top",
	"#bar_topping",
	"Back to the top of this page",
	"Guestbook",
	"guestbook.html",
	"Sign our Guestbook and tell us what you think!",
	"Contact Us",
	"aboutus.html#contact_info",
	"How to get in touch with us more directly",
	"Links",
	"links.html",
	"Wedding related links page"
	)
sub_indices = false;



	
function write_bar(this_page) {
	sub = false;
	if (arguments[1]) sub = true;
	
	self.status='Pre-Loading Images....'
	preload_hilist(index_list, "./images/side_bar/", ".GIF")
	self.status=''

	document.write("<TD WIDTH=5></TD>")
	document.write("<TD WIDTH=115 VALIGN=TOP><A NAME=\"bar_topping\">")
	
	i = 0
	while (index_list[i]) {
		
		img_entry = "<IMG SRC=\"./images/side_bar/" + index_list[i] + "_off.GIF\"" +
					" NAME=\"" + index_list[i] + "\" ALT=\""+ page_list[i] +"\"" + 
					"BORDER=0 HSPACE=0 VSPACE=6>";
		if (((this_page + ".html") != html_list[i]) || sub) {
				bar_entry = "<A HREF=\"" + html_list[i] +
							"\" onMouseOver=\"hi_lite(\'"+ index_list[i] + "\')\;" +
							"self.status=\'" + comment_list[i] 
							+ "\'\; return true\" onMouseOut=\"un_lite(\'" +
							index_list[i] + "\')\; self.status=\'\'\;return true\">";
				document.write(bar_entry);
				document.write(img_entry);
				document.write("</A><BR>");
				if (sub && ((this_page + ".html") == html_list[i])) {
					subindex_bar(this_page, 15, 0)
				}
		} 
		else {
			img_entry = "<IMG SRC=\"./images/side_bar/" + index_list[i] + "_ina.GIF\"" +
					" NAME=\"" + index_list[i] + "\" BORDER=0 HSPACE=0 VSPACE=6>";
			document.write(img_entry + "<BR>")
			if (sub_indices) subindex_bar(this_page, 15, 0)	
		}
		
		i = i + 1	
	}
	document.write("</TD><TD WIDTH=40></TD>")
}

function subindex_bar(page, indent) {
	if (arguments[2]) vspace = arguments[2];
	else vspace=6;
	
	sub_page = "sub_" + page
	sub_arr = eval(sub_page)
	if (sub_arr) {
			j = 0
			document.write("<FONT SIZE=-2>")
			while (sub_arr[j]) {
				document.write("<IMG SRC=\"images/nothing.gif\" WIDTH=" + indent + ">")
				document.write("<A HREF=\"" + sub_arr[(j+1)] +
									"\" onMouseOver=\"self.status=\'" + sub_arr[(j+2)] +
									"\'\; return true\" onMouseOut=\"self.status=\'\'\;return true\">")
				document.write(sub_arr[j])
				document.write("</A><BR>")
				j = j + 3
			}
			document.write("<BR></FONT>")
	}
	
}


function simple_bar(this_page, color) {
	
	// display all sub-indices at once if this_page is set to 'all' or 'ALL'
	allpage = false;
	if ((this_page == "all") || (this_page == "ALL")) allpage = true;
	
	bullet=0
	if (arguments[2]) bullet = argument[2];
	document.write("<TD WIDTH=25></TD>")
	document.write("<TD WIDTH=135 VALIGN=TOP><A NAME=\"bar_topping\">")
	
	color_txt = ""
	if (color) color_txt = "COLOR=\"" + color + "\""
	document.write("<FONT SIZE=+1 " + color_txt + ">")
	
	i = 0
	while (index_list[i]) {
		text_entry = ""
		if (bullet) text_entry = "<IMG SRC=\"./images/side_bar/" + index_list[i] + "\" HSPACE=5 VSPACE=6"
		text_entry = text_entry + "<A HREF=\"" + html_list[i] +
							"\" onMouseOver=\"self.status=\'" + comment_list[i] +
							"\'\; return true\" onMouseOut=\"self.status=\'\'\;return true\">";
		document.write(text_entry)
		document.write("<B>" + page_list[i] + "</B>")
		document.write("</A><BR>")
		if (allpage) subindex_bar(index2_list[i], 12);
		if (this_page + ".html" == html_list[i]) subindex_bar(this_page, 12);
		else document.write("<SPACER TYPE=\"VERTICAL\" SIZE=6><BR>");
		
		i = i + 1
	}
	
	document.write("</FONT></TD><TD WIDTH=40></TD>")
}

bottom_img = "nothing.gif"
bottom_corner = "nothing.gif"

function tail_bar(this_page) {
	backg = 0;
	if (arguments[1]) backg = arguments[1]
	switch (backg) {
	  case 0:
		bottom_img = "nothing.gif"
		bottom_corner = "nothing.gif"
		break;
	  case 1:
		bottom_img = "bottom_bar.gif"
		bottom_corner = "bottom_corner.gif"
		break;
	  case 2:
		bottom_img = "bottom_bar2.gif"
		bottom_corner = "nothing.gif"
		break;
	  case 3:
		bottom_img = "nothing.gif"
		bottom_corner = "nothing.gif"
	}
		
	table_credit(backg)
}


function table_credit(backg) {
	document.write("<TABLE WIDTH=\"100%\"><TD WIDTH=\"15%\"></TD><TD>")
	if (!backg) document.write("<CENTER><TABLE CELLPADDING=8><TD>")
	else document.write("<CENTER><TABLE CELLPADDING=8")
	write_credit(backg)
	document.write("</TABLE></CENTER></TD></TABLE></CENTER>")
	write_tablebar(backg)
}

function write_credit(backg) {
	bgcolor = ""
	if (backg == 3) bgcolor = "BGCOLOR=\"#FFFFFF\""
	document.write("<TD " + bgcolor + ">")
	document.write("<CENTER><A HREF=\"http://www.jasonya.com/jemworks/\">")
	document.write("<IMG SRC=\"images/side_bar/JEMWorks_logo_wo.GIF\" BORDER=0></A>")
	
	document.write("<BR><A HREF=\"credits.html\">")
	document.write("<FONT COLOR=\"#808080\" POINT-SIZE=12>")
	document.write("<I>&copy; JaSonya Ventures, 2000<BR>")
	document.write("All Rights Reserved.</CENTER></A></I></CENTER></TD>")
	
	document.write("<TD WIDTH=20></TD>")
	document.write("<TD><CENTER><FONT COLOR=\"#808080\" POINT-SIZE=12>Hosted By:</CENTER><BR>")
	document.write("<IMG SRC=\"http://service.bfast.com/bfast/serve?bfmid=12768212&siteid=31729006&bfpage=home\"")
	document.write("BORDER=\"0\" WIDTH=\"1\" HEIGHT=\"1\" NOSAVE>")
	document.write("<A HREF=\"http://service.bfast.com/bfast/click?bfmid=12768212&siteid=31729006&bfpage=home\"")
	document.write("TARGET=\"_top\"><IMG SRC=\"http://www.nomonthlyfees.com/images/7_2000_125X125.gif\"")
	document.write("BORDER=\"0\" WIDTH=\"125\" HEIGHT=\"125\" ALT=\"www.NoMonthlyFees.com\"></A></TD>")
	document.write("</CENTER>")
}

function write_layerbar(backg) {
	
	// NS with Layers? Note: we should be able to use CSS just as well but it doesn't seem
	// 			to work in NS the same way it does in IE, funny.
	if (document.layers) {
			document.write("<LAYER ID=\'bottom_bar\' PAGE=" + window.innerHeight)
			document.write(" PAGEX=133 Z-INDEX=100, BACKGROUND=\"images/side_bar/" + bottom_img + "\"")
			document.write("WIDTH=\'85%\' HEIGHT=45><LAYER LEFT=0 TOP=0>")
			document.write("<IMG SRC=\"images/side_bar/" + bottom_corner + "\"></LAYER><BR><CENTER>|&nbsp;")
			
			i = 0
			while (bottom_bar[i]) {
				document.write("<A HREF=\"" + bottom_bar[i+1] + "\" onMouseOver=")
				document.write("\"self.status=\'" + bottom_bar[i+2] +"\'\; return true\"")
				document.write("onMouseOut=\"self.status=\'\'\;return true\">")
				document.write(bottom_bar[i] + "</A> | ")
				i += 3
			}
			document.write("</CENTER></LAYER>")
	} 
	
	// IE with CSS?
	if (document.all) {
		document.write("<SPAN STYLE=\"position:absolute;top:" + (window.innerHeight - 40) +
						"px;left:133px;width:85%;height:40px;background-image:url(images/side_bar/" + 
						bottom_img +");\"><SPAN STYLE=\"position:absolute;top:0;left:0;width:30;height:30;\">" +
						"<IMG SRC=\"images/side_bar/" + bottom_corner + "\"></SPAN>" + 
						"<SPAN STYLE=\"position:absolute;top:20px;left:35%;width:33%;height:40;\">|&nbsp;")
			i = 0
			while (bottom_bar[i]) {
				document.write("<A HREF=\"" + bottom_bar[i+1] + "\" onMouseOver=")
				document.write("\"self.status=\'" + bottom_bar[i+2] +"\'\; return true\"")
				document.write("onMouseOut=\"self.status=\'\'\;return true\">")
				document.write(bottom_bar[i] + "</A> | ")
				i += 3
			}
			document.write("</SPAN></SPAN>")					
	}
	
	// otherwise Do it with tables
	if (!document.all && !document.layers)  {
			document.write("<TABLE WIDTH=\'100%\'><TD WIDTH=125><IMG SRC=\'images/nothing.gif\' HEIGHT=5 WIDTH=125></TD>")
			document.write("<TD BACKGROUND=\"images/side_bar/" + bottom_img + "\" HEIGHT=45>")
			document.write("<IMG SRC=\'images/nothing.gif\' HEIGHT=5 WIDTH=\'100%\'><BR><CENTER>|&nbsp;")
			
			i = 0
			while (bottom_bar[i]) {
				document.write("<A HREF=\"" + bottom_bar[i+1] + "\" onMouseOver=")
				document.write("\"self.status=\'" + bottom_bar[i+2] +"\'\; return true\"")
				document.write("onMouseOut=\"self.status=\'\'\;return true\">")
				document.write(bottom_bar[i] + "</A> | ")
				i += 3
			}
			document.write("</CENTER></TD></TABLE>")
	}	
}

function write_tablebar(backg) {
			document.write("<TABLE WIDTH=\'100%\'><TD WIDTH=125><IMG SRC=\'images/nothing.gif\' HEIGHT=5 WIDTH=125></TD>")
			document.write("<TD BACKGROUND=\"images/side_bar/" + bottom_img + "\" HEIGHT=45>")
			document.write("<IMG SRC=\'images/nothing.gif\' HEIGHT=5 WIDTH=\'100%\'><BR><CENTER>|&nbsp;")
			
			i = 0
			while (bottom_bar[i]) {
				document.write("<A HREF=\"" + bottom_bar[i+1] + "\" onMouseOver=")
				document.write("\"self.status=\'" + bottom_bar[i+2] +"\'\; return true\"")
				document.write("onMouseOut=\"self.status=\'\'\;return true\">")
				document.write(bottom_bar[i] + "</A> | ")
				i += 3
			}
			document.write("</CENTER></TD></TABLE>")
}





function sub_bar(the_page) {
	
	
}


