function loadPage(pageName) {
//	contingut = '#' + contingut;
	$('#contingut').hide();
	$('#contingut').load(pageName).fadeIn('slow');
}

function hideContents() {
	if ($('.displayed').html() != null) { 
		$('.displayed').hide();
		$('.displayed').removeClass('displayed');
	}
}

function showContents() {
	if ($('.displayed').html() != null) {
		$('.displayed').fadeIn('slow');
	}
}
	
function showGallery(container,action,imageId) {
	containerId = '#'+container;
	if (action == 'show') {
		if ($(containerId).html() != null) { $(containerId).hide(); }
		if ($('#back').html() != null) { $('#back').show(); }
		updateGallery(imageId,container);
	} else {
		if ($('#galeria').html() != null) { $('#galeria').hide(); }
		if ($('#back').html() != null) { $('#back').hide(); }
		if ($(containerId).html() != null) { $(containerId).show(); }
	}
}

function updateGallery(imageId,container) {
	var loaderImage = document.getElementById('loader');
	var galeriaId = document.getElementById('galeria');
	loaderImage.style.display = 'block';
	$('#galeria_contenedor').load('galeria.php?image='+imageId+'&container='+container);
	loaderImage.style.display = 'none';
	galeriaId.style.display = 'block';
}


function goHome() {
  window.location.href = 'home.php';
}
