/**
 * @author mbreault
 */
var xmlPath = "./xml/x_navigation_tree.xml";
// since we can't generate this, make sure we split out the name of the html file as the index into our XML;

var strNodeID;
var strArchetypeID;
var a = String(window.location);
var b = a.split('.html')[0]
var c = b.split('/');
var d = c[c.length - 1]
strNodeID = d;
strArchetypeID = strNodeID.split('_')[0]
if (strArchetypeID == "applications") 
	strArchetypeID = "applications_policies"

var g_displayDepth = 1;
this.debug = true;

/*
 ----------------------------
 Top Level Navigation ASSOCIATIVE Array
 ----------------------------
 These routines determine the top 3 rows in the navigation box;
 Experience | Intelligence | Profiles
 Coverages | Services
 Forms & Applications | Connect
 
 See the logic below the subnav creation. This will be moved around as time warrants;
 ______________________________________________
 */
var arr_tlnObjects = new Array();

//---blue
arr_tlnObjects["blue"] = new Array();
arr_tlnObjects["blue"][0] = new Array();
arr_tlnObjects["blue"][0]["strID"] = 'experience';
arr_tlnObjects["blue"][0]["strLabel"] = 'Experience\<sup\>2\<\/sup\>';
arr_tlnObjects["blue"][0]["class"] = 'dv_leftnav_toplevelLinks';

arr_tlnObjects["blue"][1] = new Array();
arr_tlnObjects["blue"][1]["strID"] = 'profiles';
arr_tlnObjects["blue"][1]["strLabel"] = 'Profile';
arr_tlnObjects["blue"][1]["class"] = 'dv_leftnav_toplevelLinks lborder rborder';

arr_tlnObjects["blue"][2] = new Array();
arr_tlnObjects["blue"][2]["strID"] = 'intelligence';
arr_tlnObjects["blue"][2]["strLabel"] = 'Intelligence';
arr_tlnObjects["blue"][2]["class"] = 'dv_leftnav_toplevelLinks';

//---green
arr_tlnObjects["green"] = new Array();
arr_tlnObjects["green"][0] = new Array();
arr_tlnObjects["green"][0]["strID"] = 'cover';
arr_tlnObjects["green"][0]["strLabel"] = 'Coverages';
arr_tlnObjects["green"][0]["class"] = 'dv_leftnav_toplevelLinks dv_leftnav_large';

arr_tlnObjects["green"][1] = new Array();
arr_tlnObjects["green"][1]["strID"] = 'services';
arr_tlnObjects["green"][1]["strLabel"] = 'Services';
arr_tlnObjects["green"][1]["class"] = 'dv_leftnav_toplevelLinks dv_leftnav_large';


//---orange
arr_tlnObjects["orange"] = new Array();
arr_tlnObjects["orange"][0] = new Array();
arr_tlnObjects["orange"][0]["strID"] = 'applications_policies';
arr_tlnObjects["orange"][0]["strLabel"] = 'Applications &amp; Policies';
arr_tlnObjects["orange"][0]["class"] = 'dv_leftnav_toplevelLinks';

arr_tlnObjects["orange"][1] = new Array();
arr_tlnObjects["orange"][1]["strID"] = 'connect';
arr_tlnObjects["orange"][1]["strLabel"] = 'Connect';
arr_tlnObjects["orange"][1]["class"] = 'dv_leftnav_toplevelLinks lborder';






//--create the init event;
Event.observe(window, 'load', function(){
	// parse the XML;
	do_parseXML();
})

do_parseXML = function(){
	if (document.all) { //IE
		tempDOM = new ActiveXObject("MSXML.DOMDocument");
		tempDOM.async = true;
		tempDOM.onreadystatechange = function(){
			if (tempDOM.readyState == 4) {
				do_processNavTree();
			}
		}
		tempDOM.load(xmlPath);
	} else { //Other Browsers
		tempDOM = new XMLHttpRequest();
		tempDOM.onreadystatechange = function(){
			if (tempDOM.readyState == 4) {
				do_processNavTree(tempDOM.responseXML);
			}
		}
		tempDOM.open("GET", xmlPath, true);
		tempDOM.send("");
	}
}

