(function ($) {
// VERTICALLY ALIGN FUNCTION
$.fn.vAlign = function() {
	return this.each(function(i){
	var ah = $(this).height();
	var ph = $(this).parent().height();
	var mh = (ph - ah) / 2;
	$(this).css('margin-top', mh);
	});
};
})(jQuery);

	$(document).ready(function() {
		$('.box').click(function() {
			var currentId = $(this).attr('id'); 
			$('.box').removeClass('here');
			$('.load').addClass('opened');
			$(this).addClass('here');
			$('.load').empty().html('<img class="loading" src="img/loading.gif" />');
			$('.load').load(currentId+'.html #container').hide().fadeIn('slow');		
			return false;
		});

$('#wrap').vAlign();


$(function() {
	var zIndexNumber = 1000;
	$('div').each(function() {
		$(this).css('zIndex', zIndexNumber);
		zIndexNumber -= 10;
	});
});

});
