// Evening Edition
/* 
var dateObject = new Date();
var theTime = dateObject.getHours();
if ((theTime >= 0 ) && (theTime < 8) || (theTime > 16 ) && (theTime < 24)) {
	document.write("<link rel='stylesheet' type='text/css' href='/<?php bloginfo('template_directory'); ?>/night.css'>");
}
else {
}
*/

// Toggle grid  
/* 
$('h1').click(function(){ 
	$('.layout-grid').toggle(); 
});
$('img').click(function(){ 
	$('.layout-grid').toggle(); 
});
*/

// Progress notification
// $('p#progress').css({'display':'none'});
// $('p#progress').fadeIn(3000);

// American Censorship
// $('p#american-censorship').css({'display':'none'});
// $('p#american-censorship').fadeIn(3000);


// Prevent default
$('a').click(function(event) {
	if(this.className == 'continue-reading'){event.preventDefault();}
	$('<div/>')
	.append('default ' + event.type + ' prevented')
	.appendTo('#log');
});


// WP Pagenavi
$('div.wp-pagenavi a').css({'opacity':'0.4'});
$('div.wp-pagenavi a').hover(function() { 
    $(this).stop().animate({"opacity": 0.8}); 
},function() { 
    $(this).stop().animate({"opacity": 0.4}); 
});

// Single post navigation
$('div.single-prev-next a').css({'opacity':'0.4'});
$('div.single-prev-next a').hover(function() { 
    $(this).stop().animate({"opacity": 0.8}); 
},function() { 
    $(this).stop().animate({"opacity": 0.4}); 
});

// Continue reading fade in
$("body.work-single div#page div#main-content article p a.continue-reading").click(function () {
	$("body.work-single div#page div#main-content article div.continue-reading").fadeIn("1000");
	$("body.work-single div#page div#main-content article p a.continue-reading").fadeOut("20");
});


// Work category navigation
$('body.work-single div#page div#main-content nav#nav-project ul li a').css({'opacity':'0.6'});
$('body.work-single div#page div#main-content nav#nav-project ul li span.project').css({'opacity':'0.6'});
$('body.work-single div#page div#main-content nav#nav-project ul li:has(a)').hover(function() { 
    $('a', this).stop().animate({"opacity": 01}); 
},function() { 
    $('a', this).stop().animate({"opacity": 0.6}); 
});


// Slides navigation default
$('body.work-single div#page div#main-content article section#work-gallery a').css({'display':'none', 'opacity':'0.6'});


// Slides navigation buttons appear
$('body.work-single div#page div#main-content article section#work-gallery').hover(
	function() { 
		$('body.work-single div#page div#main-content article section#work-gallery a').fadeIn(400);
	}, 
	function() {
		$('body.work-single div#page div#main-content article section#work-gallery a').fadeOut(400);
	}
);


// Slides navigation button hovers
$('body.work-single div#page div#main-content article section#work-gallery a').hover(
	function(event) { 
		$('body.work-single div#page div#main-content article section#work-gallery a').css({'opacity':'0.7'});
	}, 
	function() {
		$('body.work-single div#page div#main-content article section#work-gallery a').css({'opacity':'0.6'});
	}
);


// Resize post images
function detectImageSizes() {
	var a = document.getElementsByTagName('img'),
		l = a.length, i;
	for(i=0; i < l; i++) {
		if(a[i].offsetHeight > a[i].offsetWidth) {
			a[i].className += ' portrait';
		} else if(a[i].offsetHeight < a[i].offsetWidth) {
			a[i].className += ' landscape';
		} else {
			a[i].className += ' square';
		}
	}
}
if(window.addEventListener) {
	window.addEventListener('load', detectImageSizes, null);
} else {
	window.attachEvent('onload', detectImageSizes);
}

$("img").lazyload({
     placeholder : "img/grey.gif",       
     effect      : "fadeIn"
 });
 
 
 
 

