//DATA SECTION------------------------------------------------------------------------------------

//variable to contain the currently loaded page's address
var loc = self.location.href;

//side navigation link options organized by top navigation page option
//name = what appears on the side navigation rail
//parent = the 'name' property of the side naigation's parent
//currentPage = true iff this is the page loaded
//spaceAfter = true iff this link needs to be separated from the other links
//green = true iff the page loaded is subpage of this page
//url = the address associated with this link
//relUrl = the address of the background image relative to the file folder level

//sublinks for the 'Home' page -- none at this time
var index = new Array();

//sublinks for the 'Who We Are' page
var who = new Array();
who[who.length] = {name:"C. J. Schumacher's Curriculum Vitae",parent:"Who We Are",currentPage:false,spaceAfter:false,green:false,url:"http://www.balancedsolutions.com/website/downloads/Schumacher_CV_Balance.pdf",relUrl:"..\/..\/images\/background\/backgroundWho.gif"};
who[who.length] = {name:"J. F. Straube's Curriculum Vitae",parent:"Who We Are",currentPage:false,spaceAfter:false,green:false,url:"http://www.balancedsolutions.com/website/downloads/Straube_CV_academic.pdf",relUrl:"..\/..\/images\/background\/backgroundWho.gif"};
who[who.length] = {name:"J. F. Straube's University of Waterloo site",parent:"Who We Are",currentPage:false,spaceAfter:true,green:false,url:"http://www.civil.uwaterloo.ca/beg",relUrl:"..\/..\/images\/background\/backgroundWho.gif"};
who[who.length] = {name:"Photo Gallery",parent:"Who We Are",currentPage:false,spaceAfter:false,green:false,url:"http://www.balancedsolutions.com/website/pages/who/photogallery.html",relUrl:"..\/..\/images\/background\/backgroundWho.gif"};

//sublinks for the 'What We Do' page
var what = new Array();
what[what.length] = {name:"Holistic or Systems Design and Analysis",parent:"What We Do",currentPage:false,spaceAfter:false,green:false,url:"http://www.balancedsolutions.com/website/pages/what/holistic.html",relUrl:"..\/..\/images\/background\/backgroundWhat.gif"};
what[what.length] = {name:"Building Performance Modeling, Simulation, and In-situ Monitoring",parent:"What We Do",currentPage:false,spaceAfter:false,green:false,url:"http://www.balancedsolutions.com/website/pages/what/performance.html",relUrl:"..\/..\/images\/background\/backgroundWhat.gif"};
what[what.length] = {name:"Better Building: Green, Natural Building, Healthy, and Energy-Efficient Techniques",parent:"What We Do",currentPage:false,spaceAfter:false,green:false,url:"http://www.balancedsolutions.com/website/pages/what/green.html",relUrl:"..\/..\/images\/background\/backgroundWhat.gif"};
what[what.length] = {name:"Building Design Seminars, Education, and Training Manuals",parent:"What We Do",currentPage:false,spaceAfter:false,green:false,url:"http://www.balancedsolutions.com/website/pages/what/education.html",relUrl:"..\/..\/images\/background\/backgroundWhat.gif"};
what[what.length] = {name:"Building Material and Systems Testing",parent:"What We Do",currentPage:false,spaceAfter:true,green:false,url:"http://www.balancedsolutions.com/website/pages/what/materials.html",relUrl:"..\/..\/images\/background\/backgroundWhat.gif"};
what[what.length] = {name:"Portfolio",parent:"What We Do",currentPage:false,spaceAfter:false,green:false,url:"http://www.balancedsolutions.com/website/pages/what/portfolio.html",relUrl:"..\/..\/images\/background\/backgroundWhat.gif"};

//sublinks for the 'Resources' page
var resources = new Array();
resources[resources.length] = {name:"Online Publications",parent:"Resources",currentPage:false,spaceAfter:false,green:false,url:"http://www.balancedsolutions.com/website/pages/res/publications.html",relUrl:"..\/..\/images\/background\/backgroundResources.gif"};
resources[resources.length] = {name:"FAQs",parent:"Resources",currentPage:false,spaceAfter:false,green:false,url:"http://www.balancedsolutions.com/website/pages/res/faquestions.html",relUrl:"..\/..\/images\/background\/backgroundResources.gif"};
resources[resources.length] = {name:"Links",parent:"Resources",currentPage:false,spaceAfter:true,green:false,url:"http://www.balancedsolutions.com/website/pages/res/links.html",relUrl:"..\/..\/images\/background\/backgroundResources.gif"};
resources[resources.length] = {name:"Client Space",parent:"Resources",currentPage:false,spaceAfter:false,green:false,url:"http://www.balancedsolutions.com/website/pages/res/clientspace.html",relUrl:"..\/..\/images\/background\/backgroundResources.gif"};

