$(document).ready(function() {
	$('.more').click(function() {
		var id = $(this).attr('id').substring(5);
		$('#short-' + id).hide();
		$('#long-' + id).show();
	});
	$('.less').click(function() {
		var id = $(this).attr('id').substring(5);
		$('#short-' + id).show();
		$('#long-' + id).hide();
	});
	$('.viewer').click(function() {
		var jquery_this = $(this);
		var id = jquery_this.attr('id');
		$('.viewer').removeClass('active');
		if (id == 'all') {
			$('.newsitem:hidden', ".content").show();
		} else {
			$('.newsitem', ".content").hide().filter('.' + id).show();
		}
		jquery_this.addClass('active');
	});
	
	resize_testimonials();
	start_left_column();
});

function resize_testimonials() {
	var tallest_testimonial = 0;
	$('.testimonials .testimonial').each(function() {
		var this_height = $(this).height();
		if(this_height > tallest_testimonial) {
			tallest_testimonial = this_height;
		}
	});
	$('.testimonials').css('height', tallest_testimonial + 'px');
}

function start_left_column() {
	$.getScript('/js/jquery.cycle.js', function() {										
		$('#testimonials').cycle({
			fx: 'scrollUp',
			pause: 1,
			timeout: 9000
		});
		
		$.getScript('/js/banner.js', function() {
			start_banner();
		});
		
		var newswidget_items = $('.newswidget .articles .newsitems');
		if(newswidget_items.height() > 225) {
			newswidget_items.cycle({
				fx: 'scrollUp',
				speed: 1000,
				timeout: 4500,
				pause: 1
			});
		}
	});
}
