 


	$(document).ready(function(){	
	
	
	$(window).bind("resize", resizeWindow);
function resizeWindow( e ) {
    $('#main').masonry({itemSelector: '.post',columnWidth: 50,animate: true,animationOptions: {
    duration: 750,
    easing: 'linear',
    queue: false}
                     });
};
	
$('#main').masonry({itemSelector: '.post',columnWidth: 50,animate: true });

	
	

	  var zDepth = 1000; //for setting the post z-index's
	
 	/* pagenav */
var prevButton = $('img#prevbu').remove();
 $('div#pageprev a').html(prevButton);
 $('img#prevbu').css("display","inline");
var nextButton = $('img#nextbu').remove();
 $('div#pagenext a').html(nextButton);
 $('img#nextbu').css("display","inline");
$('div#pagenav').animate( {'top':'+=50px'}, 1000, 'easeOutBounce');
  

/***************  FADE-IN 1 VOOR1 SCRIPT *****************/



  $('.post').css({opacity: 0 });
   var $sequence = $('.post'), div = 0; 
   function showloop(){ 
	    $($sequence[div]).animate({opacity: 1.0 }, "fast", arguments.callee );
		div++;
		
	           }
	 showloop();
	 
	 
/************* EINDE FADE-IN 1 VOOR 1 SCRIPT *************/
  		 $(loadtarget='.closeButton').hide();
	 
	$.ajaxSetup({cache:false});
	
	$("a.expandlink" ).one('click',function(){
		var post_id = $(this).attr("rel");
		var loadtarget= '#expander-'+post_id;
        $(loadtarget).html("loading...");
        $(loadtarget).load("/triqui-ajax/",{id:post_id});
        return false;
	})
	.click(function(){
 
/* 	reset eerst alle evt. openstaande expander boxen (is dit slim of een perfomance isssue?) */
   	 $(loadtarget='.closeButton').hide();
     minimizeAllPosts();
	$(".expander").css({display: "none"});
 	var post_id = $(this).attr("rel");
 	
    var loadtarget= '#expander-'+post_id;
    var expandWidth= $('#post-'+post_id+' .expander').css('width') ;
    var expandHeight= $('#post-'+post_id+' .expander').css('height');  
    zDepth++;
    $('#post-'+post_id).css({width: expandWidth, height: expandHeight, zIndex:zDepth});	  
        $('#post-'+post_id+' .expander').show();	  
    
    
      	 $('#post-'+post_id+' img.closeButton').show();
     $('#main').masonry({itemSelector: '.post',columnWidth: 50,animate: false });
 
  
    var scrollpos = $(loadtarget).offset();
    $(window).scrollTo(scrollpos.top-40,1000);	
    	 return false;
	});	


  


$('.closeButton').click(function(){
	  $(this).hide();
    	$(".expander").css({display: "none"});
        minimizeAllPosts();
 $('#main').masonry({itemSelector: '.post',columnWidth: 50,animate: false });
       	});


  		
var illustrationWidth = $('.category-illustration:first').css('width');
var illustrationHeight = $('.category-illustration:first').css('height');

var johnwoodhouseWidth = $('.category-john-woodhouse:first').css('width');
var johnwoodhouseHeight = $('.category-john-woodhouse:first').css('height');

var tekeningenWidth = $('.category-tekeningen:first').css('width');
var tekeningenHeight = $('.category-tekeningen:first').css('height');

/*
var blogWidth = $('.category-blog:first').css('width');
var blogHeight = $('.category-blog:first').css('height');
*/

var minimizeAllPosts= function(){
    $('.category-illustration').css({width:illustrationWidth, height: illustrationHeight});
    $('.category-john-woodhouse').css({width: johnwoodhouseWidth, height: johnwoodhouseHeight});
    $('.category-tekeningen').css({width: tekeningenWidth, height: tekeningenHeight});
/*     $('.category-blog').css({width: blogWidth, height: blogHeight});  				 */
    							};  


 	
     		
}); /* end document ready */


 
 
 

