	$(document).ready(function() {
	
		var $content = '#tile-content';
		var $nav_wrap = '#nav-pagination';
		var $anchor = '#nav-pagination .nav-previous a';
		var $text = 'Show More Posts';
	
		var $next_href = $($anchor).attr('href'); // Get URL for the next set of posts
	
		$($nav_wrap).html('<div class="grid_4"><div class="blank striped"><div id="load-more-link"><br/><br/><a id="almc-load-more" href="' + $next_href + '"><span>&raquo; ' + $text + '</span></a></div></div></div>');
	
		$('#almc-load-more').click(function(e) {
			e.preventDefault();
	
			$.get($(this).attr('href'), '', function(data) {
				var $timestamp = new Date().getTime();
				var $new_content = $($content, data).wrapInner('<div class="almc-loaded" id="almc-' + $timestamp + '" />').html(); // Grab just the content
				$next_href = $($anchor, data).attr('href'); // Get the new href
	
				//$('html,body').animate({scrollTop: $($nav_wrap).position().top}, 'slow'); // Animate scroll
	
				$($nav_wrap).before($new_content); // Append the new content
				$('#almc-' + $timestamp).hide().fadeIn('slow'); // Animate load
				$('#almc-load-more').attr('href', $next_href);	// Change the next URL
				$('.almc-loaded ' + $nav_wrap).remove(); // Remove the original navigation
			});
		});
		
		// Dynamic Floating
		$('#dynamic-wrapper').masonry({
			columnWidth: 120, 
			itemSelector: '.grid_2,.grid_4,.grid_8' 
		});			   
	
		// footer positioning
		function getWindowHeight() {
			var windowHeight = 0;
			if (typeof(window.innerHeight) == 'number') {
				windowHeight = window.innerHeight;
			}
			else {
				if (document.documentElement && document.documentElement.clientHeight) {
					windowHeight = document.documentElement.clientHeight;
				}
				else {
					if (document.body && document.body.clientHeight) {
						windowHeight = document.body.clientHeight;
					}
				}
			}
			return windowHeight;
		}
		function setFooter() {
			if (document.getElementById) {
				var windowHeight = getWindowHeight();
				if (windowHeight > 0) {
					var contentHeight = document.getElementById('content').offsetHeight;
					var footerElement = document.getElementById('footer');
					var footerHeight  = footerElement.offsetHeight;
					if (windowHeight - (contentHeight + footerHeight) >= 0) {
						footerElement.style.top = (windowHeight - (contentHeight + footerHeight)) + 'px';
					}
					else {
						footerElement.style.top = '0px';
					}
				}
			}
		}
		window.onload = function() {
			setFooter();
		}
		window.onresize = function() {
			setFooter();
		}
		
		// hover effects

		//$('.post-thumb-block').css('opacity', 0.9);
		$(".post").hover(function() {	
			$(this).find('.grid-post-wrapper').fadeTo("normal", 0.0);
			//$(this).find('.post-thumb-block').fadeTo("normal", 1.0);
		},function() {
			//$(this).find('.post-thumb-block').stop();
			//$(this).find('.post-thumb-block').fadeTo("normal", 0.9);
			$(this).find('.grid-post-wrapper').stop();
			$(this).find('.grid-post-wrapper').fadeTo("normal", 1.0);
		});
		
		
		$('.attachment-prev-link a, .attachment-next-link a').css("opacity", 0.0);
		
		$(".attachment-prev-link a").hover(function() {				  
		$(this).fadeTo("normal", 1.0);
		},function() {
			$(this).stop();
			$(this).fadeTo("normal", 0.0);
		});
		
		$(".attachment-next-link a").hover(function() {				  
		$(this).fadeTo("normal", 1.0);
		},function() {
			$(this).stop();
			$(this).fadeTo("normal", 0.0);
		});
		
		
		$('.slickr-thumb').css('opacity', 0.9);
		$(".slickr-thumb").hover(function() {				  
		$(this).fadeTo("fast", 1.0);
		},function() {
			$(this).stop();
			$(this).fadeTo("fast", 0.9);
		});
		
		$('#link-wrapper img').css('opacity', 0.7);
		$("#link-wrapper img").hover(function() {				  
		$(this).fadeTo("fast", 1.0);
		},function() {
			$(this).stop();
			$(this).fadeTo("fast", 0.7);
		});

	});

	
	

	

