jQuery(document).ready(function($) {
	$('#slider .posts').cycle({
		activePagerClass: 'active-slide',
		fx: 'scrollLeft',
		pager: '#pager',
		pause: 1,
		speed: 500,
		timeout: 6000
	});
	
	// now we need to push images into the pager that cycle() generates because there are no options for it.
	// they are wrapped in a span to do some pro cropping via positioning since wordpress isn't cool enough. 
	if ($('#pager-images').length) {
		var imgs = $('#pager-images').val().split(';')
		imgs.length = imgs.length - 1;
		var pagers = $('#pager a');
		pagers.each(function(i) {
			var html = '<span><img src = "' + imgs[i] + '" alt = "' + imgs[i] + '" /></span>';
			$(this).html(html);
		});
	}
	
	$('#navigation li').mouseenter(function() {
		$(this).addClass('hover');
		if ($(this).children('ul').length)
			$(this).children('ul').toggle();
	});
	
	$('#navigation li').mouseleave(function() {
		$(this).removeClass('hover');
		if ($(this).children('ul').length)
			$(this).children('ul').toggle();
	});
});
