/** Slide Show **/
$(function(){
	$('#slides').slides({
		preload: true,
		preloadImage: Ngymanager.basePath+'theme/august2011/img/theme/loading.gif',
		play: 5000,
		pause: 2500,
		hoverPause: true
	});
});

//tab effects

var TabbedContent = {
	init: function() {
		$(".tab_item").mouseover(function() {

			var background = $(this).parent().find(".moving_bg");

			$(background).stop().animate({
				left: $(this).position()['left']
			}, {
				duration: 300
			});

			TabbedContent.slideContent($(this));

		});
	},

	slideContent: function(obj) {

		var margin = $(obj).parent().parent().find(".slide_content").width();
		margin = margin * ($(obj).prevAll().size() - 1);
		margin = margin * -1;

		$(obj).parent().parent().find(".tabslider").stop().animate({
			marginLeft: margin + "px"
		}, {
			duration: 300
		});
	}
};

$(document).ready(function() {
	TabbedContent.init();
});

/** Caruesel Slider **/
function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        scroll: 1,
    	auto: 3,
        wrap: 'circular',
        initCallback: mycarousel_initCallback
    });
});
