jQuery(document).ready(function($) {
	$('#navigation li').hover(
		function() {
			$(this).addClass('active').children('ul').css('display', 'block');
		},
		function() {
			$(this).removeClass('active').children('ul').css('display', 'none');
		}
	);
	
	$('#image-slider').cycle({
		pause: 1,
		speed: 500,
		timeout: 5000
	});
		
	$('#more-button').click(function() {
		var cats = $('#more-cats').val();
		var offset = $('#more-offset').val();
		var num = $('#more-count').val();
		var uri = 'http://ellwoodthompsons.com/?hidden=' + cats + '&offset=' + offset + '&num=' + num + '&nocache=' + Math.floor(Math.random() * 10001);
		$('#more-button').before('<div id = "more-posts-' + offset + '" style = "display:none">');
		$('#more-posts-' + offset).load(uri, function() {
			$('#more-posts-' + offset).fadeIn(1000, function() {
				window.location = '#more-posts-' + offset;
			});
			if ($('#more-posts-' + offset).text() == 'No more posts!')
				$('#more-button').attr('disabled', 'disabled');
		});
		$('#more-offset').val(parseInt(offset) + parseInt(num));
		return false;
	});
});