do_processNavTree = function(argXML){
	this.arr_menuDIVS = new Array();
	this.arr_baseNodes = new Array();
	this.arr_baseObjects = new Array();
	this.current_base = 'base_' + strColor;
	this.current_node = strNodeID;
	this.arr_hexadecimal = new Array();
	this.str_navTitle = strTitle;
	this.str_style = strStyle;
	this.ptr_menuDIV = $('dv_leftnav_sublevelnav');
	if (argXML) {
		this.arr_baseNodes = argXML.getElementsByTagName('base');
	} else {
		this.arr_baseNodes = tempDOM.getElementsByTagName('base')
	}
	//create the base objects;
	for (var i = 0; i < this.arr_baseNodes.length; i++) {
		var clsName = String('base_' + this.arr_baseNodes[i].getAttribute('id'));
		var strHexadecimal = String('#' + this.arr_baseNodes[i].getAttribute('hexadecimal'))
		this.arr_hexadecimal[this.arr_baseNodes[i].getAttribute('id')] = strHexadecimal;
		//--only process the tree of the current 'base'
		//  uncomment this for live;
		if (this.current_base == clsName) {
			this.arr_baseObjects[clsName] = new cls_base({
				str_ID: clsName,
				str_title: this.arr_baseNodes[i].getAttribute('title'),
				str_hexadecimal: '#' + this.arr_baseNodes[i].getAttribute('hexadecimal'),
				str_style: this.str_style,
				str_navTitle: this.str_navTitle,
				ptr_localRoot: this,
				arr_childNodes: arr_baseNodes[i].childNodes,
				str_displayMode: this.arr_baseNodes[i].getAttribute('displaymode'),
				ptr_menuDIV: this.ptr_menuDIV,
				str_color: this.arr_baseNodes[i].getAttribute('id'),
				g_displayDepth: this.g_displayDepth
			})
			this.arr_baseObjects[clsName].do_processChildren();
		}
	}
	do_buildTopLevelNav();
}

