$(document).ready(function() {
	
	var $mydiv = $('#tabs-horizontal').length;
	if ($mydiv) {
	
		var myinterval = 5000;

		$.fn.equalHeights = function(minHeight, maxHeight) {
			tallest = (minHeight) ? minHeight : 0;
			this.each(function() {
				if($(this).height() > tallest) {
					tallest = $(this).height();
				}
			});
			if((maxHeight) && tallest > maxHeight) tallest = maxHeight;
			return this.each(function() {
				$(this).height(tallest).css("overflow","auto");
			});
		}

		var $tabs = $('#tabs-horizontal ul').tabs({
			event: 'click', 
			fx: { opacity: 'toggle' }
		});//.tabs( 'rotate' , myinterval, false );

		$('#tabs-horizontal .ui-tabs-panel').equalHeights(200,800);

		var selected = $tabs.tabs('option', 'selected');

		$('#tabs-horizontal #next-prev .next-slide').click(function() { 
			selected = $tabs.tabs('option', 'selected');
			$tabs.tabs('select', selected + 1); 
			return false; 
		});

		$('#tabs-horizontal #next-prev .prev-slide').click(function() { 
			selected = $tabs.tabs('option', 'selected');
			$tabs.tabs('select', selected - 1); 
			return false; 
		});

		$("#tabs-horizontal .next-slide").hover(
			function () { $(this).addClass("next-rollover"); }, 
			function () { $(this).removeClass("next-rollover");}
		);

		$("#tabs-horizontal .prev-slide").hover(
			function () { $(this).addClass("prev-rollover"); }, 
			function () { $(this).removeClass("prev-rollover");}
		);

	}
	
});
		
