(function($) { 
	
  	$(document).ready(function() {
		
		$('.blur').each(function(index) {
			
			// IE doesn't support canvas so use black bg
			if ($.support.leadingWhitespace == false) {
				
				$(this).hover(function() {
					$(this).find('div.holder').fadeIn(400);
				}, function() {
					$(this).find('div.holder').fadeOut(500);
				});
				
			} else {
				
				$(this).hover(function() {
					$(this).find("div.holder, div.canvas-holder").fadeIn(400);
				}, function() {
					$(this).find("div.holder, div.canvas-holder").fadeOut(500);
				});
				
			}
			
			$(this).click(function() {
				window.location = $(this).find('a')[0].href;
			});
			
		});
		
		if ($('body.home').length) {
			$.fn.loopedSlider.defaults.containerClick = false;
			$.fn.loopedSlider.defaults.autoStart = 4500;
			$.fn.loopedSlider.defaults.slidespeed = 500;
			$('#loopedSlider').loopedSlider();
		};
		
		if ($('body.single').length) {
			
			/*checkWindowSize(window);
			$(window).resize(function() {
			  checkWindowSize(window);
			});*/
			
			// Load the classic theme
			Galleria.loadTheme(URL+'/js/galleria/themes/colourslide/galleria.colourslide.js');
			// Initialize Galleria
			$('.gallery').galleria();
		};
		
		if ($('a#launch-contact-form').length) {
			$('a#launch-contact-form').click(function() {
			    $('#wpcf7-f1-p17-o1').lightbox_me({
			        centered: true, 
			        onLoad: function() { 
			            $('#wpcf7-f1-p17-o1').find('input:first').focus()
			            }
			        });
			    return false;
			});
		}
		
	});
	
})(jQuery);

function checkWindowSize (ele) {
	$ele = $(ele);
	height = $ele.height() - $('#header').height() - parseInt($('#main').css('padding-top'));
	image_height = height - 20;
	$('.gallery').height(height);
	$('.attachment-large').height(image_height);
	window.console.log(height);
	
}


