//**************** UPDATES **************************************************************************************************
// November 29, 2005 - put in a condition to check for edition, to keep the comma from appearing if it is blank

// July 2008 - Changed company name from Houghton Mifflin to Cengage in footer

// July 24, 2008:
// - Updated navByChapterForm() so it doesn't create menu option if the value for the chapter is blank; this accommodates demo sites that contain only selected chapters
// - Removed HM Space logo from topNavRight(); also removed link on Online Teaching/Study Center graphic

// Aug. 5 - Updated topNavRight() so that it replaces the generic Cengage logo in the upper left corner with the logo specific to the sub-brand for the site. It determines which logo to add by examining the lowest directory to get the discipline name. New logo is layered over top of the old logo.

// Aug. 18 - Bug fix: In topNavRight(), changed link to sub-brand home pages to absolute link to prevent broken links

// Aug. 21 - Changed RenderHome() so that it scales the book cover image to a width of 87 pixels; the height is automatically scaled proportionally by the browser.

// Sept. 18 - Added setView() function that corrects problem with instructor/student view not being set properly.

// Oct. 6 - Updated bookstoreOrCatalog() and picLink() to replace old URLs for catalog or bookstore with URLs for catalog or bookstore home pages. This eliminates 404s for Catalog and Bookstore links. New URLs (which are correct) aren't replaced

// Oct. 13 - Updated picLink() and bookstoreOrCatalog() to replace Product Information Center URLs going to the old redirects in /PIC; added isOldCatalogUrl() to make it easier to check for old URLs

// Nov. 14 - In topNavRight(), modified RegExp to support Web sites placed on a local hard disk

//*******************************************************************************************************************************

// Detect whether the user has the "instructor cookie" set to determine the view
var instructor = getCookie("insView");
var bc_leftcorner;
var bc_background;
var bc_rightcorner;
var bc_bgColor;


// Set instructor or student view if necessary
setView();

if(instructor)
{
	bc_leftcorner = "/shared/images/site_graphics/ins_crumb_left_corner.gif";
	bc_background = "/shared/images/site_graphics/ins_crumb_background.gif";
	bc_rightcorner = "/shared/images/site_graphics/ins_crumb_right_corner.gif";
	bc_bgColor = "#E2F4E2";
}
else
{
	bc_leftcorner = "/shared/images/site_graphics/stu_crumb_left_corner.gif";
	bc_background = "/shared/images/site_graphics/stu_crumb_background.gif";
	bc_rightcorner = "/shared/images/site_graphics/stu_crumb_right_corner.gif";
	bc_bgColor = "#FEF1E2";
}

// Returns true if URL is for obsolete catalog or bookstore page
function isOldCatalogUrl(urlStr) {
	
	var oldCatalogDir = "/CollegeCatalog/";
	var oldPicUrl = "/PIC/";
	var isOld = false;
	
	// If URL contains old directories
	if ((urlStr.indexOf(oldCatalogDir) != -1) || (urlStr.indexOf(oldPicUrl) != -1)) {
		isOld = true;
	}
	
	return isOld;
	
}

