
(function ($) {

	// Testimonials
	function testimonialRotate() {		
		var current = ($('.testimonial-list ul li.show')?  $('.testimonial-list ul li.show') : $('.testimonial-list ul li:first'));	
	  if ( current.length == 0 ) current = $('.hero-banners ul li:first');	
		var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('.testimonial-list ul li:first') :current.next()) : $('.testimonial-list ul li:first'));	
		next.css({opacity: 0.0})
		.addClass('show')
		.animate({opacity: 1.0}, 1000);	
		current.animate({opacity: 0.0}, 1000)
		.removeClass('show');		
	};
	function testimonialRotator() {
		$('.testimonial-list ul li').css({opacity: 0.0});
		$('.testimonial-list ul li:first').css({opacity: 1.0});
		setInterval(function() { testimonialRotate(); },5000);
	}

	// Hero Banners
	function bannerRotate() {		
		var current = ($('.hero-banners ul li.show')?  $('.hero-banners ul li.show') : $('.hero-banners ul li:first'));	
	  if ( current.length == 0 ) current = $('.hero-banners ul li:first');	
		var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('.hero-banners ul li:first') :current.next()) : $('.hero-banners ul li:first'));	
		next.css({opacity: 0.0})
		.addClass('show')
		.animate({opacity: 1.0}, 1000);	
		current.animate({opacity: 0.0}, 1000)
		.removeClass('show');		
	};	
	function bannerRotator() {
		$('.hero-banners ul li').css({opacity: 0.0});
		$('.hero-banners ul li:first').css({opacity: 1.0});
		setInterval(function() { bannerRotate(); },5000);
	}
	
	
	$(document).ready(function() {		
		bannerRotator();
		$('.hero-banners').fadeIn(1000);
		$('.hero-banners ul li').fadeIn(1000);

		testimonialRotator();
		$('.testimonial-list').fadeIn(1000);
		$('.testimonial-list ul li').fadeIn(1000);


	});
	
	
})(jQuery);

$(document).ready(function() {
		var $dialog = $('<div></div>')
			.html('This dialog will show every time!')
			.dialog({
				autoOpen: false,
				title: 'Basic Dialog'
			});

		$('#opener').click(function() {
			$dialog.dialog('open');
			// prevent the default action, e.g., following a link
			return false;
		});
	});
;

