var popupStatus = 0;

//loading popup with jQuery magic!
function loadPopup2(){
	//loads popup only if it is disabled
	if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		$("#enlargeWindow").fadeIn("slow");
		popupStatus = 1;
	}
	return false;
}
//centering popup
function centerPopup2(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#enlargeWindow").height();
	var popupWidth = $("#enlargeWindow").width();
	
	
	var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body;
	var dsoctop=document.all? iebody.scrollTop : pageYOffset;

	//centering
	$("#enlargeWindow").css({
		"position": "absolute",
		"top": windowHeight/2-popupHeight/2 + dsoctop,
		"left": windowWidth/2-popupWidth/2
	});
	//only need force for IE6
	$("#backgroundPopup").css({
		"height": windowHeight
	});
}

                
var selectedManagementIndex = -1;

function processClick(ind)
{
	if(selectedManagementIndex != -1)
		processPerson(selectedManagementIndex, false);
	processPerson(ind, true);
	
	selectedManagementIndex = ind;
}

function processPerson(ind, currentlySelected)
{
	var img = document.getElementById("managementImg" + ind);
	img.src = currentlySelected ? img.getAttribute("colorsrc") :  img.getAttribute("bwsrc");
	
	var span = document.getElementById("managementSpan" + ind);
	span.className = currentlySelected ? "selectedManager" : "manager";
	
	var spanPersonInfo = document.getElementById("managementSpanInfo" + ind);
	var spanInfo = document.getElementById("spanInfo");
	spanInfo.innerHTML = spanPersonInfo.innerHTML;
}

// functions for slide show
function startGallery() {
	if(document.getElementById("myGallery") != null)
	{
		var myGallery = new gallery(Moo.$('myGallery'), {
			timed: false,
			transition: "easeInOut",
			embedLinks: false
		});
	}
}
window.onDomReady(startGallery);
//----------------------------------