// Set the view of the site to either instructor or student
// if a page is viewed that is specific to either one of those views
function setView() {

	var siteView = "either";
	// URL of loaded page
	var urlStr = document.location.toString();
	// Name of file loaded
	var filename = getFilename(urlStr);
	
	// If an instructor-specific or student-specific file is loaded,
	// specify the appropriate view
	if (filename == "instructor_home.html" || filename == "ins_resources.html") {
		siteView = "instructor";
	} else if (filename == "student_home.html") {
		siteView = "student";
	}
	// If a page is loaded from an instructor-specific directory,
	// specify instructor view
	if ((matchArray = urlStr.match(/\/(instructors|ins_resources)\//)) != null) {
		siteView = "instructor";
	}
	
	// Set the specified view
	if (siteView == "instructor") {
		instructor = "yes";
		setCookie("insView", "yes");
	} else if (siteView == "student") {
		instructor = null;
		deleteCookie("insView");
	}
	
}

// Return filename from a path
function getFilename(fullPath) {
	
	if (!fullPath) {
		return "";
	}
	
	var matchArray = [];
	var filename = "";
	var filenamePattern = /(?:\/|\\)([^\/\\\.]+\.html)/i;
	
	if ((matchArray = fullPath.match(filenamePattern)) != null) {
		filename = matchArray[1];
	}
	
	return filename;
	
}

function bodyOnLoad()
{
	if(document.navbychap)
	{
    		document.navbychap.chapter.selectedIndex=0;
	}
}
// Called from xsl - render the text of the book banner
function bookBannerText(btitle, author, edition)
{
	var bookBannerText = '<SPAN CLASS=\"ui_bb_title\">' + btitle + '</SPAN>';
 	bookBannerText += '<SPAN CLASS=\"ui_bb_edition\">, ' + edition + '</SPAN>';
	bookBannerText += '<SPAN CLASS=\"ui_bb_author\">' + author + '</SPAN>';
	
	return(bookBannerText);
}

   
// Sets whether the bug text is green or orange
function bugTextColor()
{
	var retValue;
	
	if(instructor)
	{
		retValue = "<div class=\"contentpagebuggreen\" STYLE=\"padding-left: 8px; padding-right:8px\">";
	}
	else
	{
		retValue = "<div class=\"contentpagebugorange\" STYLE=\"padding-left: 8px; padding-right:8px\">";
	}
	
	return(retValue);
}
                      
// inserts a </div> inline
function endDiv()
{
	return("</div>");
}
	
//Link to Marketing javascript file
function marketingJs()
{
	var marketingJs = '<SCRIPT LANGUAGE=\"JavaScript\" SRC=\"' + marketingFile + '\"></SCRIPT>';
	
	return(marketingJs);	
}


function breadCrumbStyleLeft()
{
	var bc_styleLeft = "<TD CLASS=\"breadcrumb\" ALIGN=\"left\" STYLE=\"background-image: url(" + bc_background + "); background-repeat: repeat-x\" WIDTH=\"100%\"><IMG ALT=\"For Layout\" align=\"absmiddle\" HEIGHT=\"28\" WIDTH=\"18\" BORDER=\"0\" SRC=\"" + bc_leftcorner +"\">";
	
	return(bc_styleLeft);
}

function breadCrumbStyleRight()
{
	var bc_styleRight = "</TD><TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"13\"><IMG ALT=\"For Layout\" HEIGHT=\"28\" WIDTH=\"13\" BORDER=\"0\" SRC=\"" + bc_rightcorner + "\"></TD>";
	
	return(bc_styleRight);
}


// Render the "header" sections for the student and instructor home pages.
function RenderHome()
{
	document.write("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">");
 	document.write("<tr><td valign=\"top\" style=\"padding-right: 10px;\"><img src=\"" + bookCoverUrl  + "\" width=\"87\" border=\"0\" /></td>");
 	if(instructor)
 	{
 		document.write("<td valign=\"top\"><span class=\"contentpagetitlegreen\">" + booktitle + "</span>");
 		document.write("<span class=\"contentpageaandegreen\">");
 		if(edition != '')
 		{
 			document.write(", " + edition);
 		}
 		document.write("<br>" + author + "</span><br>");
 		document.write("<br><span class=\"contentpageaandegreen\">Instructor Website</span><br><br>");
 		document.write("<span class=\"overviewtext\">" + instructorHomeText + "</span>");
		document.write("</td>");
	}
	else	
	{
 		document.write("<td valign=\"top\"><span class=\"contentpagetitleorange\">" + booktitle + "</span>");
 		document.write("<span class=\"contentpageaandeorange\">");
 		if(edition != '')
 		{
 			document.write(", " + edition);
 		}
 		document.write( "<br>" + author + "</span><br>");
 		document.write("<br><span class=\"contentpageaandeorange\">Student Website</span><br><br>");
 		document.write("<span class=\"overviewtext\">" + studentHomeText + "</span>");
		document.write("</td>");
	}
	
	document.write("</tr></table><br/>");
}

// Render the "header" sections for the student and instructor home pages where two books share the same site.
function RenderHome2()
{
	document.write("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">");
 	document.write("<tr><td valign=\"top\" style=\"padding-right: 10px;\"><img src=\"" + bookCoverUrl  + "\" border=\"0\" /></td>");
 	if(instructor)
 	{
 		document.write("<td valign=\"top\"><span class=\"contentpagetitlegreen\">" + booktitle + "</span>");
 		document.write("<span class=\"contentpageaandegreen\">");
 		if(edition != '')
 		{
 			document.write(", " + edition);
 		}
 		document.write("<br>" + author + "</span><br>");
 		if(booktitle2 != '' && author2 !='')
 		{
	 			document.write("<span class=\"contentpagetitlegreen\">" + booktitle2 + "</span>");
	 			document.write("<span class=\"contentpageaandegreen\">");
 				if(edition2 != '')
 				{
 					document.write(", " + edition2);
 				}
 				document.write("<br>" + author2 + "</span><br>");
 		}
 		document.write("<br>");
 		document.write("<span class=\"overviewtext\">" + instructorHomeText + "</span>");
		document.write("</td>");
	}
	else	
	{
 		document.write("<td valign=\"top\"><span class=\"contentpagetitleorange\">" + booktitle + "</span>");
 		document.write("<span class=\"contentpageaandeorange\">");
 		if(edition != '')
 		{
 			document.write(", " + edition);
 		}
 		document.write( "<br>" + author + "</span><br>");
 		if(booktitle2 != '' && author2 !='')
 		{
	 			document.write("<span class=\"contentpagetitleorange\">" + booktitle2 + "</span>");
	 			document.write("<span class=\"contentpageaandeorange\">");
 				if(edition2 != '')
 				{
 					document.write(", " + edition2);
 				}
 				document.write("<br>" + author2 + "</span><br>");
 		}
 		document.write("<br>");
 		document.write("<span class=\"overviewtext\">" + studentHomeText + "</span>");
		document.write("</td>");
	}
	
	document.write("</tr></table><br/>");
}

//Writes the PIC link in the Breadcrumb

function picLink()
{
	
	// If old URL is specified for PIC,
	// replace it with new URL for catalog home page;
	// don't replace new URL that doesn't contain CollegeCatalog or PIC
	if (isOldCatalogUrl(pic)) {
		pic = "http://www.cengage.com/highered";
	}
	
	var picText = '<A HREF=\"' + pic + '" CLASS=\"breadcrumb_text\">Product Information Center</A>';
	picText += '<span class=\"breadcrumb_text\"> > </span>';
	
	return (picText);
}

// Called from xsl - Renders the Instructor Home / Student Home on breadcrumb depending on view.  If the bucket parameter is empty, the link should be dead... 
function breadCrumb(Type)
{     
	var crumbText;
		
	if(instructor)
	{
		if(Type != ('home') && Type != ('multihome'))
		{
			crumbText = '<A HREF=\"' + bookMainUrl + 'instructor_home.html\" CLASS=\"breadcrumb_text\">Instructor Home</A> <span class=\"breadcrumb_text\"></span>';
 		}
   		else
   		{   			
	 		crumbText = '<span class=\"breadcrumb_text\">Instructor Home</span>';
 		}
	}
	else
	{
		if(Type != ('home') && Type != ('multihome'))
		{
			crumbText = '<A HREF=\"' + bookMainUrl + 'student_home.html\" CLASS=\"breadcrumb_text\">Student Home</A> <span class=\"breadcrumb_text\"></span>';
		}
		else
		{
			crumbText = '<span class=\"breadcrumb_text\">Student Home</span>';	
		}		  
	}
	return (crumbText);	
}

function crumbRightColumn()
{
	var bc_crumbRightColumn = "<TD ALIGN=\"right\" VALIGN=\"top\" BGCOLOR=\"" + bc_bgColor + "\"><IMG ALT=\"For Layout\" HEIGHT=\"28\" WIDTH=\"40\" BORDER=\"0\" SRC=\"/shared/images/site_graphics/crumb_right_edge.gif\"></TD>";
	
	return(bc_crumbRightColumn);
}

function bodyRightColumnBgColor()
{
	var br_bgColor = "<TD CLASS=\"right_horiz\" ALIGN=\"left\" VALIGN=\"top\" WIDTH=\"150\" BGCOLOR=\"" + bc_bgColor + "\">";
	
	return(br_bgColor);
}

function bodyRightColumBottom()
{
	var br_bottom = "<TD ALIGN=\"right\" HEIGHT=\"54\" VALIGN=\"bottom\" BGCOLOR=\"" + bc_bgColor + "\" COLSPAN=\"2\"><IMG ALT=\"For Layout\" HEIGHT=\"54\" WIDTH=\"162\" BORDER=\"0\" SRC=\"/shared/images/site_graphics/body_right_bottom.gif\"></TD>";	
	
	return(br_bottom);
}

// Renders the Navigate by chapter drop down, based on the textArray in the dynamictext.js file
function navByChapterForm(textArray, bucket, chapter)
{
	var navByChapterForm;
	
	if(showDropdown == 'no')
	{
		navByChapterForm = "<IMG ALT=\"For Layout\" WIDTH=\"150\" HEIGHT=\"34\" BORDER=\"0\" SRC=\"/shared/images/site_graphics/spacer.gif\">";
	}
	
	else if (showDropdown == 'alpha')
	{
		navByChapterForm = "<FORM NAME=\"navbychap\" CLASS=\"inline_form\"><SELECT ONCHANGE=\"dropDownRedirect(this)\" NAME=\"chapter\" SIZE=\"1\">";
		
		for (i=0; i < textArray.length; i++)
		{
			if(i == 0)
			{
	 			 navByChapterForm += '<OPTION SELECTED>' + textArray[i] + '</OPTION>';
			}
	  		else
	  		{	 
		  		//ellipsis for max character length
		  		var ellip = textArray[i].toString();
		  		var dDown = '';
		  		if (ellip.length > 22)
		  		{
			  		
			  		for (j=0; j < 22; j++)
			  		{
				  		dDown += ellip.charAt(j);
			  		}
			  		dDown += "...";
		  		}
		  		else
		  		{
			  		dDown = ellip;
		  		}
		  		
		  		//used to generate filenames for the dropdown
		  		//in this case text after the first whitespace is extracted and appended to 'chapter'
		  		var str = textArray[i].toString();
		  		var trap = str.match(/\s(.*)/);
		  		var itemName = RegExp.$1;
		  		itemName = itemName.toLowerCase();		  		
				
				navByChapterForm += '<OPTION VALUE=\"chapters/chapter' + itemName + '.html\" CLASS=\"inline_form_text\">' + dDown + '</OPTION>';
			}
  		}
	}
	
	else if (showDropdown == 'text')
	{
		navByChapterForm = "<FORM NAME=\"navbychap\" CLASS=\"inline_form\"><SELECT ONCHANGE=\"dropDownRedirect(this)\" NAME=\"chapter\" SIZE=\"1\">";
		
		for (i=0; i < textArray.length; i++)
		{
			if(i == 0)
			{
	 			 navByChapterForm += '<OPTION SELECTED>' + textArray[i] + '</OPTION>';
			}
	  		else
	  		{
		  		//ellipsis for max character length
		  		var ellip = textArray[i].toString();		  		
		  		var dDown = '';
		  		if (ellip.length > 19)
		  		{			  		
			  		for (j=0; j < 19; j++)
			  		{
				  		dDown += ellip.charAt(j);
			  		}
			  		dDown += "...";			  		
		  		}
		  		else
		  		{
			  		dDown = ellip;
		  		}
		  		
		  		var str = textArray[i].toString();
		  		str = str.toLowerCase();
		  		//strip out whitespace and nonWord characters
		  		var trap = str.match(/(\s|\W)/);
		  		if (trap)
		  		{
			  		str = str.replace(/\s/g,"");
			  		str = str.replace(/\W/g,"");
		  		}		  				  		
		  		
		  		navByChapterForm += '<OPTION VALUE=\"chapters/' + str + '.html\" CLASS=\"inline_form_text\">' + dDown + '</OPTION>';
	  		}
  		}
	}	
	else
	{			
 	    navByChapterForm = "<FORM NAME=\"navbychap\" CLASS=\"inline_form\"><SELECT ONCHANGE=\"dropDownRedirect(this)\" NAME=\"chapter\" SIZE=\"1\">";
    
		for (i=0; i < textArray.length; i++)
		{
			if(i == 0)
			{
	 			 navByChapterForm += '<OPTION SELECTED>' + textArray[i] + '</OPTION>';
			}
			else
			{
				//ellipsis for max character length
		  		var ellip = textArray[i].toString();
		  		var dDown = '';
		  		if (ellip.length > 22)
		  		{
			  		
			  		for (j=0; j < 22; j++)
			  		{
				  		dDown += ellip.charAt(j);
			  		}
			  		dDown += "...";
		  		}
		  		else
		  		{
			  		dDown = ellip;
		  		}
				// Don't create menu option if the value for that chapter is blank;
				// this accommodates demo sites that contain only one or two chapters
				if (textArray[i])
		  		{
					navByChapterForm += '<OPTION VALUE=\"chapters/chapter' + i + '.html\" CLASS=\"inline_form_text\">' + dDown + '</OPTION>';
				}
  			}
  		}
  		
		navByChapterForm += "</SELECT></FORM>"
	}
	
	return(navByChapterForm);
}

//Redirects user based upon selected dropdown option
function dropDownRedirect(selector)
{
	if(selector.selectedIndex != 0)
	{
		location.href = bookMainUrl + selector.options[selector.selectedIndex].value;
		selector.selectedIndex = 0;
	}
}
//Writes the appropriate discipline homepage link based upon user type
function disciplineHome(insHome, stuHome)
{
	if (instructor)
	{
		var disciplineHome = '<A HREF=\"' + insHome + '\" CLASS=\"top_nav_horiz\">Discipline Home</A>';
		
		return(disciplineHome);
	}
	else
	{
		var disciplineHome = '<A HREF=\"' + stuHome + '\" CLASS=\"top_nav_horiz\">Discipline Home</A>';
		
		return(disciplineHome);
	}
}
//Writes the appropriate application text and link(bookstore or catalog) based upon user type
function bookstoreOrCatalog(bookstoreUrl, catalogUrl)
{
	
	var targetStr = "";
	
	// If old URLs are specified for catalog or bookstore,
	// replace them with URLs for catalog or bookstore home pages;
	// don't replace new URLs that don't contain CollegeCatalog
	if (isOldCatalogUrl(catalogUrl)) {
		catalogUrl = "http://www.cengage.com/highered";
	}
	if (isOldCatalogUrl(bookstoreUrl)) {
		bookstoreUrl = "http://www.ichapters.com";
		// Open iChapters page in new window, because you can't use
		// the browser Back  button to return to the companion site
		// from iChapters
		targetStr = ' target="_blank"';
	}
	
	if (instructor)
	{
		var catalog = '<A HREF=\"' + catalogUrl + '\" CLASS=\"top_nav_horiz\">Catalog</A>';
		
		return(catalog);	
	}
	else
	{
		var bookstore = '<A HREF=\"' + bookstoreUrl + '\" CLASS=\"top_nav_horiz\"' + targetStr + '>Bookstore</A>';
		
		return(bookstore);
	}
}
//Writes the Instructor Resources left nav element if the user is an instructor
function insResourceLink(namedResource)
{
	if (namedResource == 'ins_res')
	{
		var cssClass = 'lnav_text_on';
	}
	else
	{
		var cssClass = 'lnav_text';
	}
	if (instructor)
	{
		var leftNavBtn = '<TR>';
		leftNavBtn += '<TD WIDTH=\"15\" STYLE=\"background-image: url(/shared/images/site_graphics/top_nav_edge_left_expander.gif)\" VALIGN=\"top\" ALIGN=\"left\"><IMG SRC=\"/shared/images/site_graphics/top_nav_edge_left_expander.gif\" BORDER=\"0\" WIDTH=\"15\" ALT=\"For Layout\"/></TD>';
		leftNavBtn += '<TD WIDTH=\"31\" BGCOLOR=\"#005AC4\" VALIGN=\"top\" ALIGN=\"left\"><A HREF=\"' + bookMainUrl + 'ins_resources.html\" CLASS=\"'+ cssClass +'\" ONMOUSEOVER=\"if (document.images) document.ins_res.src= \'/shared/images/site_graphics/lnav_ins_res_over.gif\';\" ONMOUSEOUT=\"if (document.images) document.ins_res.src= \'/shared/images/site_graphics/lnav_ins_res.gif\';\"><IMG NAME=\"ins_res\" SRC=\"/shared/images/site_graphics/lnav_ins_res.gif\" BORDER=\"0\" WIDTH=\"31\" ALT=\"Navigation Icon\"/></A></TD>';
		leftNavBtn += '<TD WIDTH=\"124\" BGCOLOR=\"#005AC4\" ALIGN=\"left\"><A HREF=\"' + bookMainUrl + 'ins_resources.html\" CLASS=\"'+ cssClass +'\" ONMOUSEOVER=\"if (document.images) document.ins_res.src= \'/shared/images/site_graphics/lnav_ins_res_over.gif\';\" ONMOUSEOUT=\"if (document.images) document.ins_res.src= \'/shared/images/site_graphics/lnav_ins_res.gif\';\">Instructor Resources</A></TD>';
		leftNavBtn += '</TR>';
		
		return(leftNavBtn);
	}	
	else
	{
		var leftNavComment = '<!--This is the Student View-->';
		
		return(leftNavComment);
	}
}
             
//Writes the Resources image table cell
function resourcesImg()
{
	var resourcesImg = '<A HREF=\"' + bookMainUrl + 'resources.html\" CLASS=\"lnav_text\" ONMOUSEOVER=\"if (document.images) document.resources.src= \'/shared/images/site_graphics/lnav_resources_over.gif\';\" ONMOUSEOUT=\"if (document.images) document.resources.src= \'/shared/images/site_graphics/lnav_resources.gif\';\"><IMG NAME=\"resources\" SRC=\"/shared/images/site_graphics/lnav_resources.gif\" BORDER=\"0\" WIDTH=\"31\" ALT=\"Navigation Icon\"/></A>';
	
	return (resourcesImg);	
}

//Writes the Resources text table cell
function resourcesBtn(namedResource)
{
	if (namedResource == 'resources')
	{
		var cssClass = 'lnav_text_on';
	}
	else
	{
		var cssClass = 'lnav_text';
	}
	var resourcesBtn = '<A HREF=\"' + bookMainUrl + 'resources.html\" CLASS=\"'+ cssClass +'\" ONMOUSEOVER=\"if (document.images) document.resources.src= \'/shared/images/site_graphics/lnav_resources_over.gif\';\" ONMOUSEOUT=\"if (document.images) document.resources.src= \'/shared/images/site_graphics/lnav_resources.gif\';\">General Resources</A>';
	
	return (resourcesBtn);	
}

//Writes the OME image table cell
function OMEImg(OMEUrl)
{
	var OMEImg = '<A HREF=\"javascript:ow(\'' + OMEUrl + '\',1,620,400,1,0,0,0,0,1,100,50)\" CLASS=\"lnav_text\" ONMOUSEOVER=\"if (document.images) document.resources.src= \'/shared/images/site_graphics/lnav_ebook_over.gif\';\" ONMOUSEOUT=\"if (document.images) document.resources.src= \'/shared/images/site_graphics/lnav_resources.gif\';\"><IMG NAME=\"resources\" SRC=\"/shared/images/site_graphics/lnav_ebook.gif\" BORDER=\"0\" WIDTH=\"31\" ALT=\"Navigation Icon\"/></A>';
	
	return (OMEImg);	
}

//Writes the OME text table cell
function OMEBtn(OMEUrl)
{
	var OMEBtn = '<A HREF=\"javascript:ow(\'' + OMEUrl + '\',1,800,600,1,0,0,0,0,1,100,50)\" CLASS=\"lnav_text\" ONMOUSEOVER=\"if (document.images) document.resources.src= \'/shared/images/site_graphics/lnav_resources_over.gif\';\" ONMOUSEOUT=\"if (document.images) document.resources.src= \'/shared/images/site_graphics/lnav_resources.gif\';\">Multimedia eBook</A>';
	
	return (OMEBtn);	
}

//Writes out the "extra" links that appear under the left nav end graphic ( the Login and software plugin links)
function AdditionalLeftNavLinks()
{
	var addLeftNav;
	addLeftNav = "";
	
	if(instructor)
	{
		addLeftNav = '<A HREF=\"javascript:ow(\'/how/how_stu_password_help.html\',0)\">Login or Passkey Help</A>';
	}
	
	if(typeof(studentProtected) != 'undefined')
	{
		if(studentProtected != '')
			addLeftNav = '<A HREF=\"javascript:ow(\'/how/how_stu_password_help.html\',0)\">Login or Passkey Help</A>';
	}
	
	addLeftNav += '<br/><A HREF=\"javascript:ow(\'/how/help/index.html\',0)\">System Requirements</A>';
	
	return(addLeftNav);
}

//Writes the Tutoring Center image table cell
function tutoringCenterImg(url)
{
	var tutoringCenterImg;
	
	if(url)
	{
	 	tutoringCenterImg = '<A HREF=\"javascript:ow(\'' + url + '\',0)\" CLASS=\"lnav_text\" ONMOUSEOVER=\"if (document.images) document.smart_thinking.src= \'/shared/images/site_graphics/lnav_smart_thinking_over.gif\';\" ONMOUSEOUT=\"if (document.images) document.smart_thinking.src= \'/shared/images/site_graphics/lnav_smart_thinking.gif\';\"><IMG NAME=\"smart_thinking\" SRC=\"/shared/images/site_graphics/lnav_smart_thinking.gif\" BORDER=\"0\" WIDTH=\"31\" ALT=\"Navigation Icon\"/></A>';
	}
	else
 	{
		tutoringCenterImg = '<!-- No Smarthinking -->';
	}                             	
	
	return (tutoringCenterImg);	
}

//Writes the Tutoring Center text table cell
function tutoringCenterBtn(url)
{
	var tutoringCenterBtn;
	
	if(url)
	{
		tutoringCenterBtn = '<A HREF=\"javascript:ow(\'' + url + '\',0)\" CLASS=\"lnav_text\" ONMOUSEOVER=\"if (document.images) document.smart_thinking.src= \'/shared/images/site_graphics/lnav_smart_thinking_over.gif\';\" ONMOUSEOUT=\"if (document.images) document.smart_thinking.src= \'/shared/images/site_graphics/lnav_smart_thinking.gif\';\"><SPAN STYLE=\"font-variant: small-caps\">Smarthinking</SPAN><BR>Tutoring Center</A>';
	}
	else
	{
		tutoringCenterBtn = '<!-- No Smarthinking -->';
	}
	
	return (tutoringCenterBtn);	
}
//Writes the Site Index image table cell
function siteIndexImg()
{
	var siteIndexImg = '<A HREF=\"' + bookMainUrl + 'site_index.html\" CLASS=\"lnav_text\" ONMOUSEOVER=\"if (document.images) document.site_index.src= \'/shared/images/site_graphics/lnav_site_index_over.gif\';\" ONMOUSEOUT=\"if (document.images) document.site_index.src= \'/shared/images/site_graphics/lnav_site_index.gif\';\"><IMG NAME=\"site_index\" SRC=\"/shared/images/site_graphics/lnav_site_index.gif\" BORDER=\"0\" WIDTH=\"31\" ALT=\"Navigation Icon\"/></A>';
	
	return (siteIndexImg);	
}
//Writes the Site Index text table cell
function siteIndexBtn(namedResource)
{
	if (namedResource == 'site_index')
	{
		var cssClass = 'lnav_text_on';
	}
	else
	{
		var cssClass = 'lnav_text';
	}
	var siteIndexBtn = '<A HREF=\"' + bookMainUrl + 'site_index.html\" CLASS=\"'+ cssClass +'\" ONMOUSEOVER=\"if (document.images) document.site_index.src= \'/shared/images/site_graphics/lnav_site_index_over.gif\';\" ONMOUSEOUT=\"if (document.images) document.site_index.src= \'/shared/images/site_graphics/lnav_site_index.gif\';\">Site Map</A>';
	
	return (siteIndexBtn);	
}
//Writes the Prepare for Class image table cell
function prepareImg(chapter)
{
	if (showDropdown == 'text')
	{
		var prepareImg = '<A HREF=\"' + bookMainUrl + 'prepare/' + chapter + '.html\" CLASS=\"lnav_text\" ONMOUSEOVER=\"if (document.images) document.prepare.src= \'/shared/images/site_graphics/lnav_prepare_over.gif\';\" ONMOUSEOUT=\"if (document.images) document.prepare.src= \'/shared/images/site_graphics/lnav_prepare.gif\';\"><IMG NAME=\"prepare\" SRC=\"/shared/images/site_graphics/lnav_prepare.gif\" BORDER=\"0\" WIDTH=\"31\" ALT=\"Navigation Icon\"/></A>';
	}
	else
	{
		var prepareImg = '<A HREF=\"' + bookMainUrl + 'prepare/prepare' + chapter + '.html\" CLASS=\"lnav_text\" ONMOUSEOVER=\"if (document.images) document.prepare.src= \'/shared/images/site_graphics/lnav_prepare_over.gif\';\" ONMOUSEOUT=\"if (document.images) document.prepare.src= \'/shared/images/site_graphics/lnav_prepare.gif\';\"><IMG NAME=\"prepare\" SRC=\"/shared/images/site_graphics/lnav_prepare.gif\" BORDER=\"0\" WIDTH=\"31\" ALT=\"Navigation Icon\"/></A>';
	}
	
	return (prepareImg);	
}
//Writes the Prepare for Class text table cell
function prepareBtn(chapter,namedResource)
{
	if (namedResource == 'prepare')
	{
		var cssClass = 'lnav_text_on';
	}
	else
	{
		var cssClass = 'lnav_text';
	}
	
	if (showDropdown == 'text')
	{
		var prepareBtn = '<A HREF=\"' + bookMainUrl + 'prepare/' + chapter + '.html\" CLASS=\"'+ cssClass +'\" ONMOUSEOVER=\"if (document.images) document.prepare.src= \'/shared/images/site_graphics/lnav_prepare_over.gif\';\" ONMOUSEOUT=\"if (document.images) document.prepare.src= \'/shared/images/site_graphics/lnav_prepare.gif\';\">Prepare For Class</A>';
	}
	else
	{	
		var prepareBtn = '<A HREF=\"' + bookMainUrl + 'prepare/prepare' + chapter + '.html\" CLASS=\"'+ cssClass +'\" ONMOUSEOVER=\"if (document.images) document.prepare.src= \'/shared/images/site_graphics/lnav_prepare_over.gif\';\" ONMOUSEOUT=\"if (document.images) document.prepare.src= \'/shared/images/site_graphics/lnav_prepare.gif\';\">Prepare For Class</A>';
	}
	
	return (prepareBtn);	
}
//Writes the Improve Your Grade image table cell
function improveImg(chapter)
{
	if (showDropdown == 'text')
	{
		var improveImg = '<A HREF=\"' + bookMainUrl + 'improve/' + chapter + '.html\" CLASS=\"lnav_text\" ONMOUSEOVER=\"if (document.images) document.improve.src= \'/shared/images/site_graphics/lnav_improve_over.gif\';\" ONMOUSEOUT=\"if (document.images) document.improve.src= \'/shared/images/site_graphics/lnav_improve.gif\';\"><IMG NAME=\"improve\" SRC=\"/shared/images/site_graphics/lnav_improve.gif\" BORDER=\"0\" WIDTH=\"31\" ALT=\"Navigation Icon\"/></A>';
	}
	else
	{
		var improveImg = '<A HREF=\"' + bookMainUrl + 'improve/improve' + chapter + '.html\" CLASS=\"lnav_text\" ONMOUSEOVER=\"if (document.images) document.improve.src= \'/shared/images/site_graphics/lnav_improve_over.gif\';\" ONMOUSEOUT=\"if (document.images) document.improve.src= \'/shared/images/site_graphics/lnav_improve.gif\';\"><IMG NAME=\"improve\" SRC=\"/shared/images/site_graphics/lnav_improve.gif\" BORDER=\"0\" WIDTH=\"31\" ALT=\"Navigation Icon\"/></A>';
	}
	
	return (improveImg);	
}
//Writes the Improve Your Grade text table cell
function improveBtn(chapter,namedResource)
{
	if (namedResource == 'improve')
	{
		var cssClass = 'lnav_text_on';
	}
	else
	{
		var cssClass = 'lnav_text';
	}
	
	if (showDropdown == 'text')
	{
		var improveBtn = '<A HREF=\"' + bookMainUrl + 'improve/' + chapter + '.html\" CLASS=\"'+ cssClass +'\" ONMOUSEOVER=\"if (document.images) document.improve.src= \'/shared/images/site_graphics/lnav_improve_over.gif\';\" ONMOUSEOUT=\"if (document.images) document.improve.src= \'/shared/images/site_graphics/lnav_improve.gif\';\">Improve Your Grade</A>';
	}
	else
	{
		var improveBtn = '<A HREF=\"' + bookMainUrl + 'improve/improve' + chapter + '.html\" CLASS=\"'+ cssClass +'\" ONMOUSEOVER=\"if (document.images) document.improve.src= \'/shared/images/site_graphics/lnav_improve_over.gif\';\" ONMOUSEOUT=\"if (document.images) document.improve.src= \'/shared/images/site_graphics/lnav_improve.gif\';\">Improve Your Grade</A>';
	}
	
	return (improveBtn);	
}
//Writes the ACE the Test image table cell
function aceImg(chapter)
{
	if (showDropdown == 'text')
	{
		var aceImg = '<A HREF=\"' + bookMainUrl + 'ace/' + chapter + '.html\" CLASS=\"lnav_text\" ONMOUSEOVER=\"if (document.images) document.ace.src= \'/shared/images/site_graphics/lnav_ace_over.gif\';\" ONMOUSEOUT=\"if (document.images) document.ace.src= \'/shared/images/site_graphics/lnav_ace.gif\';\"><IMG NAME=\"ace\" SRC=\"/shared/images/site_graphics/lnav_ace.gif\" BORDER=\"0\" WIDTH=\"31\" ALT=\"Navigation Icon\"/></A>';
	}
	else
	{
		var aceImg = '<A HREF=\"' + bookMainUrl + 'ace/ace' + chapter + '.html\" CLASS=\"lnav_text\" ONMOUSEOVER=\"if (document.images) document.ace.src= \'/shared/images/site_graphics/lnav_ace_over.gif\';\" ONMOUSEOUT=\"if (document.images) document.ace.src= \'/shared/images/site_graphics/lnav_ace.gif\';\"><IMG NAME=\"ace\" SRC=\"/shared/images/site_graphics/lnav_ace.gif\" BORDER=\"0\" WIDTH=\"31\" ALT=\"Navigation Icon\"/></A>';
	}
	
	return (aceImg);	
}
//Writes the ACE the Test text table cell
function aceBtn(chapter,namedResource)
{
	if (namedResource == 'ace')
	{
		var cssClass = 'lnav_text_on';
	}
	else
	{
		var cssClass = 'lnav_text';
	}
	
	if (showDropdown == 'text')
	{
		var aceBtn = '<A HREF=\"' + bookMainUrl + 'ace/' + chapter + '.html\" CLASS=\"'+ cssClass +'\" ONMOUSEOVER=\"if (document.images) document.ace.src= \'/shared/images/site_graphics/lnav_ace_over.gif\';\" ONMOUSEOUT=\"if (document.images) document.ace.src= \'/shared/images/site_graphics/lnav_ace.gif\';\">ACE the Test</A>';
	}
	else
	{
		var aceBtn = '<A HREF=\"' + bookMainUrl + 'ace/ace' + chapter + '.html\" CLASS=\"'+ cssClass +'\" ONMOUSEOVER=\"if (document.images) document.ace.src= \'/shared/images/site_graphics/lnav_ace_over.gif\';\" ONMOUSEOUT=\"if (document.images) document.ace.src= \'/shared/images/site_graphics/lnav_ace.gif\';\">ACE the Test</A>';
	}
	
	return (aceBtn);	
}
//Writes the Top Navigation based upon audience type.  The instructor 'view' gets two extra links - Find Your Rep and HM Services 
function topNavLinks()
{
	
	if (instructor)
	{
		var topNavLinks = '<TD ALIGN=\"left\" BGCOLOR=\"#005AC4\" WIDTH=\"8\"><IMG ALT=\"For Layout\" BORDER=\"0\" WIDTH=\"8\" SRC=\"/shared/images/site_graphics/spacer.gif\"></TD><TD CLASS=\"top_nav_horiz\">|</TD><TD ALIGN=\"left\" BGCOLOR=\"#005AC4\" WIDTH=\"8\"><IMG ALT=\"For Layout\" BORDER=\"0\" WIDTH=\"8\" SRC=\"/shared/images/site_graphics/spacer.gif\"></TD>';		
		topNavLinks += '<TD HEIGHT=\"34\" BGCOLOR=\"#005AC4\" ALIGN=\"left\"><A HREF=\"javascript:ow(\'http://www.cengage.com/findrep.html\')\" CLASS=\"top_nav_horiz\">Find Your Rep</A></TD>';
		topNavLinks += '<TD ALIGN=\"left\" BGCOLOR=\"#005AC4\" WIDTH=\"8\"><IMG ALT=\"For Layout\" BORDER=\"0\" WIDTH=\"8\" SRC=\"/shared/images/site_graphics/spacer.gif\"></TD><TD CLASS=\"top_nav_horiz\">|</TD><TD ALIGN=\"left\" BGCOLOR=\"#005AC4\" WIDTH=\"8\"><IMG ALT=\"For Layout\" BORDER=\"0\" WIDTH=\"8\" SRC=\"/shared/images/site_graphics/spacer.gif\"></TD>';
		topNavLinks += '<TD HEIGHT=\"34\" BGCOLOR=\"#005AC4\" ALIGN=\"left\"><A HREF=\"/instructors/ins_teamup.html\" CLASS=\"top_nav_horiz\">HM Services</A></TD>';
		topNavLinks += '<TD WIDTH=\"100%\" ALIGN=\"right\" BGCOLOR=\"#005AC4\"><IMG ALT=\"For Layout\" BORDER=\"0\" SRC=\"/shared/images/site_graphics/spacer.gif\"></TD>';		
		
		return(topNavLinks);
	}	
	else
	{
		var topNavLinks = '<TD WIDTH=\"100%\" ALIGN=\"right\" BGCOLOR=\"#005AC4\"><IMG ALT=\"For Layout\" BORDER=\"0\" SRC=\"/shared/images/site_graphics/spacer.gif\"></TD>';
		
		return(topNavLinks);
	}
}

function topNavRight()
{
	
	var urlStr = document.location.toString();
	var discipline = "";
	var subbrand = "";
	var logoImage = "";
	var subbrandDir = "";
	var imageUrl = "/images/header_logos/";
	var matchArray = new Array();
	// For extracting discipline name from site URL
	if ((matchArray = urlStr.match(/(?:http\:\/\/|file\:\/\/\/)[^\/]+\/([^\/]+)\//)) != null) {
		discipline = matchArray[1];
	}

	// Lookup table for discipline to sub-brand
	var disciplinesArray = [
							[["chemistry", "physicalscience", "mathematics"], "Brooks_Cole"],
							[["languages"], "Heinle"],
							[["accounting", "business", "economics"], "South_Western"],
							[["devenglish", "education", "english", "history", "polisci", "psychology", "collegesurvival", "masterstudent"], "Wadsworth"]
							];
	// Lookup table for sub-brand to logo filename and home page
	var subbrandsList = {
						  Brooks_Cole : ["brookscole_logo", "brookscole"],
						  Heinle : ["heinle_logo", "heinle"],
						  South_Western : ["soutWestern", "southwestern"],
						  Wadsworth : ["Wadsorth_logo", "wadsworth"]
							};
							
	// For each sub-brand
	for (var subbrandInd = 0; subbrandInd < disciplinesArray.length; subbrandInd ++) {
		// For each discipline name, get the sub-brand logo and home page
		for (var disciplineInd = 0; disciplineInd < disciplinesArray[subbrandInd][0].length; disciplineInd ++) {
			if (discipline == disciplinesArray[subbrandInd][0][disciplineInd]) {
				subbrand = disciplinesArray[subbrandInd][1];
				logoImage = subbrandsList[subbrand][0];
				subbrandDir = subbrandsList[subbrand][1];
			}
		}
	}

// Code to display HM Space logo removed
//	if(typeof(hmspace) != 'undefined')
//	{
//		if(hmspace != '')
//		{
//			var topNavRight = '<TD ALIGN=\"right\" WIDTH=\"313\" BGCOLOR=\"#FFFFFF\"><IMG SRC=\"/shared/images/site_graphics/hmspace_' + hmspace + '.gif\" WIDTH=\"313\" BORDER=\"0\" HEIGHT=\"65\" /></TD>';
//		
//		return(topNavRight);
//		}
//	}
	
	if (instructor)
	{
		var topNavRight = '<TD ALIGN=\"right\" WIDTH=\"313\" BGCOLOR=\"#FFFFFF\"><IMG SRC=\"/shared/images/site_graphics/online_teaching_center.gif\" WIDTH=\"313\" BORDER=\"0\" HEIGHT=\"65\" ALT=\"You are in the Online Teaching Center\"/></TD>';
		
	}	
	else
	{
		var topNavRight = '<TD WIDTH=\"313\" BGCOLOR=\"#FFFFFF\"><IMG SRC=\"/shared/images/site_graphics/online_learning_center.gif\" WIDTH=\"313\" BORDER=\"0\" HEIGHT=\"65\" ALT=\"You are in the Online Learning Center\"/></TD>';
		
	}
	
	// Add correct Cengage logo and link to sub-brand home page in upper left;
	// this will cover up the old logo.
	topNavRight = '<div id="logoLayer" style="position:absolute; width:289px; height:52px; z-index:1; left: 0px; top: 0px; padding-top: 10px; padding-left: 10px; clip: rect(auto,270px,auto,auto); background-color: #FFFFFF; visibility: visible"><a href="http://www.cengage.com/' + subbrandDir + '"><img src="' + imageUrl + logoImage + '.jpg" border="0"></a></div>' + topNavRight;
	
	return(topNavRight);
}


//Writes the instructor resource options in the site index if the instructor cookie is set
function siteIndexInsRes(parentID, type)
{
	var id = parentID + type + '_layer';
	if (instructor)
	{
			var ins_res = '<a class=\"mapitem\" text-decoration: none\" href=\"javascript:showLevel(\'' + id + '\')\" onFocus=\"this.blur()\"><img id=\"' + id + 'arrow\" src=\"/shared/images/site_graphics/arrow_right.gif\" border=\"0\" width=\"20\" height=\"15\" align=\"absmiddle\"/>Instructor Resources</a><br/>';
	}
	else
	{
		var ins_res = "<!-- Student View - Ins Resources omitted -->";
	}
	return(ins_res);
}



// Called from xsl - renders out the College Division Website footer content
function footer()
{
	var code = "<!-- footer CS -->\n";
	code += "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n";	
	code +=	"<tr>\n";	
	if(instructor)
	{
		code += "<td width=\"100%\" background=\"/shared/images/site_graphics/ins_ruleline_tile.gif\"><img src=\"/shared/images/site_graphics/spacer.gif\" width=\"1\" height=\"4\" alt=\"For Layout\" border=\"0\"/></td>\n";
	}
	else
	{
		code += "<td width=\"100%\" background=\"/shared/images/site_graphics/stu_ruleline_tile.gif\"><img src=\"/shared/images/site_graphics/spacer.gif\" width=\"1\" height=\"4\" alt=\"For Layout\" border=\"0\"/></td>\n";
	}
	code += "</tr>\n";
	code += "<tr>\n";
	code += "<td><img src=\"/shared/images/site_graphics/spacer.gif\" width=\"1\" height=\"4\" alt=\"For Layout\" border=\"0\"/></td>\n";                                              
	code += "</tr>\n";
	code += "<tr>\n";
	code += "<td align=\"left\" class=\"footer\">\n";
	code += "<a href=\"http://www.cengage.com/press\" class=\"footer\">Press Releases</a> <SPAN class=\"footerblue\">I</SPAN>\n"; 
	code += "<a href=\"http://www.cengage.com\" class=\"footer\">Company Home</a> <SPAN class=\"footerblue\">I</SPAN>\n"; 
	code += "<a href=\"http://www.cengage.com/contact\" class=\"footer\">Contact Us</a><br/>\n";
	code += "<SPAN class=\"footercopyright\">&#169;</SPAN> 2005-2008 Copyright Cengage Learning. All Rights Reserved.<br/>\n";
	code += "<a href=\"http://www.cengage.com/privacy\" class=\"footer\">Privacy Policy</a> <SPAN class=\"footerblue\">I</SPAN>  <a href=\"http://www.cengage.com/terms\" class=\"footer\">Terms of Use</a> <SPAN class=\"footerblue\"></SPAN>\n";
	code += "</td>\n";
	code += "</tr>\n";
	code += "</table>\n";
	code += "<!-- end footer CS -->\n";
	
	return(code);
}

function titleTextColor()
{
	var retValue;
	
	if(instructor)
	{
		retValue = "<div class=\"contentpagetitlegreen\">";
	}
	else
	{
		retValue = "<div class=\"contentpagetitleorange\">";
	}
	
	return(retValue);
}

function subtitleTextColor()
{
	var retValue;
	
	if(instructor)
	{
		retValue = "<div class=\"contentpageaandegreen\">";
	}
	else
	{
		retValue = "<div class=\"contentpageaandeorange\">";
	}
	
	return(retValue);
}

// The following 3 functions are all involved in the setting/retreiving of the cookie that identies whether the view should be student of instructor
/*
   name - name of the cookie
   value - value of the cookie
   [expires] - expiration date of the cookie
     (defaults to end of current session)
   [path] - path for which the cookie is valid
     (defaults to path of calling document)
   [domain] - domain for which the cookie is valid
     (defaults to domain of calling document)
   [secure] - Boolean value indicating if the cookie transmission requires
     a secure transmission
   * an argument defaults when it is assigned null as a placeholder
   * a null placeholder is not required for trailing omitted arguments
*/

function setCookie(name, value, expires, path, domain, secure) {
	var expires = new Date();
	path = "/";
	var oneYearFromNow = expires.getTime() + (365 * 24 * 60 * 60 * 1000);
	expires.setTime(oneYearFromNow);
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}


/*
  name - name of the desired cookie
  return string containing value of specified cookie or null
  if cookie does not exist
*/

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}


/*
   name - name of the cookie
   [path] - path of the cookie (must be same as path used to create cookie)
   [domain] - domain of the cookie (must be same as domain used to
     create cookie)
   path and domain default if assigned null or omitted if no explicit
     argument proceeds
*/

function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
	path = "/";
    document.cookie = name + "=" +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

function hideLevel( _levelId)
{	
	var thisLevel = document.getElementById( _levelId );
	var imageId = _levelId + 'arrow';
	var thisArrow = document.getElementById( imageId );	
   
	thisLevel.style.display = "none";
	thisArrow.src = '/shared/images/site_graphics/arrow_right.gif';

}

function showLevel( _levelId)
{
	var thisLevel = document.getElementById( _levelId );
	var imageId = _levelId + 'arrow';		
	var thisArrow = document.getElementById(  imageId );
		
	if ( thisLevel.style.display == "none")
	{
		thisLevel.style.display = "block"; 
		thisArrow.src = '/shared/images/site_graphics/arrow_down.gif';
	}
	else
	{
		hideLevel( _levelId);
	}	
}

function setOverview(id, imgNum, aud)
{
	var imageId =  'overview' + imgNum;
	var labelId = id + '_label';
	var thisImg = document.getElementById(  imageId );
	
	if(id != 'gen_nav')
	{	
		document.getElementById('gen_nav').style.display = "none";
		document.getElementById('overview1').src = '/shared/images/site_graphics/overview_' + aud + '_01_off.gif';
		document.getElementById('gen_nav_label').style.textDecoration = "none";
	}
	
	if(id != 'instruct_res' && aud == "ins")
	{
		document.getElementById('instruct_res').style.display = "none";
		document.getElementById('overview2').src = '/shared/images/site_graphics/overview_' + aud + '_02_off.gif';
		document.getElementById('instruct_res_label').style.textDecoration = "none";
	}
	
	if(id != 'gen_res')
	{
		document.getElementById('gen_res').style.display = "none";
	  	document.getElementById('overview3').src = '/shared/images/site_graphics/overview_' + aud + '_03_off.gif';
	  	document.getElementById('gen_res_label').style.textDecoration = "none";
	}
	
	if( id != 'smart')
	{
		if(document.getElementById('smart'))
		{
			document.getElementById('smart').style.display = "none";
			document.getElementById('overview4').src = '/shared/images/site_graphics/overview_' + aud + '_04_off.gif';
			document.getElementById('smart_label').style.textDecoration = "none";
		}
	}
	
	if(id != 'map')
	{	
		document.getElementById('map').style.display = "none";
		document.getElementById('overview5').src = '/shared/images/site_graphics/overview_' + aud + '_05_off.gif';
		document.getElementById('map_label').style.textDecoration = "none";
	}
	
	document.getElementById(labelId).style.textDecoration = "underline";
	document.getElementById(id).style.display = "block";
	thisImg.src = '/shared/images/site_graphics/overview_' + aud + '_0' + imgNum + '_on.gif';
}

//********NOTE- Please read the function documentation to properly utilize the window open function

/*function to open a new window using customizable window attributes OR by just using default attributes.

The function takes a slew of parameters as shown below.  A description of each variable and it's purpose follows:

theURL --  is the actual url of the HTML page which you want to open in the 		     new window, it can be written as an absolute or relative path

custom -- is the variable which you must use to indicate whether or not you will be customizing the new window, setting custom = 1 will tell the function that you do want to customize the window, setting the custom variable = 0(or anything else) or not setting it will tell the function you want to use the default window attributes

w and h -- are the width and height parameters for the new window, these need to be set if you are going to customize the window, they are pixel based values

resize, stat, tool, loc, menu, scroll -- are all variables which you can set to display certain window attributes for the new window.  Setting any or all of these variables = 0(false), tells the function that the attribute specified by the variable will NOT be displayed in the new window, conversely setting any or all of the variables to any other INTEGER(for clarity's sake, use the integer, 1) value will indicate to the function that the attribute specified should be displayed.  The variables equate to the window attributes as follows:
resize = resizable, allowing the user the ability to resize the new window
stat = status bar, will display the status bar if true
tool = toolbar, will display the toolbar if true
loc = the input field for entering urls directly will be displayed if true
menu = menubar, will be displayed if true
scroll = scrollbars, will be displayed, if necessary, if true

x and y -- are pixel based values which you will use to position the top/left corner of the new window based on the assumption that x = 0 and y = 0 is the top/left coordinate of the browser. x = left/right positioning, y =top/bottom positioning.

REMEMBER:  If you are going to customize the window, you need to set custom = 1 and you have to include all of the additional variables.  Failing to include a variable or variables will effect the new window display. It may display as a default type window(if you provide no variables) it may display not as intended(if you mistakenly leave out one or more variables).

Again, use custom = 0 for the default window.

*/

function ow(theURL,custom,w,h,resize,stat,tool,loc,menu,scroll,x,y)

//determine browser name and version.  Four options: netscape 4.x, netscape 6.0, IE 4.0 or greater, and other browsers	

	{
							
		if ((navigator.appName  == "Netscape")	&& (parseFloat(navigator.appVersion) >= 4 && parseFloat(navigator.appVersion) < 5))	{
			
			browser = "netscape";			
		}
		else if ((navigator.appName == "Netscape") && (parseFloat(navigator.appVersion) >= 5))	{
			browser ="netscape6";
		}
		else if ((navigator.appName  == "Microsoft Internet Explorer") 	&& (parseFloat(navigator.appVersion) >= 4))	{
			browser = "ie";			
		}
		else	{
			browser = "altBrowser";
		}
	
//make sure that either 2 or 12 arguments are passed, if not provide the default window

if (arguments.length == 2 || arguments.length == 12) {	
		
//since netscape and IE have different naming schema for the window positioning properties, it is necessary to check for browser type as performed above.  This will serve the correct parameter names as variables in the window.open function which actually opens the new window as can be seen below.

if (custom == 1){
	
	if (browser  == "netscape")	{
			window.open(theURL,"","width=" + w + ",height=" + h + 						",resizable=" + resize + ",status=" + stat + ",toolbar=" + tool + ",location=" + loc + ",menubar=" + menu + ",scrollbars=" + scroll + ",screenX=" + x + ",screenY=" + y)
		}
		
	if (browser == "netscape6")	{							
			window.open(theURL,"","width=" + w + ",height=" + h + 						",resizable=" + resize + ",status=" + stat + ",toolbar=" + tool + ",location=" + loc + ",menubar=" + menu + ",scrollbars=" + scroll + ",screenX=" + x + ",screenY=" + y)
	}
		
	else if (browser == "ie")	{
		
window.open(theURL,"","width=" + w + ",height=" + h + ",resizable=" + resize + ",status=" + stat + ",toolbar=" + tool + ",location=" + loc + ",menubar=" + menu + ",scrollbars=" + scroll + ",left=" + x +",top=" + y)
		}		
		
	else {
		
window.open(theURL,"","width=" + w + ",height=" + h + ",resizable=" + resize + ",status=" + stat + ",toolbar=" + tool + ",location=" + loc + ",menubar=" + menu + ",scrollbars=" + scroll)
		}			
		
	}

else {

	if (browser  == "netscape" || "netscape6")	{
			window.open(theURL,"","width=640,height=480,resizable=yes,status=yes,toolbar=yes,history=no,location=yes,menubar=no,scrollbars=yes,screenX=25,screenY=50")
		}
		
	else if (browser == "ie")	{
		
window.open(theURL,"","width=640,height=480,resizable=yes,status=yes,toolbar=yes,history=no,location=yes,menubar=no,scrollbars=yes,left=25,top=50")
		}		
		
	else	{
		
window.open(theURL,"","width=640,height=480,resizable=yes,status=yes,toolbar=yes,history=no,location=yes,menubar=no,scrollbars=yes")
		}			
		
	} 
}
else{
	window.open(theURL,"","width=640,height=480,resizable=yes,status=yes,toolbar=yes,history=no,location=yes,menubar=no,scrollbars=yes")
}
}