//sublinks for the 'Contact' page -- none at this time
var contact = new Array();

//top navigation link options
//name = what appears on the top navigation rail
//sideLinks = array of links associated with this web page
//currentPage = true iff this is the page loaded
//green = true iff the page loaded is subpage of this page
//url = the address associated with this link
//relUrl = filepath to access the loaded page's background image relative to the file folder level
//left = the distance from the left-side of the browser window to place the navigation link's layer (each layer is 81 pixels wide)
var topLinks = new Array();
topLinks[topLinks.length] = {name:"Home",sideLinks:index,currentPage:false,green:false,url:"http://www.balancedsolutions.com/index.html",relUrl:"website\/images\/background\/backgroundHome.gif",left:325};
topLinks[topLinks.length] = {name:"Who We Are",sideLinks:who,currentPage:false,green:false,url:"http://www.balancedsolutions.com/website/pages/who.html",relUrl:"..\/images\/background\/backgroundWho.gif",left:406};
topLinks[topLinks.length] = {name:"What We Do",sideLinks:what,currentPage:false,green:false,url:"http://www.balancedsolutions.com/website/pages/what.html",relUrl:"..\/images\/background\/backgroundWhat.gif",left:487};
topLinks[topLinks.length] = {name:"Resources",sideLinks:resources,currentPage:false,green:false,url:"http://www.balancedsolutions.com/website/pages/res.html",relUrl:"..\/images\/background\/backgroundResources.gif",left:568};
topLinks[topLinks.length] = {name:"Contact Us",sideLinks:contact,currentPage:false,green:false,url:"http://www.balancedsolutions.com/website/pages/contact.html",relUrl:"..\/images\/background\/backgroundContact.gif",left:649};

//need div ids for the navigation rails (20, add more if navigation rails grows to more than 20 total links)
var divIds = new Array("one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen","twenty");

//picture filenames for the sidebar panel
var sidebarPic = new Array("hawaii_1","hawaii_2","hawaii_3","lasVegas_1","lasVegas_2","lasVegas_3","lasVegas_4",
					"mesaVerde_1","mtRainier_1","mtRainier_2","mtRainier_3","mtRainier_4",
					"santeFe_1","santeFe_2","taosPueblo_1","taosPueblo_2","BostonRowHouseSliver", "sliver-01","sliver-02","sliver-03","sliver-04","sliver-05","sliver-06","sliver-07","sliver-08","sliver-09","sliver-10","sliver-11","sliver-12","sliver-13","sliver-14","sliver-15","sliver-16","sliver-17","sliver-18","sliver-19","sliver-20","sliver-21","sliver-22","sliver-23","sliver-24","sliver-25","sliver-26","sliver-27","sliver-28");
					
//random catchphrase for the top navigation rail
var catchphrase = new Array('"Science for the Whole Building"','"Better Buildings by Design"');

//variable to contain the 'relative to loaded page' location of the sidebar image
var imgSrc = "";
chooseSidebarPic();

//variable to contain the catchphrase for the top navigation rail
var phrase = "";
chooseCatchphrase();

//variable to contain the 'relative to loaded page' location of the logo image
var logoSrc = "";
chooseLogoPath();

//variable to contain the maximum substring value for the loaded page's address
var locLength = loc.length - 1;

//variable to contain the information to write to the browser window
var info = "";

//variable to mark the substring length to test what top navigation rail to display
var top = 51;

//variable to mark the substring length to test what side navigation rail to display
var side = 58;

//variable to catch if the side navigation rail cannot be created, since page not in hierarchy
var error = false;

//variable to hold business name layer
var name = "<div id='name' style='position:absolute; width:200px; height:16px; z-index:6; left: 152; top: 15'><p class = 'name'><b>Balanced Solutions Inc.<\/b><\/p><\/div>";

//variable to hold business catch phrase layer
var saying = "<div id='phrase' style='position:absolute; width:200px; height:16px; z-index:6; left: 150; top: 36'><p class = 'phrase'><b>"+phrase+"<\/b><\/p><\/div>";

