$(function() {
    $('ul.rotator').not('.hasControls').cycle({
    	slideExpr: 	'li',
	   	pause:	1,
	   	timeout: 6000
    });

	var $rotator = $('ul.rotator.hasControls');

	$rotator.append('<div id="slidetabs"></div><div id="controls"><a href="#" id="pause">||</a></div>').cycle({
    	slideExpr: 	'li',
	   	pager:		'#slidetabs',
	   	prev:		'#prev',
	   	next:		'#next',
	   	pause:		0,
	   	timeout: 	5000
    }).hover(
		function(){
    		$(".controls", this).fadeIn();
    		/*
    		var x = $(".controls", this).offset().left;
    		var y = $(".controls", this).offset().top;
    		alert(x + "/" + y);
    		*/
	  	},
		function(){
    		$(".controls", this).fadeOut();
    		//alert('Out');
		}
    );

   $('#pause').toggle(function(){
    	$(this).html('>');
    	$rotator.cycle('pause');
    	// alert('pause');
    }, function (){
    	$(this).html('||');
    	$rotator.cycle('resume', true);
    	// alert('resume');
    });

});


