/* 	GLOBALS
 *
 *	SubCat:	possibilities for sub category
 */
var SubCat = {"CAD" : 0, "LANDSCAPE" : 1, "PUBLISH" : 3, "PHOTO" : 4, "BUSINESS" : 5, "EDU" : 6, "FAMILY" : 7};


/*	FUNCTION: 	makeUnhighlightedSubHeading
 *
 *	INPUT:	  	href: 	web address that link goes to
 *				text: 	text to display for the subcategory
 *
 *	OUTPUT:		the div that contains the sub category
 *
 *	PURPOSE: 	used for making a sub category div that is unhighlighted (user is not viewing content from that sub category)
 */
function makeUnhighlightedSubHeading(href, text) {
	return "<div onmouseout='navLinkMouseout(this)' onmouseover='navLinkMouseover(this)' class='subnav_link'\
				style='overflow:hidden; background-color:rgb(158, 158, 158);'>\
				<a target='_self' href='"+href+"' class='subnav_link' style='color:White; text-decoration:none;'>"+text+"</a>\
			</div>"
}

/*	FUNCTION:	makeHighlightedSubHeading
 *
 *	INPUT:		text:	text to display for the subcategory
 *
 *	OUTPUT:		the div that contains the sub category
 *
 *	PURPOSE: 	used for making a sub category div that is highlighted (user is viewing content from that sub category)
 */
function makeHighlightedSubHeading(text) {
	return "<div class='subnav_link subnav_link_sel'>\
				<span>"+text+"</span>\
			</div>"
}

/*	FUNCTION:	loadCADTemplate
 *
 *	INPUT:		subCat:	picked from the SubCat variable above, gives information on the subcategory to highlight
 *
 *	OUTPUT:		the CAD sub template html
 *
 *	LOCALS:		subCatNav_head:	text right above sub template navigation div
 *				subCatNav:	the sub template navigation div
 *
 *	PURPOSE:	creates the content for the CAD sub template
 */
function loadFreeSoftwareTemplate(subCat) {
	var subCatNav_head = "\
		<a name='top'></a>\
		<div style='font-weight:bold; margin-bottom:0.4em'>Free CD Software Library:</div>"
	
	var subCatNav = "<div id='construction_head_nav'>"
	if (subCat == SubCat.CAD) 		subCatNav += makeHighlightedSubHeading("Cad")
	else							subCatNav += makeUnhighlightedSubHeading("free_cad_software.html", "Cad")

	if (subCat == SubCat.LANDSCAPE) subCatNav += makeHighlightedSubHeading("Landscape")
	else							subCatNav += makeUnhighlightedSubHeading("free_landscape_software.html", "Landscape")

	if (subCat == SubCat.PUB)subCatNav += makeHighlightedSubHeading("Publish")
	else							subCatNav += makeUnhighlightedSubHeading("free_publishing_software.html", "Publish")

	if (subCat == SubCat.PHOTO) 	subCatNav += makeHighlightedSubHeading("Photo")
	else							subCatNav += makeUnhighlightedSubHeading("free_photographic_software.html", "Photo")

	if (subCat == SubCat.BUSINESS) 	subCatNav += makeHighlightedSubHeading("Business")
	else							subCatNav += makeUnhighlightedSubHeading("free_business_software.html", "Business")
	
	if (subCat == SubCat.EDU)subCatNav += makeHighlightedSubHeading("Edu")
	else							subCatNav += makeUnhighlightedSubHeading("free_educational_software.html", "Edu")

	if (subCat == SubCat.FAMILY) 	subCatNav += makeHighlightedSubHeading("Family")
	else							subCatNav += makeUnhighlightedSubHeading("free_family_software.html", "Family")
	
	subCatNav += "</div><div class='div_clear'></div><br /><br />"
		
	document.getElementById('subtemplate_div_top').innerHTML = subCatNav_head + subCatNav
	document.getElementById('subtemplate_div_bot').innerHTML = subCatNav
}