//variable to hold background layer if we don't know what page we are on
var altBackground = "<div id='alternate' style='position:absolute; width:945px; height:605px; z-index:1; left: 0px; top: 3px'><img src='..\/..\/images\/background\/crosshairs.gif' width='945' height='605'><\/div>";

//variable to hold background image opening tags
var openBackground = "<div id='background' style='position:absolute; width:945px; height:605px; z-index:1; left: 0px; top: 0px'><img src='";
  
//variable to hold background image closing tags
var closeBackground = "' width='945' height='605' name='background'><\/div>";

//variable to open a top navigation link's outer div tag
var topNav = "' style='position:absolute; left:";

//var to close a top navigation link's outer div tag
var closeTopNav = "px; top:34px; width:81px; z-index:4'>";

//variable to close div tag
var closeDiv = "<\/div>";

//variable to open link tag
var openLink = "'><a href='";//followed by url of page that the link is for

//variable to close link tag
var closeLink = "<\/a><\/div>";

//variable to open side navigation
var sideNav = "<div id='sidenavigation' style='position:absolute; width:115px; z-index:8; left: 786px; top: 125px'>";

//variable to open div tag
var openDiv = "<div id='";//one, two,... follows this variable

//variable to open class tag
var openClass = "' class='";//sidenav, topnav, or navBox follows this variable

//variable to handle link hover
var blue = "' onMouseOver=\"MM_changeProp('";//class number follows (one, two,...)

//variable to handle link hover restore
var restore = "','','style.backgroundColor','#000066','DIV')\" onMouseOut=\"MM_changeProp('";//class number follows (one, two,...)

//variable to close link hover restore
var closeRestore = "','','style.backgroundColor','#ffffff','DIV')\">";//link name follows (Who We Are, or Portfolio)

//variable to close link hover restore for a page whose subpage is loaded
var closeRestoreBlue = "','','style.backgroundColor','#66CCFF','DIV')\">";//link name follows (Who We Are, or Portfolio)

//variable to hold copyright & webmaster links
var copyright = "<br><p><font size=\"1\" face=\"Arial\">Copyright &copy; 2003-2006<br>Balanced Solutions Inc.<br>All Rights Reserved.<br>Webmaster:<br><a href=\"mailto:jfstraube@balancedsolutions.com\">John Straube</a></font></p>";
				
setNavigation();
document.write(info);
					
//DOGDAY DESIGNS FUNCTION SECTION----------------------------------------------------------------------------------

//execute the necessary functions to set up the loaded page
function setNavigation()	{//author www.dogdaydesigns.ca 2003
	alterArrays();//set navigation link arrays to correct settings
	createHtmlStandardPageElements();//create the string to send to the document for common elements
	searchArrays();//create the navigation rails
}

//select the catchphrase for the top navigation rail
function chooseCatchphrase() { //author www.dogdaydesigns.ca 2003
		count = catchphrase.length;
		randomVal = Math.floor((Math.random()*count));
		phrase = catchphrase[randomVal];
}

//select a picture for the sidebar panel
function chooseSidebarPic() { //author www.dogdaydesigns.ca 2003
		imgCt = sidebarPic.length;
		randomNum = Math.floor((Math.random()*imgCt));
		imgName = sidebarPic[randomNum];
		//need to use different style of file reference for all html pages other than the homepage
		if (loc != "http://www.balancedsolutions.com/index.html" && loc != "http://www.balancedsolutions.com/") {
			imgSrc = "..\/images\/sidebar\/" +imgName+ ".jpg";
		}
		//style of file reference needed when the homepage is loaded 
		else{
			imgSrc = "website\/images\/sidebar\/" +imgName+ ".jpg";
		}
}

//select a picture for the sidebar panel
function chooseLogoPath() { //author www.dogdaydesigns.ca 2003
		//need to use different style of file reference for all html pages other than the homepage
		if (loc != "http://www.balancedsolutions.com/index.html" && loc != "http://www.balancedsolutions.com/") {
			logoSrc = "..\/images\/logos\/balSolnsLogo.gif";
		}
		//style of file reference needed when the homepage is loaded 
		else{
			logoSrc = "website\/images\/logos\/balSolnsLogo.gif";
		}
}

