$(document).ready(function(){
$(document).pngFix();

$('a[href=#top]').click(function(){  // GLOBAL: scroll to top
$('html, body').animate({scrollTop:0}, 1200, 'easeOutQuint');
return false;
});

/* $("#container").css("display", "none"); // GLOBAL: fade pages in/out
$("#container").fadeIn(500);
$(".nav_about a, .nav_tags a, .meta_title a, .meta_tags a, .site_title a, .footer_licensing a").click(function(event){ 
	event.preventDefault();
	linkLocation = this.href;
	$("#container").fadeOut(500, redirectPage);		
});
function redirectPage() {
	window.location = linkLocation;
}*/

$(".loader").fadeIn(200);   // GLOBAL: loader
$(".loader_text").blink({delay:100}); 
$(".site_title").addClass('loading');
//$(".site_title.loading").blink({delay:125}); 


$(".site_title a").hover(   // GLOBAL: logo hover effect
function() {
$(this).stop().animate({"opacity": "0.7"}, 250);
},
function() {
$(this).stop().animate({"opacity": "1"}, 250);
});

var db= 250;
$(".project_thumb").each(function() {  // INDEX: fade thumb boxes in sequentially
    $(this).delay(db).fadeIn(500);
    db += 150;	
});

$(".project_thumb img.project_thumb_img_hover").css({'opacity': 0.3}); // INDEX: force opacity on project_thumb_img_hover  
$(".project .meta, .project_text").delay(500).fadeIn(800); // SINGLE: fade project text in 

$(function(){  // INDEX: thumbnail hover & delay 
    var config = {    
         sensitivity: 7, // minumum mouse movement before doOver is called    
         interval: 75,  // delay before doOver    
         over: doOver,   // onMouseOver function    '
         timeout: 300,   // delay before doOut
         out: doOut    // onMouseOut function      
    };
    function doOver() {
       	 $(this).find("img.project_thumb_img").fadeTo(250, 0);
		 $(this).find("img.project_thumb_img_hover").fadeIn(250);
		 $(this).find(".meta").delay(150).fadeTo(250, 1);
    }
    function doOut() {
       	 $(this).find(".meta").fadeTo(250, 0);
	 	 $(this).find("img.project_thumb_img").delay(150).fadeTo(250, 1);
	 	 $(this).find("img.project_thumb_img_hover").delay(150).fadeOut(250);
    }
    $(".project_thumb").hoverIntent(config);
});

$('#project_thumbnails') // INDEX: masonry layout
	.isotope({
		masonry: {
			columnWidth: 6
		},
		animationEngine: 'jquery',
		animationOptions: {
			easing: 'easeOutQuint',
			queue: false,
			duration: 1000
		}
	});
}); // close doc.ready


// ONLOAD

$(window).load(function(){
	$(".loader").fadeOut(200);  // GLOBAL: loader
	$(".loader_done").delay(300).fadeIn(200);
	$(".loader_done").delay(1800).fadeOut(200);
	$(".site_title").removeClass('loading');
	
	var d= 700;
    $(".project_thumb img.project_thumb_img").each(function() { // INDEX: fade thumb images in sequentially 
	    $(this).delay(d).fadeIn(800);
	    d += 150;
	});   

	var ds= 1000; // delay the images before appearing
	$(".project_images .project_img_large, .project_images .project_img_small ").each(function() { // SINGLE: fade project images in sequentially 
	    $(this).delay(ds).fadeIn(800);
	    ds += 250;
	}); 
     
$('.project_images')  // SINGLE: masonry layout
	.isotope({
		masonry: {
			columnWidth: 6
		},
		animationEngine: 'jquery',
		animationOptions: {
			easing: 'easeOutQuint',
			queue: false,
			duration: 1200
		}
	});
	
/*$(".project_images a").hover(   // SINGLE: image magnify hover effect
    function() {
	$(this).stop().animate({"opacity": "0.8"}, 250);
	},
	function() {
	$(this).stop().animate({"opacity": "1"}, 250);
	});*/
	
});	// close window.load
