$(document).ready(function() {
	var isOut = false;
	var infoBox = "";
	jQuery.easing.def = 'jswing';
	$(".infoitem").click(function(){
		if(isOut == true) {
			if(infoBox == '#'+$(this).attr('id')+'info') {
				$(infoBox).slideUp({
					duration: 1000,
					easing: jQuery.easing.def,
					complete: isOut = false
				});
			} else {
				var newBox = '#'+$(this).attr('id')+'info';
				$(infoBox).slideUp({
					duration: 1000,
					easing: jQuery.easing.def,
					complete: function() {
						$(newBox).slideDown({
							duration: 1000,
							easing: jQuery.easing.def,
							complete: isOut = true
						});
						infoBox = newBox;
					}
				});
			}
		} else {
			infoBox = '#'+$(this).attr('id')+'info';
			$(infoBox).slideDown({
				duration: 1000,
				easing: jQuery.easing.def,
				complete: isOut = true
			});
		}
	});
	
	$(".infoitem").hover(
		function () {
			var imageName = 'url(images/'+$(this).attr('id')+'over.jpg)';
			$(this).css('background-image',imageName);
		}, 
		function () {
			$(this).css('background-image','');		
		}
	);
});
