$(document).ready(function(){						   
	homeBoxHeight();
	clearPostBoderbtm();
	showGoTop();
	//portfolio();
	$("img").lazyload({         
	     effect      : "fadeIn"
	});
	
})

function homeBoxHeight(){	
	if ($('div').hasClass('home-box')){
		var max = null;
		
		$('.home-box').each(function(){	
			if ( !max || max.height() < $(this).height() )
  			 max = $(this);
		});
		$('.home-box').each(function(){
			$(this).css({'height':max.height()});									 
		});		
	}
}

function clearPostBoderbtm(){
	if ($('div').hasClass('post')){
		$('.post:last').css({'border-bottom':0, 'margin-bottom':0});
	}
	if($('div').hasClass('portfolio-post')){
		$('.portfolio-post:last').css({'border-bottom':0, 'margin-bottom':0});
	}
}

function portfolio(){
	if($('div').hasClass('folio-image')){
		$('.folio-image img').each(function(index){
			$(this).hover(
			  function () {
				$(this).animate({opacity:0.6},300);
			  }, 
			  function () {
				$(this).animate({opacity:1},300);
			  }
			);
												   
		});
	}
}

function showGoTop(){
	//$wHeight = $(window).height();   
    $top = $('.to-top');
    $top.hide();
    $(window).scroll(function(){
        $sHeight = $(window).scrollTop();
        $('.temp').html($sHeight);
        if($sHeight > 300){
            $top.fadeIn('slow');
			$top.click(function(){
				$('html, body' ).stop().animate({scrollTop:0}, 400);								
			})
        }
        else{
            $top.fadeOut('slow');
        }
    });
}

