$(window).load(function(){
//$("img").lazyload({ threshold : 400,effect : "fadeIn", failure_limit : 100 });

/***** Startpage ******/
//var mCF = $(".mobileContactLabel");
function showMetas(el) {
	h = el.children().find(".metaKurztext div").height();
	if(h > 0)
		el.children().find(".metaKurztext").animate({height: h+10+"px"})
}

function hideMetas(el) {
	el.children().find(".metaKurztext").animate({height: 0});
}

if( navigator.userAgent.match(/Android/i) ||
 navigator.userAgent.match(/webOS/i) ||
 navigator.userAgent.match(/iPhone/i) ||
 navigator.userAgent.match(/iPod/i) ||
 navigator.userAgent.match(/iPad/i) ||
 navigator.userAgent.match(/BlackBerry/)
 ){
	setTimeout( function(){ window.scrollTo(0, 1); }, 50 );
	$(".pageLink").click(
		function(event) {
			el = $(this);
			mk = el.children().find(".metaKurztext");
			if(mk.height() == 0 && mk.children("div").html().length > 0) {
				showMetas(el);
				event.preventDefault();
			}
		}
	);
} else {
	$(".pageLink").hover(
		function() {
			showMetas($(this));
		},
		function() {
			hideMetas($(this));
		}
	);
}


/****** Project Detail Page ******/
$.Isotope.prototype._getMasonryGutterColumns = function() {
var gutter = this.options.masonry && this.options.masonry.gutterWidth || 0;
containerWidth = this.element.width();
this.masonry.columnWidth = this.options.masonry && this.options.masonry.columnWidth ||
// or use the size of the first item
this.$filteredAtoms.outerWidth(true) ||
// if there's no items, use size of container
containerWidth;
this.masonry.columnWidth += gutter;
this.masonry.cols = Math.floor( ( containerWidth + gutter ) / this.masonry.columnWidth );
this.masonry.cols = Math.max( this.masonry.cols, 1 );
};
$.Isotope.prototype._masonryReset = function() {
// layout-specific props
this.masonry = {};
// FIXME shouldn't have to call this again
this._getMasonryGutterColumns();
var i = this.masonry.cols;
this.masonry.colYs = [];
while (i--) {
this.masonry.colYs.push( 0 );
}
};
$.Isotope.prototype._masonryResizeChanged = function() {
var prevSegments = this.masonry.cols;
// update cols/rows
this._getMasonryGutterColumns();
// return if updated cols/rows is not equal to previous
return ( this.masonry.cols !== prevSegments );
}; 


});


