$(document).ready(function() {
	
	// Main Menu
	$("#menu .menu-list li").hover(function() {
		$(this).find(".menu-list li ul").show();
	} , function() {
		$(this).find(".menu-list li ul").hide();
	});
	
	// Clear Search
	$('.search-field').each(function() {
		var default_value = this.value;
		$(this).focus(function() {
			if(this.value == default_value) {
				this.value = '';
			}
		});
		$(this).blur(function() {
			if(this.value == '') {
				this.value = default_value;
			}
		});
	});
	
	// Image Slider
	$(function() {
		$('.slider-list').cycle({ 
		fx:     'fade', 
		speed:   3000, 
		timeout: 5000,
		pause:   0,
		prev:   '.prev-btn', 
		next:   '.next-btn',
		after:   onAfter, 
		});
	});

	// Featured Issues Counter
	function onAfter(curr,next,opts) {
		var caption = '' + (opts.currSlide + 1) + ' of ' + opts.slideCount;
		$('.slider-controls span').html(caption);
	}
	
	// Pause Image Slider
	$('.pause-btn').click(function() { 
		$('.slider-list').cycle('pause');
		$(this).hide();
		$('.resume-btn').show();
		return false;
	});
	
	// Resume Image Slider
	$('.resume-btn').click(function() { 
		$('.slider-list').cycle('resume');
		$(this).hide();
		$('.pause-btn').show();
		return false;
	});
	
	// Image Slider
	$(function() {
		$('.news-wrap').cycle({ 
		fx:     'scrollHorz', 
		speed:   'fast', 
		timeout: 10000,
		pause:   0,
		prev:   '.prev-news', 
		next:   '.next-news',
		after:   onAfter, 
		});
	});
	
	// Featured Issues Counter
	function onAfter(curr,next,opts) {
		var caption = '' + (opts.currSlide + 1) + ' of ' + opts.slideCount;
		$('.news-controls span').html(caption);
	}	
	
});