//NOTE: all data arrays initialize the navigation links as NOT the currently loaded page
//adjust the array entries to identify the currently loaded page (after page loading)
function alterArrays()	{	//author www.dogdaydesigns.ca 2003
	//if locLength <= top, then we must be on the homepage, location 0 in topLinks array
	if (locLength <= top) { 
		topLinks[0].currentPage = true;
		topLinks[0].green = true;
	}
	else { //it must be a page other than the homepage
		//loop through the rest of topLinks to test for partial url equality
		var loop = true;
		var innerLoop = true;
		var topPt = 1;//pointer for topLinks array, assumes homepage in 0 entry
		var sidePt = 0;//pointer for the side navigation array
		while(loop){ //no point checking whole array if find the match
			if (topPt < topLinks.length) {//there is an array entry to check
				//if find a match, check if on a sidepage, subpage of a sidepage, or toppage
				if (loc.substring(0,(top-1)) == topLinks[topPt].url.substring(0,(top-1))){
					//must be a lower level page, a sidepage or a subpage of a sidepage
					if (loc != topLinks[topPt].url && loc != (topLinks[topPt].url + "#")) {
						//check in the subarray containing the side links
						while(innerLoop) {//no point checking whole array if find the match
							if (sidePt < topLinks[topPt].sideLinks.length) {//there is an inner array entry to check
								//partial address match
								if (loc.substring(0,(side-1)) == topLinks[topPt].sideLinks[sidePt].url.substring(0,(side-1))){
										//must be a subpage of this sidepage
										if (loc != topLinks[topPt].sideLinks[sidePt].url && loc != (topLinks[topPt].sideLinks[sidePt].url + "#")) {
											topLinks[topPt].sideLinks[sidePt].green = true;
											topLinks[topPt].green = true;
											innerLoop = false;//stop the while innerLoop
											loop = false;//stop the while loop
										}
										else{//found the current page, it is a sidepage
											topLinks[topPt].sideLinks[sidePt].currentPage = true;
											topLinks[topPt].sideLinks[sidePt].green = true;
											topLinks[topPt].green = true;
											innerLoop = false;//stop the while innerLoop
											loop = false;//stop the while loop
										}
								}
								else{//not a match
									sidePt++;//need to check the next subarray entry
								}
							}//end 'if'
							else{//somehow, the page isn't in the array, better stop looping
								innerLoop = false;//stop the while innerLoop
								loop = false;//stop the while loop
								error = true;//mark that can't create side navigation rails
							} 
						}						
					}
					else {//found the current page, it is a toppage
						topLinks[topPt].currentPage = true;
						topLinks[topPt].green = true;
						loop = false;//can stop the while loop
					}
				}
				else {//not a match
					topPt++;//need to check the next array entry
				}
			}
			else{//somehow, the page isn't in the array, better stop looping
				loop = false;//stop the while loop
				error = true;//mark that can't create side navigation rails
			} 
		}
	}
}

//assemble the html code that renders the company name, catch phrase, & alternative background in the browser
function createHtmlStandardPageElements()	{	//author www.dogdaydesigns.ca 2003
	info = name + saying;//common page elements
	if (error) {//we only know we are not on the homepage, so use blank crosshair background image
		//this code assumes that we are two folder levels into the site, i.e., ../pages/temp/file.html
		info = info + altBackground;
		info = info +"<div id='logo' style='position:absolute; width:116px; height:58px; z-index:6; left: 14; top: 13'><img src='..\/"+logoSrc+"' width='116' height='58'><\/div>";
		info = info + "<div id='sidebar' style='position:absolute; width:139px; z-index:2; left: 12px; top: 130px'><img src='..\/"+imgSrc+"' width='115' height='300' class='picBox' name='sidebar' alt='scenic photo' >" + copyright + "<\/div>";
	}
}

