/* Author:
	dreipol.ch
*/

// http://masonry.desandro.com/ 
$(function(){
    var $thinktank = $('#think-tank');
    $thinktank.imagesLoaded(function(){
      $thinktank.masonry({
        itemSelector : '.post',
        columnWidth : 500
      });
    });
});


function toggleIt($id) {
       if(document.getElementById($id).style.display == "block")
           document.getElementById($id).style.display = "none";
       else
           document.getElementById($id).style.display = "block";
}

function hideIt($id) {
document.getElementById($id).style.display = "none";
}
function showIt($id) {
document.getElementById($id).style.display = "block";
}

function showThumb($id){
    if(document.getElementById($id)){
        document.getElementById($id).style.display = "block";
    }
}

function hideThumb($id){
    if(document.getElementById($id)){
        document.getElementById($id).style.display = "none";
    }
}


function updateWindow(){
   if($(window).width()<1285){
       $('body').addClass('smallWindow');
   }else{
       $('body').removeClass('smallWindow');
   }
   
    if($(window).height() < (444 + $('#project-txt-long').height()) ){
       $('body').addClass('smallWindowHigh');
   }else{
       $('body').removeClass('smallWindowHigh');
   }
}

$(function(){
   updateWindow();
   $(window).resize(function(){
       updateWindow();
   });
});

$(window).load(function() {
	/*
	var theWindow = $(window),
			$bg = $("#bg"),
			aspectRatio = $bg.width() / $bg.height();
			

	function resizeBg() {

		if ((theWindow.width() / theWindow.height()) < aspectRatio) {
			$bg
					.removeClass()
					.addClass('bgheight');
		} else {
			$bg
					.removeClass()
					.addClass('bgwidth');
		}

	}
	*

	theWindow.resize(
			function() {
				resizeBg();
			}).trigger("resize");
			*/

});

$(".target_wrapper").contents().find("a[href]").attr('target','_blank');