cls_base = function(args){
	this.str_ID = args.str_ID;
	this.str_title = args.str_title;
	this.str_hexadecimal = args.str_hexadecimal;
	this.str_style = args.str_style;
	this.str_navTitle = args.str_navTitle;
	this.str_color = args.str_color;
	this.str_displayMode = args.str_displayMode;
	this.ptr_localRoot = args.ptr_localRoot;
	this.ptr_rootCls = this;
	this.arr_childObjects = new Array();
	this.arr_childNodes = args.arr_childNodes;
	this.bool_hasLanding = true;
	this.bool_hasChildren = true;
	this.int_depth = 0;
	this.g_displayDepth = args.g_displayDepth;
	this.ptr_menuDIV = args.ptr_menuDIV;
	this.str_href;
	this.int_lboundADepth = 0;
	
	this.do_setNavBGColor = function(){
		if (this.str_style == "solid") {
			this.str_navbgcolor = this.str_hexadecimal;
		} else {
			this.str_navbgcolor = '#ffffff';
		}
	}
	
	this.do_processChildren = function(){
		if (this.bool_hasLanding == "false") {
			if (this.arr_childNodes[0].nodeType == 1) {
				this.str_href = this.arr_childNodes[0].getAttribute('id') + '.html'
			} else {
				this.str_href = this.arr_childNodes[1].getAttribute('id') + '.html'
			}
		} else {
			this.str_href = this.str_ID + '.html';
		}
		for (var i = 0; i < this.arr_childNodes.length; i++) {
			//-- cull out the text nodes;
			if (this.arr_childNodes[i].nodeType == 1) {
				var clsChildName = this.arr_childNodes[i].getAttribute('id')
				
				this.arr_childObjects[clsChildName] = new cls_child({
					str_ID: clsChildName,
					str_title: this.arr_childNodes[i].getAttribute('title'),
					str_style: this.str_style,
					str_navTitle: this.str_navTitle,
					str_displayMode: this.arr_childNodes[i].getAttribute('displaymode'),
					ptr_parentCls: this,
					ptr_menuDIV: this.ptr_menuDIV,
					ptr_rootCls: this,
					ptr_localRoot: this.ptr_localRoot,
					arr_childNodes: this.arr_childNodes[i].childNodes,
					int_depth: (this.int_depth + 1),
					bool_hasLanding: this.arr_childNodes[i].getAttribute('hasLanding')
				})
				this.arr_childObjects[clsChildName].do_processChildren();
			}
		}
		this.get_childObject(current_node)
	}
	
	this.get_childObject = function(strSearchID){
		for (var key in this.arr_childObjects) {
			if (this.arr_childObjects[key].str_ID == strSearchID) {
				this.ptr_rootCls.do_setNavigationStructure(this.arr_childObjects[key])
			} else {
				if (typeof this.arr_childObjects[key] != 'function') {
					this.arr_childObjects[key].get_childObject(strSearchID)
				}
			}
		}
	}
	
	this.get_childObjectPTR = function(strSearchID){
		for (var key in this.arr_childObjects) {
			if (this.arr_childObjects[key].str_ID == strSearchID) {
				alert('this.arr_childObjects[l0found].str_ID:' + strSearchID)
				return this.arr_childObjects[key]
			} else {
				if (typeof this.arr_childObjects[key] != 'function') {
					this.arr_childObjects[key].get_childObjectPTR(strSearchID)
				}
			}
		}
		
	}
	
	// note the structure shifts for each depth, and behaves slightly differently
	// this routine handles that.
	// this is called by the childObject.
	this.do_setNavigationStructure = function(ptr_nodeObject){
		this.do_setNavBGColor();
		this.ptr_parentObject;
		this.ptr_activeObject = ptr_nodeObject;
		this.arr_siblingObjects = new Array();
		
		this.ptr_parentObject = this.ptr_activeObject.ptr_parentCls;
		for (var key in this.ptr_parentObject.arr_childObjects) {
			if (typeof this.ptr_parentObject.arr_childObjects[key] != 'function') {
				this.arr_siblingObjects.push(this.ptr_parentObject.arr_childObjects[key])
			}
		}
		switch (this.ptr_activeObject.str_displayMode) {
			case 'showChild':
				//alert('showChild')
				this.do_buildNavigationHeader(this.ptr_parentObject);
				this.set_NavigationObjects(this.ptr_activeObject, this.ptr_activeObject.int_depth, (this.ptr_activeObject.int_depth + 1), strNodeID, false);
				break;
			case 'showParent':
				//alert('showParent')
				//note: shows parent level and parent siblings.
				this.do_buildNavigationHeader(this.ptr_parentObject);
				this.set_NavigationObjects(this.ptr_parentObject, this.ptr_parentObject.int_depth, this.ptr_activeObject.int_depth, strNodeID, true);
				break;
			case 'showChild,showParent':
				//alert('showChild,showParent')
				//note: shows children, but not sibling children.
				this.do_buildNavigationHeader(this.ptr_parentObject);
				this.set_NavigationObjects(this.ptr_activeObject, this.ptr_activeObject.int_depth, (this.ptr_activeObject.int_depth + 1), strNodeID, true);
				break;
			case 'showSelf':
				this.do_buildNavigationHeader(this.ptr_parentObject);
				this.set_NavigationObjects(this.ptr_parentObject, this.ptr_activeObject.int_depth, (this.ptr_parentObject.int_depth + 1), strNodeID, false);
				break;
			case 'showNone':
				this.do_buildNavigationHeader(this.ptr_activeObject);
				//this.set_NavigationObjects(this.ptr_activeObject, this.ptr_activeObject.int_depth, this.ptr_activeObject.int_depth, strNodeID, false);
				break;
			default:
				this.do_buildNavigationHeader(this.ptr_activeObject);
				this.set_NavigationObjects(this.ptr_activeObject, this.ptr_activeObject.int_depth, this.ptr_activeObject.int_depth, strNodeID, false);
				break;
		}
		this.do_setMenuDivStyles();
	}
	
	
	// build the header for the navigation menu
	// note, the arguments shift based on the depth of the menu (1-4+)
	this.do_buildNavigationHeader = function(ptr_object){
		var el_header = new Element('div', {
			'class': 'dv_navheader_l0',
			'id': ptr_object.str_ID + '_header'
		})
		$(el_header).addClassName('dv_navheader_l0')
		$(el_header).setStyle({
			backgroundColor: this.str_hexadecimal,
			cursor: 'pointer',
			paddingLeft: '35px'
		})
		//$(el_header).innerHTML = this.ptr_activeObject.str_displayMode +'\<br\/\>' +strNodeID + '::' + str_navTitle;
		$(el_header).innerHTML = this.str_navTitle
		$(el_header).observe('click', respondToMenuClick.bind($(el_header)))
		this.ptr_menuDIV.appendChild(el_header);
		$('dv_leftnav_sublevelnav').setStyle({
			backgroundColor: this.str_navbgcolor
		})
	}
	
	// recursive routine that builds the objects down to a certain level.
	// note the boolShowOwnLevel is for levels that show the parent level as well (level 2)
	this.set_NavigationObjects = function(ptr_nodeObject, arg_currentDepth, arg_maxDepth, arg_currentKey, arg_boolshowParent){
		//--build the parents if boolShowOwnLevel is true;
		if (arg_boolshowParent) {
			//--create the children if this node is the one for the page.
			for (var key in ptr_nodeObject.ptr_parentCls.arr_childObjects) {
				if (typeof ptr_nodeObject.ptr_parentCls.arr_childObjects[key] != 'function') {
					var sName = ptr_nodeObject.ptr_parentCls.arr_childObjects[key];
					
					// Set the Navigation Display with the parent level obects.
					this.do_buildNavigationBlock(sName, sName.int_depth, arg_maxDepth, sName.str_ID, sName.str_title, sName.bool_hasChildren)
					
					//--call recursion, now that we have created the parent levels
					if (arg_currentKey == sName.str_ID && this.ptr_activeObject.str_displayMode == "showChild,showParent") {
						this.set_NavigationObjects(sName, sName.int_depth, arg_maxDepth, strNodeID, false);
					} else 
						if (this.ptr_activeObject.str_displayMode == "showParent") {
							this.set_NavigationObjects(sName, sName.int_depth, arg_maxDepth, strNodeID, false);
						}
				}
			}
			
		} else {
			for (var key in ptr_nodeObject.arr_childObjects) {
				if (typeof ptr_nodeObject.arr_childObjects[key] != 'function') {
					var sName = ptr_nodeObject.arr_childObjects[key];
					this.do_buildNavigationBlock(sName, sName.int_depth, arg_maxDepth, sName.str_ID, sName.str_title, sName.bool_hasChildren)
				}
			}
		}
		this.g_maxDepth = 0;
	}
	
	this.do_buildNavigationBlock = function(ptr_nodeObject, intDepth, intMaxDepth, strID, strTitle, boolHasChildren){
		//  create the DIV and append it to the menu div;
		var el_div = new Element('div', {
			'id': strID
		});
		
		//$(el_div).addClassName('class_menuDiv')
		//  Add the label as a span
		var el_textNode = new Element('span', {
			'id': strID + '_txt'
		})
		
		//------------
		//el_textNode.innerHTML = intDepth+':'+intMaxDepth + '('+(this.int_lboundADepth)+'), '+strTitle;
		el_div.appendChild(el_textNode)
		this.ptr_menuDIV.appendChild(el_div);
		//------------
		//  Create a small associative array to store information about this div
		//  this is due to some browsers not liking dynamically created attributes for DOM objects;
		//  Note: some of this information is extraneous and is in place for future upgrades;
		
		var tmpARRValues = new Array();
		tmpARRValues["displaymode"] = ptr_nodeObject.str_displayMode;
		tmpARRValues["ptrCls"] = ptr_nodeObject;
		tmpARRValues["apparentDepth"] = intDepth - intMaxDepth;
		tmpARRValues["container"] = $(strID);
		tmpARRValues["img"] = $(strID + '_img');
		tmpARRValues["txt"] = $(strID + '_txt');
		tmpARRValues["intDepth"] = intDepth;
		tmpARRValues["strTitle"] = ptr_nodeObject.str_title;
		tmpARRValues["strID"] = ptr_nodeObject.str_ID;
		tmpARRValues["strHREF"] = ptr_nodeObject.str_href;
		tmpARRValues["boolHasChildren"] = boolHasChildren;
		tmpARRValues["arrChildrenIDs"] = new Array();
		tmpARRValues["arrFirstChildrenIDs"] = new Array();
		tmpARRValues["boolChildrenVisible"] = true;
		//------------
		arr_menuDIVS.push(tmpARRValues);
		ptr_nodeObject.ptr_divObject = $(strID)
		ptr_nodeObject.arr_divProperties = tmpARRValues;
	}
	
	//--sets the div objects
	//  handles the 3 known variations of the menu functionality;
	this.do_setMenuDivStyles = function(){
		//--make sure menuDIVS actually has something in it...
		if (arr_menuDIVS[0]) {
			this.int_lboundADepth = arr_menuDIVS[0]["intDepth"]
		}
		//set the images and text.
		for (var i = 0; i < arr_menuDIVS.length; i++) {
			var strIMG = "";
			
			arr_menuDIVS[i]["apparentDepth"] = arr_menuDIVS[i]["intDepth"] - (Math.abs(this.int_lboundADepth));
			
			arr_menuDIVS[i]["txt"].setStyle({
				fontWeight: 'normal',
				fontSize: '10pt'
			});
			//--setting the icons to only level 0 stuff;
			if (arr_menuDIVS[i]["apparentDepth"] < 1) {
				if (strNodeID == arr_menuDIVS[i]["strID"]) {
					if (arr_menuDIVS[i]["boolHasChildren"]) {
						var strIMG = './media/' + strColor + '_' + this.str_style + '_nav_minus.gif';
					} else {
						var strIMG = './media/' + strColor + '_' + this.str_style + '_nav_bullet_active.gif';
					}
					if (this.str_style == "solid"){
						arr_menuDIVS[i]["txt"].setStyle({
							color: '#000000'
						});
					}else{
						arr_menuDIVS[i]["txt"].setStyle({
							color: this.str_hexadecimal
						});
					}
					
				} else {
					if (arr_menuDIVS[i]["boolHasChildren"]) {
						var strIMG = './media/' + strColor + '_' + this.str_style + '_nav_plus.gif';
					} else {
						var strIMG = './media/' + strColor + '_' + this.str_style + '_nav_bullet_inactive.gif';
					}
					if (this.str_style == "solid"){
						arr_menuDIVS[i]["txt"].setStyle({
							color: '#FFFFFF'
						});
					}else{
						arr_menuDIVS[i]["txt"].setStyle({
							color: '#666666'
						});
					}
				}
				var el_img_icon = new Element('img', {
					'class': 'dv_nav_icon',
					'id': arr_menuDIVS[i]["strID"] + '_img',
					'src': strIMG,
					'width': 25,
					'height': 20
				})
				
				$(el_img_icon).addClassName('dv_nav_plusimg');
				arr_menuDIVS[i]["img"] = $(el_img_icon)
				arr_menuDIVS[i]["container"].insert({
					top: el_img_icon
				});
				var int_indent = (arr_menuDIVS[i]["apparentDepth"] * 10) + 30 + 'px';
				var int_mtop = '10px';
				var int_mbottom = '5px';
				arr_menuDIVS[i]["container"].addClassName('class_menuDiv')
			}  else {
					var int_indent = (arr_menuDIVS[i]["apparentDepth"] * 10) + 55 + 'px';
					var int_mtop = '4px';
					var int_mbottom = '4px';
					if (this.str_style == "solid"){
						arr_menuDIVS[i]["txt"].setStyle({
							color: '#FFFFFF'
						});
					}else{
						arr_menuDIVS[i]["txt"].setStyle({
							color: '#999999'
						});
					}
					if (strNodeID == arr_menuDIVS[i]["strID"]) {
						arr_menuDIVS[i]["txt"].setStyle({
							color: '#000000'
						});
						if (arr_menuDIVS[i]["ptrCls"].ptr_parentCls != undefined) {
							var strIMG = './media/' + strColor + '_' + this.str_style + '_nav_minus.gif';
							arr_menuDIVS[i]["ptrCls"].ptr_parentCls.arr_divProperties["img"].src=strIMG;
							if (this.str_style == "solid") {
								arr_menuDIVS[i]["ptrCls"].ptr_parentCls.arr_divProperties["txt"].setStyle({
									color: '#ffffff'
								})
							}else{
								arr_menuDIVS[i]["ptrCls"].ptr_parentCls.arr_divProperties["txt"].setStyle({
									color: this.str_hexadecimal
								})
							}
						}	
					}
					arr_menuDIVS[i]["container"].setStyle({
						paddingTop: int_mtop,
						paddingBottom: int_mbottom
					});
				
			}
			//arr_menuDIVS[i]["txt"].innerHTML = arr_menuDIVS[i]["intDepth"] + ','+arr_menuDIVS[i]["apparentDepth"]+','+arr_menuDIVS[i]["strTitle"]
			arr_menuDIVS[i]["txt"].innerHTML = arr_menuDIVS[i]["strTitle"];
			
			arr_menuDIVS[i]["container"].setStyle({
				cursor: 'pointer',
				marginLeft: int_indent
			
			})
			arr_menuDIVS[i]["container"].observe('click', respondToMenuClick.bind(arr_menuDIVS[i]["container"]))
		}
	}
}


