// ************************************************************************************ //
//
// File name: bcg_experience.js
// Version: .01
// Date: 07/27/2001
// Programmed by: Matt McMahon 
// 
// ************************************************************************************ //

/* ******************************************************* */
/* Globals                                                 */
/* ******************************************************* */

var arrowOn = "/images/on_arrow_16x15.jpg";
var arrowOff = "/images/spacer.gif";

var fit_sections = new Array("def_fit","under","grad","doctorate","other","mystery","rollover");
var what_do_sections = new Array("def_do","assoc","consult","exec","other","mystery");
var learn_sections = new Array("def_learn","train","exper","on_job");
/* ******************************************************* */
/* Function: */
/* Arguments: */
/* Returns: */
/* ******************************************************* */
function experience_box( strId ){
	this.id = strId;
	this.activeId = null;
}

function swapDisplay( dispId ){
	if( dispId == this.activeId ) return;
	var titleDisp = document.getElementById( this.id + "_title_" + dispId);
	var contentDisp = document.getElementById( this.id + "_content_" + dispId);
	var oldTitleDisp = document.getElementById( this.id + "_title_" + this.activeId);
	var oldContentDisp = document.getElementById( this.id + "_content_" + this.activeId);
	var oldArr = document.getElementById( this.id + "_" + this.activeId + "_arrow");
	var newArr = document.getElementById( this.id + "_" + dispId + "_arrow");
	this.activeId = dispId;
	//if(is.ns4) {
	//	titleDisp.style = titleDisp;
	//	oldTitleDisp.style = oldTitleDisp;
	//	contentDisp.style = contentDisp;
	///	oldContentDisp.style = oldContentDisp;
	//}
	if(titleDisp)titleDisp.style.visibility = "visible";
	if(oldTitleDisp)oldTitleDisp.style.visibility = "hidden";
	if(contentDisp)contentDisp.style.visibility = "visible";
	if(oldContentDisp)oldContentDisp.style.visibility = "hidden";
	if(oldArr)oldArr.src = arrowOff;
	if(newArr)newArr.src = arrowOn;
	return;
}

experience_box.prototype.swap = swapDisplay;

function getObjRef( strId ) {
	if(is.dom) return document.getElementById( strId );
	else if(is.ie) return document.all[strId];
	else if(is.ns4) {
		return eval("document." + strId);
	} else return null;
}

/* Making fit experience box */
var fit = new experience_box( "fit" );
fit.activeId = fit_sections[0];

/* Making dwhat_do experience box */
var what_do = new experience_box( "what_do" );
what_do.activeId = what_do_sections[0];

/* Making learn experience box */
var learn = new experience_box( "learn" );
learn.activeId = learn_sections[0];


// SH_Utils_getElementById: function to get a reference to the layer object
// Arguments:
//  strId - string id of the layer
// Return value: 
// 	objLyr - the reference to the layer
function SH_Utils_getElementById( strId ){
	if(document.all) return document.all[ strId ];
	else return null;
}
// SH_Utils_getElementByIdNav4:  ns4 specific function to get a reference to the layer object
// NOTE: this will only retrieve an object ref if it corresponds to a NAMED layer, image or link
// Arguments:
//  strId - string id of the layer
// Return value: 
// 	objLyr - the reference to the layer
function SH_Utils_getElementByIdNav4( strId ){
	var objRef = null;
	objRef = SH_Utils_getLayerNav4( strId );
	if(! objRef ) objRef = SH_Utils_getImageNav4( strId );
	// Create a reference to a style object to mimic dom type behavior
	if(objRef)objRef.style = objRef;
	return objRef;
}

if(!is.dom) document.getElementById =  ( is.ns4 ?  
								         SH_Utils_getElementByIdNav4 : 
										 SH_Utils_getElementById );

// SH_Utils_getLayerNav4: function to get a reference to the layer object
// Arguments:
//  strId - string id of the layer
//  parentLyr - reference to the parent layer
// Return value: 
// 	objLyr - the reference to the layer
function SH_Utils_getLayerNav4( strId, parentLyr ){
	var objLyr;
	var parentObj = (parentLyr ? parentLyr : document );
	for( var i =0; i < parentObj.layers.length && !objLyr; i++) {
		if(parentObj.layers[i].id == strId) 
			objLyr = parentObj.layers[i];
		else 
			objLyr = SH_Utils_getLayerNav4( strId, parentObj.layers[i] );
	}
	return objLyr;
}
// SH_Utils_getImageNav4: NS4 specific function to get an image object reference
// Arguments:
//  strId - the string id of the image
// 	parentLyr - the parent layer to look in
// Return value: 
// 	imgObj - reference to the image object
function SH_Utils_getImageNav4( strId, parentLyr ) {
	var imgObj = null;
	var parentObj = (parentLyr ? parentLyr : document );
	imgObj = parentObj.images[ strId ];
	if(! imgObj ){
	for( var i =0; i < parentObj.layers.length && !imgObj; i++) 
		imgObj = SH_Utils_getImageNav4( strId, parentObj.layers[i].document );
	}
	return imgObj;
}
