window.addEvent('domready', function(){


	var list = $$('h2.menu a');
	list.each(function(element) {
			
		var fx = new Fx.Styles(element, {duration:100, wait:false, transition: Fx.Transitions.Sine.easeOut});
		
		element.addEvent('mouseenter', function(){
			fx2.stop(); // stop the fade out if it's still running (to prevent flickering when the two are executed at the same time)
			var bgColor;
			switch (element.className) {
				case 'ecmsBG': bgColor = '#e0e0e0'; break;
				case 'aboutBG': bgColor = '#FF9D00'; break;
				case 'galleryBG': bgColor = '#484ADA'; break;
				case 'artistsBG': bgColor = '#E13A29'; break;
				case 'outreachBG': bgColor = '#24BA24'; break;
				
			};
			fx.start({
				'background-color': bgColor,
				'color': '#ffffff'
			});
		});
		
		var fx2 = new Fx.Styles(element, {duration:500, wait:false, transition: Fx.Transitions.Sine.easeInOut});
		element.addEvent('mouseleave', function(){
			fx.stop(); // stop the fade out if it's still running (to prevent flickering when the two are executed at the same time)
			var bgColor;
			switch (element.className) {
				case 'ecmsBG': bgColor = '#f0f0f0'; break;
				case 'aboutBG': bgColor = '#ff8000'; break;
				case 'galleryBG': bgColor = '#3A3ABA'; break;
				case 'artistsBG': bgColor = '#CC2828'; break;
				case 'outreachBG': bgColor = '#35AC35'; break;
			};
			fx2.start({
				'background-color': bgColor,
				'color': '#f0f0f0'
			});
		});	
		



	});

	if (document.getElementById('content')) { // for all but the main page, check the menu height
		var contentHeight = document.getElementById('content').clientHeight + 200;
		var menuObj = document.getElementById('pageSetup');
		if (menuObj != null) {
			if (menuObj.clientHeight < contentHeight) {
				menuObj.style.height = contentHeight + 'px';
			}
	}
	}
	
	
	var box = {};
	try {
		box = new MultiBox('mb', {descClassName: 'multiBoxDesc', useOverlay: false});
	}
	catch(err) {
		
	}
									 

});

function contactMe(a, b, c) {
	document.location.href = 'mailto:' + c + '@' + b + '.' + a;
}

/* scroll to the name of the selected person in the a-z directory or news item on news page */
function scrollToId(name) {
	if (document.getElementById(name)) {
//		var myScroll = new Fx.Scroll(window, {wait: true, duration: 1000});
//		myScroll.toBottom();

		var myScroll = new Fx.Scroll(window, {wait: true, duration: 1500, transition: Fx.Transitions.Quart.easeInOut});
		myScroll.toElement(document.getElementById(name));
	}
}

function ie6Fix() {
	myHTML = document.getElementById('pageSetup').innerHTML;
	document.getElementById('pageSetup').innerHTML = '';
	document.getElementById('pageSetup').innerHTML = myHTML;
}

function popup(imageURL, objectType) {
	if (objectType == 'image') {
		var size = 'width=200, height=200, ';
	} else {
		var size = 'width=600, height=400, ';
	}
	var newWindow = window.open('popup.php?url=' + escape(imageURL) + '&object_type=' + objectType, 'aieg-popup', size + 'taskbar=1, resizable=1, scrollbars=1');
	newWindow.focus();
}