$(function() {

	var playing = true;
	var pause_time = 60000;

	// start by rotating
	$("#rotator").tabs({ fx:{opacity: "toggle", duration: 150}}).tabs("rotate", pause_time);
	
	var $tabs = $('#rotator').tabs();



	$("#rotator > ul > li > a").click(
		// go to the URL written in the title when clicked
		function() {
			window.location = $(this).attr('title');
		}			
	);	


	
	// If hovered
	$("#nav-fragment-1").hoverIntent (
		// hover actions
		function() {
			// stop rotation
 			$("#rotator").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 0);
 			// focus on the image
			$tabs.tabs('select', 0);
		},
		function() { null; 
		}			
	);	

	$("#nav-fragment-2").hoverIntent (
		function() {
 			$("#rotator").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 0);
			$tabs.tabs('select', 1);
		},
		function() { null;
		}			
	);	

	$("#nav-fragment-3").hoverIntent (
		function() {
 			$("#rotator").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 0);
			$tabs.tabs('select', 2);
		},
		function() { null;
		}			
	);	

	$("#nav-fragment-4").hoverIntent (
		function() {
 			$("#rotator").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 0);
			$tabs.tabs('select', 3);
		},
		function() { null;
		}			
	);	

	$("#nav-fragment-5").hoverIntent (
		function() {
 			$("#rotator").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 0);
			$tabs.tabs('select', 4);
		},
		function() { null;
		}			
	);	
	
});

