numMenus = 5;
fadeOpacity = 50;
resolveOpacity = 100;
menuDefColor = '#0054b1';
menuHighColor = '#0074d1';
capHighColor = '#5ca8e3'
capDefColor = '';

document.onmouseover = hideAllMenus;

function showMenu(menuId, eventObj) {
    hideAllMenus();
	eventObj.cancelBubble = true;
    if(changeObjectVisibility(menuId, 'visible')) {
	return true;
    } else {
	return false;
    }
}

function showArrow(arrowId, eventObj) {
	eventObj.cancelBubble = true;
	changeObjectVisibility(arrowId, 'visible');
}

function hideAllMenus() {
    var allDIVs = document.getElementsByTagName('DIV');
	for (i=0; i<allDIVs.length; i++){
		if(allDIVs[i].className=='subMenu'){
			allDIVs[i].style.visibility='hidden';
		}
	}
	var allIMGs = document.getElementsByTagName('IMG');
	for (i=0; i<allIMGs.length; i++){
		if(allIMGs[i].className=='menuMarker'){
			allIMGs[i].style.visibility='hidden';
		}	
	}
}

function highlight(objectId) {
	var styleObject = getStyleObject(objectId);
	styleObject.backgroundColor = menuHighColor;
}

function unhighlight(objectId) {
	var styleObject = getStyleObject(objectId);
	styleObject.backgroundColor = menuDefColor;
}

function lightTD(objectId) {
	var styleObject = getStyleObject(objectId);
	styleObject.backgroundColor = capHighColor;
}

function unlightTD(objectId) {
	var styleObject = getStyleObject(objectId);
	styleObject.backgroundColor = capDefColor;
}

function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
} // getStyleObject

function changeObjectVisibility(objectId, newVisibility) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.visibility = newVisibility;
	return true;
    } else {
	//we couldn't find the object, so we can't change its visibility
	return false;
    }
} // changeObjectVisibility

function setStyle(objId, style, value) {
    document.getElementById(objId).style[style] = value;
}


//***************************************************
//SCRIPT TO SHOW AND HIDE CAPABILITIES
//***************************************************

function showCapability(capability) {
	var allDIVs = document.getElementsByTagName('DIV');
	for (i=0; i<allDIVs.length; i++){
		if(allDIVs[i].className=='capability'){
			allDIVs[i].style.visibility='hidden';
		}
	}
	changeObjectVisibility(capability, 'visible');
}

/* Resolve and Fade Capability DIV to full and partial opacity */

function resolve(aDiv) {
	aDiv.style.filter = 'alpha(opacity=' + resolveOpacity + ')';
}

function fade(aDiv) {
	aDiv.style.filter = 'alpha(opacity=' + fadeOpacity + ')';
}

//***************************************************
//SCRIPT TO SHOW AND HIDE PROJECTS
//***************************************************

function showProject(project) {
	var allDIVs = document.getElementsByTagName('DIV');
	for (i=0; i<allDIVs.length; i++){
		if(allDIVs[i].className=='project'){
			allDIVs[i].style.visibility='hidden';
		}
	}
	changeObjectVisibility(project, 'visible');
}


//***************************************************
//SCRIPT TO SCROLL PHOTO BAR
//***************************************************

shiftAmt = 5;
slideRun = false;
slideSpeed = 40;
id = '';
direction = '';
w = 0;
pw = 0;



function startSlide(slideID,slideDirection){
	if (document.all){  //IE
		//get width of slider:
		w = document.getElementById(slideID).clientWidth;
		//get width of slider parent div
		pw = document.getElementById(slideID).parentElement.clientWidth;
	}
	else {  //Netscape
		//get width of slider:
		w = document.getElementById(slideID).clientWidth;
		//get width of slider parent div
		pw = document.getElementById(slideID).parentNode.clientWidth;	
	}
	//alert(w + ", " + pw);
	
	slideRun=true;
	id = slideID;
	direction = slideDirection;
	slide();
}


function slide() {
	if(slideRun == true){
		if (document.all) {
			offsetLeft = document.getElementById(id).style.posLeft;
		}
		else {
			offsetLeft = parseInt(document.getElementById(id).style.left);
			if (isNaN(parseInt(document.getElementById(id).style.left))) {
				document.getElementById(id).style.left = 0;
				offsetLeft = 0;
			}
		}
		if (direction == 'left') {
			//document.getElementById('display').innerHTML = "pw = " + pw + "w = " + w + "\noffsetLeft = " + offsetLeft + ", pw - w = " + (pw - w);
			if ((w > pw) && (offsetLeft > ((pw - w) + shiftAmt))){
				document.getElementById(id).style.posLeft = document.getElementById(id).style.posLeft - shiftAmt;
				document.getElementById(id).style.left = parseInt(document.getElementById(id).style.left) - shiftAmt + "px";
			}
			else{
				stopSlide();
			}
		}
		if (direction == 'right') {
			//document.getElementById('display').innerHTML = "pw = " + pw + "w = " + w + "\noffsetLeft = " + offsetLeft + ", pw - w = " + (pw - w);
			if (offsetLeft < 0) {
				document.getElementById(id).style.posLeft = document.getElementById(id).style.posLeft + shiftAmt;
				document.getElementById(id).style.left = parseInt(document.getElementById(id).style.left) + shiftAmt + "px";
			}
			else {
				stopSlide();
			}
		}
		setTimeout("slide()",slideSpeed);
	}
}



function stopSlide() {
	slideRun = false;
	//alert('stop slide');
}

function resetSlide() {
	if (document.all) {
			offsetLeft = document.getElementById(id).style.posLeft = 0;
		}
	else {
		document.getElementById(id).style.left = 0;
	}
}