cls_child = function(args){
	this.str_ID = args.str_ID;
	this.str_title = args.str_title;
	this.ptr_localRoot = args.ptr_localRoot;
	this.ptr_parentCls = args.ptr_parentCls;
	this.ptr_rootCls = args.ptr_rootCls;
	this.str_hexadecimal = this.ptr_parentCls.str_hexadecimal;
	this.str_style = args.str_style;
	this.str_displayMode = args.str_displayMode;
	this.str_navTitle = args.strTitle;
	this.arr_childObjects = new Array();
	this.arr_childNodes = args.arr_childNodes;
	this.arr_divProperties = new Array();
	this.bool_hasChildren = false;
	this.bool_hasLanding = args.bool_hasLanding;
	
	this.int_depth = args.int_depth;
	this.ptr_menuDIV = args.ptr_menuDIV;
	this.ptr_divObject;
	
	this.do_processChildren = function(){
		if (this.bool_hasLanding == "false") {
			if (this.arr_childNodes[0].nodeType == 1) {
				this.str_href = this.arr_childNodes[0].getAttribute('id') + '.html'
			} else {
				this.str_href = this.arr_childNodes[1].getAttribute('id') + '.html'
			}
		} else {
			this.str_href = this.str_ID + '.html';
		}
		for (var i = 0; i < this.arr_childNodes.length; i++) {
			//-- cull out the text nodes;
			if (this.arr_childNodes[i].nodeType == 1) {
				this.bool_hasChildren = true;
				var clsChildName = this.arr_childNodes[i].getAttribute('id')
				this.arr_childObjects[clsChildName] = new cls_child({
					str_ID: clsChildName,
					str_title: this.arr_childNodes[i].getAttribute('title'),
					str_style: this.str_style,
					str_navTitle: this.str_navTitle,
					str_displayMode: this.arr_childNodes[i].getAttribute('displaymode'),
					ptr_parentCls: this,
					ptr_menuDIV: this.ptr_menuDIV,
					ptr_rootCls: this.ptr_rootCls,
					ptr_localRoot: this.ptr_localRoot,
					arr_childNodes: this.arr_childNodes[i].childNodes,
					int_depth: (this.int_depth + 1),
					bool_hasLanding: this.arr_childNodes[i].getAttribute('hasLanding')
				})
				this.arr_childObjects[clsChildName].do_processChildren();
			}
		}
	}
	this.get_childObject = function(strSearchID){
		for (var key in this.arr_childObjects) {
			if (this.arr_childObjects[key].str_ID == strSearchID) {
				this.ptr_rootCls.do_setNavigationStructure(this.arr_childObjects[key])
				return;
			} else {
				if (typeof this.arr_childObjects[key] != 'function') {
					this.arr_childObjects[key].get_childObject(strSearchID)
				}
			}
		}
	}
	
	this.get_childObjectPTR = function(strSearchID){
		for (var key in this.arr_childObjects) {
			if (this.arr_childObjects[key].str_ID == strSearchID) {
				alert('this.arr_childObjects[found].str_ID:' + strSearchID)
				return (this.arr_childObjects[key])
			} else {
				if (typeof this.arr_childObjects[key] != 'function') {
					this.arr_childObjects[key].get_childObjectPTR(strSearchID)
				}
			}
		}
	}
}
respondToMenuClick = function(){
	var ptr_arrDIV = getArrayPTRfromDIV(this)
	if (ptr_arrDIV["strHREF"] != undefined) {
		window.document.location = ptr_arrDIV["strHREF"]
	} else {
		var strSearchID = arr_menuDIVS[0]["ptrCls"].ptr_parentCls.bool_hasLanding;
		if (strSearchID == "false") {
			window.document.location = arr_menuDIVS[0]["ptrCls"].ptr_parentCls.ptr_parentCls.str_href;
		} else {
			window.document.location = arr_menuDIVS[0]["ptrCls"].ptr_parentCls.str_href;
		}
		
	}
}

