$(document).ready(function(){
   
	// fire windowResponse on pageload
   	$("body").windowResponse();
   	
   	// fade in content
    $("body > div").animate({
        opacity: 1
        }, 900
    );
    
	//$('h2').widont();

	// find all ampersands and wrap with an <i> tag
	$('p, a, h2, li').each(function(index) {
	       $(this).html(function(i,html){
	             return html.replace('&amp;','<i>&amp;</i>');
	        });
	 });

});



// fire windowResponse on window resize
$(window).resize(function() {
	$("body").windowResponse();
});



jQuery.fn.windowResponse = function() {
	// if window larger than 1143
	if (document.documentElement.clientWidth > 1143) {
	
		// fire jquery masonry
        $("body:not(#portfolio) #main").masonry({ singleMode: true });
        $("body .post").css("position", "absolute");
 
    };
    // if window smaller than 1144
    if (document.documentElement.clientWidth < 1144) {
    
    	// remove jquery masonry styles
    	$("#main").css("height", "auto");
    	$("body .post").removeAttr("style");
    	
    };
    
    // remove jquery masonry styles for portfolio
    $("body#portfolio .post").removeAttr("style");
	
}

