var larg
var haut
var bodyLarg
var bodyHaut

$(document).ready(function(){
	$(window).resize(onResizeDocument);
	onResizeDocument();
	animeGallery();
	$(".parent").mouseenter(slideMenu).mouseleave(unslideMenu);
});

function onResizeDocument() {
	bodyLarg = $('body').width()
	if(bodyLarg>950){
		side = (bodyLarg - 950)/2 + 950;
		$("#right").css('left', side + "px");
	}
	bodyHeight = $('body').height();
	contentHeight = $('#content').height() + $('#header').height() + 40;
	$("#footer").css('height', bodyHeight - contentHeight + "px");
}

function animeGallery(){
	if(!checkForGallery()){
		return;
	}
	
	$.ajax({
        type: "GET",
        url: "uploads/images/gallery/galleryExplore.php",
        success: function(html) {
				$('#galleryPic').html(html);
				$('#galleryPic').innerfade({speed: 'slow', timeout: 4000, type: 'random'});
			}	
		}
	);
}

function checkForGallery(){
	return $('#gallery').html() != null;
}

function slideMenu() {
	$(this).find('ul').first().show(300);
}

function unslideMenu() {
	$(this).find('ul').first().hide(300);
}