respondToMenuOver = function(){

}

respondToMenuOut = function(){

}
/*
 ----------------------------
 Top Level Navigation Routines
 ----------------------------
 These routines determine the top 3 rows in the navigation box;
 Experience | Intelligence | Profiles
 Coverages | Services
 Forms & Applications | Connect
 
 **FUTURE*** put this information in an associative array somewhere and loop.
 ______________________________________________
 */
do_buildTopLevelNav = function(){
	// loop through the arr_tlnObjects associative array
	this.ptr_TLN_menuDIV = $('dv_leftnav_tln')
	if (this.ptr_TLN_menuDIV != undefined) {
		for (var key in arr_tlnObjects) {
			if (typeof arr_tlnObjects[key] != 'function') {
				var el_clrObject = new Element('div', {
					'class': 'clear',
					'id': 'clear_' + key
				})
				$(el_clrObject).addClassName('clear')
				for (var i = 0; i < arr_tlnObjects[key].length; i++) {
				
					var strID = arr_tlnObjects[key][i]["strID"];
					var strLabel = arr_tlnObjects[key][i]["strLabel"]
					var strClassNames = arr_tlnObjects[key][i]["class"];
					
					var el_dvObject = new Element('div', {
						'class': strClassNames,
						'id': 'dv_tln_' + strID
					})
					$(el_dvObject).addClassName(strClassNames)
					var str_tlnHREF = strID + '.html';
					var str_tlnID = 'dv_tln_link_' + strID
					var el_tlnLink = new Element('a', {
						'id': str_tlnID,
						'href': str_tlnHREF
					})
					
					$(el_tlnLink).innerHTML = strLabel;
					$(el_dvObject).appendChild(el_tlnLink);
					this.ptr_TLN_menuDIV.appendChild(el_dvObject);
				}
				this.ptr_TLN_menuDIV.appendChild(el_clrObject);
			}
		}
		this.do_setTLNStyle();
	}
}


