<!--
// JavaScript Document
// main_content.js
// Sean Kennedy <sean@guymast.com>
	
/*
  call this function when a page has been loaded in the main frame
  it will then try to load its proper side panel (url) in the side frame (frame)
*/
function openSectionNavigator(frame,url) {
		 if (self.parent != self) {
			 	frame.location.replace(url);
		 }
}
	
/* DOES NOT WORK WITH MSIE!!!
   write an image into the document so that it
   takes up a certain percentage of the window width
*/
function writeImageHorizontal(alt,name,src,widthPercentage) {
	var windowWidth = window.innerWidth;
	var width = widthPercentage * windowWidth / 100;
	
	/*
	document.write(alt);
	document.write(name);
	document.write(src);
	document.write(widthPercentage);
	document.write(windowWidth);
	document.write(width);
	*/
			
	document.write('<IMG alt="' + alt + '" name="' + name + '" src="' + src + '" width="' + width + '">');  
}	
		
/* 
   write the footer onto each page so that we can control them from one spot
   call this function in the body inside the siteInfo div
   section: the main division of the site the user is visiting
   - the main site links will always be displayed
*/
function writeFooter(section) {
		var curDate = new Date();
		var fullPath = document.location.href;
		var commonPath;

		// arrays for the links we'll provide in the footer
		var topLinks = new Array("Home", "Company", "Products", "Support", "Downloads", "OrderDesk", "Community", "Industry", "Engineering");
		var sectionLinks = new Array();
		var linksTarget = "/main.html";
		
		// get the right links for the given section - which has to match one of the topLinks
		switch (section) {
		
			   case topLinks[0]: // Home
			   		break;
			   case topLinks[1]: // Company
			   		sectionLinks[0] = "contact";
					/*sectionLinks[1] = "history";*/
					/*sectionLinks[2] = "employees";*/
					sectionLinks[1] = "careers";
					break;
			   case topLinks[2]: // Products  
					sectionLinks[0] = "guymaster"			   		 			   		
			   		sectionLinks[1] = "tower-analysis-and-design";
					sectionLinks[2] = "drawings";
					sectionLinks[3] = "inspections";
					break;
			   case topLinks[3]: // Support
					sectionLinks[0] = "faqs";
					sectionLinks[1] = "customer-support";
					sectionLinks[2] = "training";
					break;
			   case topLinks[4]: // Downloads
			   		break;
			   case topLinks[5]: // OrderDesk
					sectionLinks[0] = "software-bundles";
			   		sectionLinks[1] = "quote-new-set";
			   		sectionLinks[2] = "quote-upgrade";
					sectionLinks[3] = "order-new-set";
					sectionLinks[4] = "order-upgrade";
					break;
			   case topLinks[6]: // Community
			   		sectionLinks[0] = "discussion-groups";
					sectionLinks[1] = "tips-and-tricks";
					sectionLinks[2] = "newsletter";
					sectionLinks[3] = "my-guymast";
					break;
			   case topLinks[7]: // Inudstry
			   		/*sectionLinks[0] = "about";*/
					sectionLinks[0] = "links";
					break;
			   case topLinks[8]: // Engineering
			   		break;

			   default:
			   		break;
				
		}
		
		
		// don't write links if we're at the site map
		if ("no-links" != section) {
		
   		// extract the start of the path from the href ...
		i = fullPath.lastIndexOf(section);
   		commonPath = fullPath.slice(0,i);
		
		// write the sectionLinks as appropriate...
		document.write('<P>');
		if (sectionLinks.length > 0) {
		    document.write('[ ');
			for (j = 0; j < sectionLinks.length; j++) {
				if (j != 0) { // for formatting purposes
				    document.write(' | ');
				}
			 	document.write('<A href="' + commonPath + section + '/' + sectionLinks[j] + linksTarget + '">' + sectionLinks[j] + '</A>');			
			}
			document.write(' ]<BR>');
		}
		
		// the topLinks appear on every page - they are the main navpoints in the navbar
		// write the topLinks
		document.write('[ ');
		for (k = 0; k < topLinks.length; k++) {
			if (k != 0) { // for formatting purposes
			    document.write(' | ');
			}
		 	document.write('<A href="' + commonPath + topLinks[k] + linksTarget + '">' + topLinks[k] + '</A>');			
		}
		document.write(' ]</P>');
		
		} // end site-map exclusion
				
		// display the document copyright information
		document.write('<P>Copyright Guymast Inc. ' + curDate.getFullYear() + ', all rights reserved.</P>');
		// let them contact the webmaster if they want
		document.write('<A href="mailto:webmaster@guymast.com">webmaster@guymast.com</A>');
}
//-->

