$(document).ready(function() {

/*var count = 0, holder = '#rotatorSlides', sclass = '.rslide', inc = 6000, jumpLinks = '#jumpLinks', play = '.play', pause = '.pause';

$('.jump').click( function () {
	var indexNum = $(this).attr("rel");
	alert(indexNum);
}); 

function skipTo(indexNum) {
	var img = $(sclass).attr("alt");
	if (indexNum === img) {
		var clone = $(img).clone().appendTo(holder).fadeIn(800, function() {
		$(this).siblings().hide();
		});
		$(img).remove();
	}
}

function rotate() {
	count++;
	// Create loop
	setTimeout(function() {
		rotate();
	}, inc);
	
	// If this is the first iteration
	if (count == 1) {
		var first = $(sclass)[0];
		var firstc = $(first).clone().appendTo(holder).siblings().hide();
		$(first).remove();
		return;
	}

	// Rotate Images
	var img = $(sclass)[0];
	var clone = $(img).clone().appendTo(holder).fadeIn(800, function() {
		$(this).siblings().hide();
	});
	$(img).remove();
}
rotate();*/

	$("#rotatorSlides").cycle({
		pager: "#jumpLinks",
		timeout: 6000,
		fx: "fade",
		pagerAnchorBuilder: function(idx, slide) { 
            return '<a href="#" title="' + jQuery(slide).eq(0).attr("title") + '">' + jQuery(slide).eq(0).attr("title") + '</a>';
		}
	});
	
	$("a.pause").click(function () {
		if( $(this).hasClass("play") ) {
			$(this).removeClass("play");
			$(this).attr("title", "Pause");
		} else {
			$(this).addClass("play");
			$(this).attr("title", "Play");
		}
		$("#rotatorSlides").cycle('toggle');
	});

	$('#jumpLinks a[title]').tooltip({
		offset:[-9,0],
		layout:"<div><div class='tooltip-arrow'></div></div>"
	});

});
