var selectedCell;
function HighlightSelection(currentObject){
	if(selectedCell == null)
	{
		var current = currentObject;
		while(current.tagName != 'TABLE')
		{
			current = current.parentNode;
		}
		var parentTable = current;
		if((parentTable.rows != null) && (parentTable.rows[0].cells != null) && (parentTable.rows[0].cells.length > 0))
		{
			selectedCell = parentTable.rows[0].cells[0];
		}
	}
	selectedCell.className = "Item";
	currentObject.parentNode.className = "SelectedItem";
	selectedCell = currentObject.parentNode;
}

function updateGalleryImage(captionId,imageId,caption,photoUrl,gallery){
	document.getElementById(captionId).innerHTML = caption;
	document.getElementById(imageId).src = photoUrl;
	HighlightSelection(gallery);
	// window.event is undefined in Firefox, Nescape 4.74, Nescape 6.1 and Nescape 7.1, 
	// need a check if e is undefined before calling subsequent methods using e
	if(typeof(window.event) != 'undefined') 
	{
	    e = window.event;
	    e.cancelBubble = true;
	    if (e.stopPropagation) e.stopPropagation();
	 }
	return false;
}

