
/* @Author : Rafael Barros */

chaves = [false, false, false, false, false, false, false, false];

function cat(n) {
	
	if(!chaves[n - 1]){
		chaves[n - 1] = true;
		$('#check' + n).css('background-position', '0 20px');
	} else {
		chaves[n - 1] = false;
		$('#check' + n).css('background-position', '0 10px');
	}	
	
	$('#content').fadeOut('fast');

	$.post("portifolio.php", { print:chaves[0], interactive:chaves[1], film:chaves[2], moleskine:chaves[3], typography:chaves[4], illustration:chaves[5], design:chaves[6], radio:chaves[7], page:0 },  function(data){
		$('#content').html(data);
		
		$('.destaque a').lightBox();
		$('.thumbs a').lightBox();
		$('#content').fadeIn("slow",acertaMenu );
		
	});
		
}


function navegate(n) {
	
	$('#content').fadeOut('fast', function(){
	
		if(n == 'about'){
			$.post("about.html", function(data){
				$('#content').html(data);
				$('#content').fadeIn('slow', acertaMenu);
				
			});
		
		}
			
	
	});
	
	
}

function tools(n){
	
	if(n == 'up'){
		$('html,body').animate({scrollTop: 0}, 1000);
	}
	
}


function paginacao(n){

	$('#content').fadeOut('fast');

$.post("portifolio.php", { print:chaves[0], interactive:chaves[1], film:chaves[2], moleskine:chaves[3], typography:chaves[4], illustration:chaves[5], design:chaves[6], radio:chaves[7], page:n },  function(data){
	
		$('#content').html(data);
		$('.destaque a').lightBox();
		$('.thumbs a').lightBox();
		$('#content').fadeIn("slow", acertaMenu );
		
	});

}



function acertaMenu(){
	largura = document.getElementById('content').offsetHeight - 65;
	largura = (largura <= 520) ? 520 : largura;
	$("#menu").animate({ height: largura + 'px' }, 800 );
}


$(document).ready(function () {
							
	cat('100');
	acertaMenu();
	
	
});