
/**
On body load run these configuration functions
@param 		bodyRef 		object reference of the entire body of the page
*/
function fnInit(bodyRef) {
	//showdiv('coachesDiv');
	fnSetDefaultSelected();
	fnPeopleSH();
}

/**
Global variables
*/

var assets = "";
var ua = navigator.userAgent.toLowerCase();



/********************************************************************************
 
Name:     		fnSetDefaultSelected
Description: 	Sets the default selected state on itinerary nav on first item 
				in nav list - wont get set for non-js users so they can browse
				the standard anchor list

*********************************************************************************/	

function fnSetDefaultSelected() {
	if(document.getElementById("tabNav")) {
		var listItems = document.getElementById("tabNav").getElementsByTagName("LI");
		listItems[0].className = "selected";
	}
}
	



/********************************************************************************
 
Name:     		fnSelectMe
Description: 	Sets class "selected" on the LI in the itinerary nav list that is 
				clicked on

*********************************************************************************/	
function fnSelectMe(obj) {
	var listItems = document.getElementById("tabNav").getElementsByTagName("LI");	
	for (i=0;i<listItems.length;i++) {
		listItems[i].className = "";
	}		
	obj.parentNode.className = "selected";	
}


/********************************************************************************
 
Name:     		fnItineraryShowHide
Description: 	Show / Hide the people tabbed content.  Anchor contains link to ID 
				of element to show/hide.  JS takes the url, splits string to get ID 
				after the "#", and uses this ID to target element to show/hide.

*********************************************************************************/	
	
function fnPeopleSH(targ) {	
	var divs = document.getElementById("tabNav").getElementsByTagName("A"); /* get all links in tab nav */
	var ids = new Array();	
	for (i=0;i<divs.length;i++) { 							
		ids[i] = divs[i].href.split("#")[1]; 								/* get id from 1st token after "#" in link <a> href */
		document.getElementById(ids[i]).className = "hidden";				/* hide all id's */
		}			
	if (targ) {
		document.getElementById(targ.href.split("#")[1]).className = "show";
	}
	else {
		document.getElementById(ids[0]).className = "show";					/* show the first div */
	}
	
}	