//loop through the arrays to create the HTML for the navigation rails
function searchArrays(){ //author www.dogdaydesigns.ca 2003
	var divIdCounter = 0;//need to go through the divId array to assign div link names
	var sideHtml = sideNav;//need to store the side html until after closing the top navigation layer
	var divName = "";//div name for a link
	var sideItems = new Array();//array to hold the side navigation array for looping
	for (i=0;i<topLinks.length;i++) {
		//we are on this toppage, or its sidepage or subpages
		if (topLinks[i].green){
			//green = true, currentPage = true, this is the toppage we are on
			if (topLinks[i].currentPage) {
				//add the correct background image
				info = info + openBackground + topLinks[i].relUrl + closeBackground;
				info = info +"<div id='logo' style='position:absolute; width:116px; height:58px; z-index:6; left: 14; top: 13'><img src='"+logoSrc+"' width='116' height='58'><\/div>";
				info = info + "<div id='sidebar' style='position:absolute; width:139px; z-index:2; left: 12px; top: 130px'><img src='"+imgSrc+"' width='115' height='300' class='picBox' name='sidebar' alt='scenic photo' >" + copyright + "<\/div>";
				//loop through the side links
				sideItems = topLinks[i].sideLinks;
				for (j=0;j<sideItems.length;j++){//do not need to check .currentPage since we know a toppage is loaded
					//last navigation link to enter
					if (j == (sideItems.length - 1)){
						divName = divIds[divIdCounter];
						sideHtml = sideHtml + openDiv + divName + openClass + "navBox" + openLink + sideItems[j].url + blue + divName + restore + divName + closeRestore + sideItems[j].name + closeLink;
						divIdCounter++;
					}
					else{//not last navigation link
						if (sideItems[j].spaceAfter){//spaceAfter = true
							divName = divIds[divIdCounter];
							sideHtml = sideHtml + openDiv + divName + openClass + "navBox" + openLink + sideItems[j].url + blue + divName + restore + divName + closeRestore + sideItems[j].name + closeLink + "<br><br><br>";
							divIdCounter++;
						}
						else{//spaceAfter = false
							divName = divIds[divIdCounter];
							sideHtml = sideHtml + openDiv + divName + openClass + "sidenav" + openLink + sideItems[j].url + blue + divName + restore + divName + closeRestore + sideItems[j].name + closeLink;
							divIdCounter++;
						}
					}//end 'else'
				}//end 'for'
				//need to add a navigation entry that is not a link for this loaded page
				//open the outer top navigation layer
				divName = divIds[divIdCounter];
				info = info + openDiv + divName + topNav + topLinks[i].left + closeTopNav;
				divIdCounter++; 
				//last navigation link to enter
				if (i == (topLinks.length - 1)){
					info = info + "<div id='toppage' class='navBoxCur'>" + topLinks[i].name + closeDiv + closeDiv;
				}
				else {//there are more navigation links
					info = info + "<div id='toppage' class='topnavCur'>" + topLinks[i].name + closeDiv + closeDiv;
				}
			}//end 'if'
			else {//green = true, currentPage = false, we are on a subpage or sidepage
				//loop through the sidelinks and check if on a subpage or sidepage
				sideItems = topLinks[i].sideLinks;
				for (j=0;j<sideItems.length;j++){
					if(sideItems[j].green){//we are on this sidepage or a subpage of this sidepage
						//green = true, currentPage = true, we are on this sidepage
						if(sideItems[j].currentPage){
							//add the correct background image
							info = info + openBackground + sideItems[j].relUrl + closeBackground;
							info = info +"<div id='logo' style='position:absolute; width:116px; height:58px; z-index:6; left: 14; top: 13'><img src='..\/"+logoSrc+"' width='116' height='58'><\/div>";
							info = info + "<div id='sidebar' style='position:absolute; width:139px; z-index:2; left: 12px; top: 130px'><img src='..\/"+imgSrc+"' width='115' height='300' class='picBox' name='sidebar' alt='scenic photo' >" + copyright + "<\/div>";
							//last navigation link to enter
							if (j == (sideItems.length - 1)){
								sideHtml = sideHtml + "<div id='sidepage' class='navBoxCur'>" + sideItems[j].name  + closeDiv;
							}
							else{//not last navigation link
								if (sideItems[j].spaceAfter){//spaceAfter = true
									sideHtml = sideHtml + "<div id='sidepage' class='navBoxCur'>" + sideItems[j].name + closeDiv + "<br><br><br>";
								}
								else{//spaceAfter = false
									sideHtml = sideHtml + "<div id='sidepage' class='sidenavCur'>" + sideItems[j].name + closeDiv;
								}
							}//end 'else'	
						}//end 'if'
						else{ //green = true, currentPage = false, we are on a subpage of this sidepage
							//last navigation link to enter
							//add the correct background image
							info = info + openBackground + "..\/" + sideItems[j].relUrl + closeBackground;//need to go up another level
							info = info +"<div id='logo' style='position:absolute; width:116px; height:58px; z-index:6; left: 14; top: 13'><img src='..\/..\/"+logoSrc+"' width='116' height='58'><\/div>";
							info = info + "<div id='sidebar' style='position:absolute; width:139px; z-index:2; left: 12px; top: 130px'><img src='..\/..\/"+imgSrc+"' width='115' height='300' class='picBox' name='sidebar' alt='scenic photo' >" + copyright + "<\/div>";
							if (j == (sideItems.length - 1)){
								divName = divIds[divIdCounter];
								sideHtml = sideHtml + openDiv + divName + openClass + "navBoxCur" + openLink + sideItems[j].url + blue + divName + restore + divName + closeRestoreBlue + sideItems[j].name + closeLink;
								divIdCounter++;
							}
							else{//not last navigation link
								if (sideItems[j].spaceAfter){//spaceAfter = true
									divName = divIds[divIdCounter];
									sideHtml = sideHtml + openDiv + divName + openClass + "navBoxCur" + openLink + sideItems[j].url + blue + divName + restore + divName + closeRestoreBlue + sideItems[j].name + closeLink + "<br><br><br>";
									divIdCounter++;
								}
								else{//spaceAfter = false
									divName = divIds[divIdCounter];
									sideHtml = sideHtml + openDiv + divName + openClass + "sidenavCur" + openLink + sideItems[j].url + blue + divName + restore + divName + closeRestoreBlue + sideItems[j].name + closeLink;
									divIdCounter++;
								}
							}//end 'else'
						}//end 'else'
					}//end 'if'
					else{//green = false, this sidepage is not active
						//last navigation link to enter
						if (j == (sideItems.length - 1)){
							divName = divIds[divIdCounter];
							sideHtml = sideHtml + openDiv + divName + openClass + "navBox" + openLink + sideItems[j].url + blue + divName + restore + divName + closeRestore + sideItems[j].name + closeLink;
							divIdCounter++;
						}
						else{//not last navigation link
							if (sideItems[j].spaceAfter){//spaceAfter = true
								divName = divIds[divIdCounter];
								sideHtml = sideHtml + openDiv + divName + openClass + "navBox" + openLink + sideItems[j].url + blue + divName + restore + divName + closeRestore + sideItems[j].name + closeLink + "<br><br><br>";
								divIdCounter++;
							}
							else{//spaceAfter = false
								divName = divIds[divIdCounter];
								sideHtml = sideHtml + openDiv + divName + openClass + "sidenav" + openLink + sideItems[j].url + blue + divName + restore + divName + closeRestore + sideItems[j].name + closeLink;
								divIdCounter++;
							}
						}//end 'else'
					}//end 'else'
				}//end 'for'
				//open the outer top navigation layer
				divName = divIds[divIdCounter];
				info = info + openDiv + divName + topNav + topLinks[i].left + closeTopNav;
				divIdCounter++;
				//need to add a navigation entry that is a link for this toppage but make it bolded green in color
				//last navigation link to enter
				if (i == (topLinks.length - 1)){
					divName = divIds[divIdCounter];
					info = info + openDiv + divName + openClass + "navBoxCur" + openLink + topLinks[i].url + blue + divName + restore + divName + closeRestoreBlue + topLinks[i].name + closeLink + closeDiv;
					divIdCounter++;
				}
				else {//there are more navigation links
					divName = divIds[divIdCounter];
					info = info + openDiv + divName + openClass + "topnavCur" + openLink + topLinks[i].url + blue + divName + restore + divName + closeRestoreBlue + topLinks[i].name + closeLink + closeDiv;
					divIdCounter++;
				} 				
			}//end 'else'
		}//end 'if'
		else{//green = false (this toppage, and its subpages, are not active)
			//open the outer top navigation layer
			divName = divIds[divIdCounter];
			info = info + openDiv + divName + topNav + topLinks[i].left + closeTopNav;
			divIdCounter++;
			//last navigation link to enter
			if (i == (topLinks.length - 1)){
				divName = divIds[divIdCounter];
				info = info + openDiv + divName + openClass + "navBox" + openLink + topLinks[i].url + blue + divName + restore + divName + closeRestore + topLinks[i].name + closeLink + closeDiv;
				divIdCounter++;
			}
			else {//there are more navigation links
				divName = divIds[divIdCounter];
				info = info + openDiv + divName + openClass + "topnav" + openLink + topLinks[i].url + blue + divName + restore + divName + closeRestore + topLinks[i].name + closeLink + closeDiv;
				divIdCounter++;
			}
		}//end 'else'
	}//end of 'for' loop
	info = info + sideHtml + closeDiv;//add the side navigation layer & close the outer side navigation layer
}

//MACROMEDIA DREAMWEAVER FUNCTION SECTION------------------------------------------------------------------------------

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

MM_reloadPage(true);

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_changeProp(objName,x,theProp,theValue) { //v3.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)) eval("obj."+theProp+"='"+theValue+"'");
}

 
//---------------------------------------------------------------------------------------------------------------------
