
// Main Menu Functions
$(function() {
	$('#navigation .main').prepend('<span class="hover"></span>');
    $('#navigation .hover').css('opacity', 0);
	$('#navigation .main').hover(function() {
		// on hover
		$('.hover', this).stop().animate({
			'opacity': 1
		}, 900, 'easeOutQuad');
	}, function() {
		// off hover
		$('.hover', this).stop().animate({
			'opacity': 0
		}, 950, 'easeOutQuad');
	});
	$('#navfoot .foot').prepend('<span class="hoverf"></span>');
    $('#navfoot .hoverf').css('opacity', 0);
	$('#navfoot .foot').hover(function() {
		// on hover
		$('.hoverf', this).stop().animate({
			'opacity': 1
		}, 900, 'easeOutQuad');
	}, function() {
		// off hover
		$('.hoverf', this).stop().animate({
			'opacity': 0
		}, 950, 'easeOutQuad');
	});
});

//Sidebar Carousel Prev/Next Button Functions
function slidecarousel_initCallback(carousel) {
    $('.slide-right').bind('click', function() {
        carousel.next();
        return false;
    });
    $('.slide-left').bind('click', function() {
        carousel.prev();
        return false;
    });
};
function topsellercarousel_initCallback(carousel) {
    $('.topseller-right').bind('click', function() {
        carousel.next();
        return false;
    });
    $('.topseller-left').bind('click', function() {
        carousel.prev();
        return false;
    });
};
function newprodcarousel_initCallback(carousel) {
    $('.newprod-right').bind('click', function() {
        carousel.next();
        return false;
    });
    $('.newprod-left').bind('click', function() {
        carousel.prev();
        return false;
    });
};
//Sidebar Carousel Functions
$(document).ready(function() {
    $(".slide-carousel").jcarousel({
	    wrap: 'circular',
        scroll: 12,
        initCallback: slidecarousel_initCallback,
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
    $(".topseller-carousel").jcarousel({
        scroll: 1,
        initCallback: topsellercarousel_initCallback,
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
    $(".newprod-carousel").jcarousel({
        scroll: 1,
        initCallback: newprodcarousel_initCallback,
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});

// Index Image Slider
$(window).load(function() {
	setTimeout(function(){
		$('#slider').nivoSlider({
		    effect:'sliceUpDown',
			slices:25,
			animSpeed:600,
			pauseTime:5000,
			startSlide:0,
			directionNav:true,
			directionNavHide:true,
			controlNav:false,
			keyboardNav:false,
			pauseOnHover:true,
			manualAdvance:false,
			captionOpacity:0.8
		});
	}, 300);
});

// New Product/Top Sellers Tabs
$(document).ready(function() {
	//Default Action
	$(".tab-content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab-content:first").show(); //Show first tab content
	//On Click Event
	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab-content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});
});


