//Setup carousel scrolling auto

function mycarousel_initCallback(carousel, state)
{

    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.stopAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.stopAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.stopAuto();
    });
};

function mycarouselinner_initCallback(carousel, state)
{

    jQuery('#mycarousel a').bind('click', function() {

//		   alert(jQuery(this).text());
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });


    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.stopAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.stopAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.stopAuto();
    });
};


//Load carousel

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        auto: 0,
        wrap: 'last',
        initCallback: mycarousel_initCallback,
        scroll: 1
    });
	jQuery('#mycarouselinner').jcarousel({
        auto: 0,
        wrap: 'last',
        initCallback: mycarouselinner_initCallback,
        scroll: 1
    });

    //Hide login form
		$(".login-form").hide();
		$(".login-link a").click(function(){
			$(".login-form").show();
			$(".login-link").hide();
			return false;
		});
		
		//Show/hide payment
		$(".how-worldpay").click(function(){
			$("#cardinfo").hide();
		});
		
		$(".how-card").click(function(){
			$("#cardinfo").show();
		});
});


