//sectionHighlight.js
//Author: Adam Toda

/* This program highlights the section being currently viewed. */

/* STATIC VARIABLES */

// Variables for Page Type
var OVERVIEW = "overview";
var ABOUT = "about";
var BURMA = "burma";
var SE_ASIA = "SEAsia";
var THAI = "thailand";
var CONTACT = "contact";

// Variables for Burma Subsection
var BURMA_OVERVIEW = "burmaOverview";
var BURMA_SCHEDULE = "burmaSchedule";
var BURMA_MEDIA = "burmaMedia";
var BURMA_APP = "burmaApp";
var BURMA_FAQ = "burmaFAQ";

// Variables for Southeast Asia Subsection 

var SE_ASIA_OVERVIEW = "SEAsiaOverview";
var SE_ASIA_SCHEDULE = "SEAsiaSchedule";
var SE_ASIA_MEDIA =  "SEAsiaMedia";
var SE_ASIA_APP = "SEAsiaApp";
var SE_ASIA_FAQ = "SEAsiaFAQ";

// Variables for the Thailand Subsection

var THAI_OVERVIEW = "thailandOverview";
var THAI_SCHEDULE = "thailandSchedule";
var THAI_MEDIA = "thailandMedia";
var THAI_APP = "thailandApp";
var THAI_FAQ = "thailandFAQ";

function highlightSection(sectionName) {
	
	// if the page is in the Burma Section
	if (sectionName.substring(0,5) == BURMA) {
		highlightTopNav(BURMA);
		highlightSubSection(sectionName);	
		getObject("burmaSubHeaderNav").style.display = "inline";
		
		// Change the zIndex of the layers so they don't cover each other (for IE)
		getObject("burmaSubHeaderNav").style.zIndex = "10";
		getObject("SEAsiaSubHeaderNav").style.zIndex = "1";
		getObject("thailandSubHeaderNav").style.zIndex = "1";
	}
	
	// if the page is in the Southeast Asia Section
	else if (sectionName.substring(0,6) == SE_ASIA) {
		highlightTopNav(SE_ASIA);
		highlightSubSection(sectionName);
		getObject("SEAsiaSubHeaderNav").style.display = "inline";
		
		// Change the zIndex of the layers so they don't cover each other (for IE)
		getObject("SEAsiaSubHeaderNav").style.zIndex = "10";
		getObject("burmaSubHeaderNav").style.zIndex = "1";
		getObject("thailandSubHeaderNav").style.zIndex = "1";
	}
	
	// if the page is in the Thailand Section
	else if (sectionName.substring(0,8) == THAI) {
		highlightTopNav(THAI);
		highlightSubSection(sectionName);
		getObject("thailandSubHeaderNav").style.display = "inline";
		
		// Change the zIndex of the layers so they don't cover each other (for IE)
		getObject("thailandSubHeaderNav").style.zIndex = "10";
		getObject("SEAsiaSubHeaderNav").style.zIndex = "1";
		getObject("burmaSubHeaderNav").style.zIndex = "1";
	}
	
	// The following code is in the event that the media is divided into several sections.
	// The code has been commented out as it is not necessary to use it currently.
	
	/* // if the page is in the Burma Media Section
	else if (sectionName.substring(0,5) == "Burma") {
		highlightTopNav(BURMA);
		highlightSubSection(BURMA_MEDIA);	
		getObject("burmaSubHeaderNav").style.display = "inline";	
		
		// Change the zIndex of the layers so they don't cover each other (for IE)
		getObject("burmaSubHeaderNav").style.zIndex = "10";
		getObject("SEAsiaSubHeaderNav").style.zIndex = "1";
		getObject("thailandSubHeaderNav").style.zIndex = "1";
	}
	
	// if the page is in the Southeast Asia Media Section
	else if (sectionName.substring(0,5) == "South") {
		highlightTopNav(SE_ASIA);
		highlightSubSection(SE_ASIA_MEDIA);
		getObject("SEAsiaSubHeaderNav").style.display = "inline";
		
		// Change the zIndex of the layers so they don't cover each other (for IE)
		getObject("SEAsiaSubHeaderNav").style.zIndex = "10";
		getObject("burmaSubHeaderNav").style.zIndex = "1";
		getObject("thailandSubHeaderNav").style.zIndex = "1";
	} 
	
	// if the page is in the Thailand Media Section
	else if (sectionName.substring(0,8) == THAI) {
		highlightTopNav(THAI);
		highlightSubSection(THAI_MEDIA);
		getObject("thailandSubHeaderNav").style.display = "inline";
		
		// Change the zIndex of the layers so they don't cover each other (for IE)
		getObject("thailandSubHeaderNav").style.zIndex = "10";
		getObject("SEAsiaSubHeaderNav").style.zIndex = "1";
		getObject("burmaSubHeaderNav").style.zIndex = "1";
	}*/
	
	
	// if the page is in any other section
	else {
		if (sectionName == OVERVIEW) { highlightTopNav(OVERVIEW); }
		else if (sectionName == ABOUT) highlightTopNav(ABOUT);
		else if (sectionName == CONTACT) highlightTopNav(CONTACT);
	}
}

function highlightTopNav(sectionName) {
	getObject(sectionName + "Link").style.color = "#c2f38e";
	getObject(sectionName + "Link").style.textDecoration = "underline";
}

function highlightSubSection(sectionName) {
	getObject(sectionName + "Link").style.color = "#c2f38e";
	getObject("subHeader").style.paddingTop = "5px";
	getObject("subHeader").style.paddingBottom="5px";
	getObject("subHeader").style.minHeight="0px";
}

function getObject(obj) {
	if (document.getElementById) return document.getElementById(obj);
	else if (document.all) return document.all[obj];
}