this.do_setTLNStyle = function(){
	var str_container = $('dv_tln_' + strArchetypeID);
	var str_link = $('dv_tln_link_' + strArchetypeID);
	
	$(str_link).setStyle({
		color: this.arr_hexadecimal[strColor]
	})
	//--set the homepage click for fun and profit;
	if ($('dv_leftnav_logo') != undefined) {
		$('dv_leftnav_logo').observe('click', function(){
			window.document.location = 'index.html'
		})
	}
}




/*
 ----------------------------
 Helper Routines
 ----------------------------
 These routines are useful to return divs, arrays, etc etc
 that are associated with our menu divs;
 ______________________________________________
 */
function getArrayPTRfromDIV(elDIV){
	var returnPtr
	for (var i = 0; i < arr_menuDIVS.length; i++) {
		for (var key in arr_menuDIVS[i]) {
			if (typeof arr_menuDIVS[i][key] != 'function') {
				if (arr_menuDIVS[i]["container"] == elDIV) {
					returnPtr = arr_menuDIVS[i]
					return returnPtr;
				}
			}
		}
	}
	return false;
}

function getArrayPTR(strID){
	alert('getArrayPTR:' + strID)
	var returnPtr
	for (var i = 0; i < arr_menuDIVS.length; i++) {
		for (var key in arr_menuDIVS[i]) 
			if (typeof arr_menuDIVS[i][key] != 'function') {
				if (arr_menuDIVS[i]["strID"] == strID) {
					returnPtr = arr_menuDIVS[i]
					return returnPtr;
				}
			}
	}
	return false;
}

function getObjectProperty(strID, keyVal){
	var returnVal;
	for (var i = 0; i < arr_menuDIVS.length; i++) {
		for (var key in arr_menuDIVS[i]) 
			if (typeof arr_menuDIVS[i][key] != 'function') {
				if (arr_menuDIVS[i]["container"].id == strID) {
					returnVal = arr_menuDIVS[i][keyVal]
					return returnVal;
				}
			}
	}
	return false;
}

function do_checkKey(ptr_ARR, keyVal){
	var returnVal;
	for (var key in ptr_ARR) {
		if (typeof ptr_ARR[key] != 'function') {
			if (key == keyVal) {
				return true;
			}
		}
	}
	return false;
}


