//-----------------------------------------------------------------------------------------------------
// Formally declare the ZeekConstants namespace object.
//-----------------------------------------------------------------------------------------------------
if (typeof ZeekConstants != "object") {
	ZeekConstants = new Object(); 
}

//----------------------------------------------------------------------------------------------------------------------------------------
// GLOBAL CONSTANTS SECTION
//	The literal constants here are for general use, but by being within a namespace object - they do not 
//	polute the default namespace.  
//----------------------------------------------------------------------------------------------------------------------------------------

ZeekConstants.setConstants = function() {
	ZeekConstants.baseHref = "castlezeek.com/";		//Used to find page-relative navigation.  See doPageNav() function for usage.
	ZeekConstants.pageUnderConstructMsg = "Check back soon for this page to be finished.  Thank you for your patience and for visiting Castle Zeek Systems!";	
	
	//------- MENUS SECTION -----------------------------------------------------------------------------------------------------
	ZeekConstants.lNavItemBGColor = "#222";			//Normal non-hovered state bg color of left nav menu items
	ZeekConstants.lNavItemBGColorHover = "#888";	//Hovered state bg color of left nav menu items
	ZeekConstants.lNavItemFontColor = "#fda";		//Normal non-hovered state font color of left nav menu items
	ZeekConstants.lNavItemFontColorHover = "#fff";	//Hovered state font color of left nav menu items
	
	ZeekConstants.miniNavItemBGColor = "#222";			//Normal non-hovered state bg color of top/mini nav menu items
	ZeekConstants.miniNavItemBGColorHover = "#666";		//Hovered state bg color of top/mini nav menu items
	ZeekConstants.minNavItemFontColor = "#ddd";			//Normal non-hovered state font color of top/mini nav menu items
	ZeekConstants.miniNavItemFontColorHover = "#fff";	//Hovered state font color of top/mini nav menu items
	
	
	//------- LINKS/PATHS SECTION -------------------------------------------------------------------------------------------------------
	ZeekConstants.ZeekWidgetsURL = "http://www.zeekwidgets.com";
	ZeekConstants.CastleZeekURL = "http://www.castlezeek.com";
	ZeekConstants.outlineIconDir = "_j/outline";	//NOTE: Dir Path from perspective of top level.  Individual usage may need to relativize path.

	//------- GENERAL CONFIG SECTION -------------------------------------------------------------------------------------------------------
	ZeekConstants.busPhone = "512-303-7611";
	ZeekConstants.busEmail = "castlezeek@castlezeek.com";
};


//----------------------------------------------------------------------------------------------------------------------------------------
// This function allows swapping ID value tags in the DOM with the resolved constant value provided by this JS inclusion.
// The following is how this works:
//	
//		1) 	You have N tags on a page with an ID name indicating the special syntax that invokes CONSTANT substitition:
//				<span id="__{CONST-NAME}__" class="CONST"/>
//		2) 	From example span tag above, it is a self-enclosed span with the double-underscore pre/post around the name of the CONSTANT 
//		   	defined by this JS inclusion --AND-- the class designation marker of "CONST".  Therefore, to refine the example - consider 
//         	there is a business phone number constant called: DIConstants.busPhone
//		   	Therefore, in the DOM you might expect to see a swap designation span element as follows:
//				<span id="__busPhone__" class="CONST"/>
//			In this example, the class setting of "CONST" indicates that there should be a constant substitution, whereas the ID constains
//			the specially-named ID indicating which specific constant setting should be used - and observing the double-underscore pre/post.  
//		3)	This function should be invoked ONCE after body onload, in the typical "initJS" function once the page has loaded.  Then call
//			this function ONCE to sweep through the DOM, collect all the class elements of "CONST" and perform the specific constant value
//			substitutions indicated by the ID values.
//		4)  This current version of the swapCONSTS function currently only operates on span tags.
//----------------------------------------------------------------------------------------------------------------------------------------
ZeekConstants.swapCONSTS = function() {

	//Gather up all span elements in page having a CLASS set to "CONSTS" ---------------
	var CONSTS_List = $$('span.CONST');

	var curSpanID = null;
	var curElemRef = null;
	var curConstValue = null;
	for (var n=0;n<CONSTS_List.length;n++) {
		curElemRef = CONSTS_List[n];
		curSpanID = curElemRef.id;
		if (curSpanID.indexOf("__")<0) { continue; } 	//If no double-underscores then its not a CONST designated span element
		var totLen = curSpanID.length;
		if (totLen<4) { continue; }			//if total length less than two sets of double-underscores, can not be a CONST span element
		curSpanID = curSpanID.substring(2,(totLen-2));
		curConstValue = ZeekConstants[curSpanID];
		if (curConstValue===null || ""===curConstValue) { continue; }
		
		curElemRef.innerHTML = curConstValue;
	}
};