$(document).ready(function() { 

    $("#prod img[title]").tooltip('#tip'); 

});





$(function() {



	$('#gal a').lightBox(); // Select all links in object with gallery ID

	// This, or...

	

});



$(function()

{

	// this initialises the demo scollpanes on the page.

	$('#pane').jScrollPane({scrollbarWidth:10, scrollbarMargin:10});



});







function mycarousel_initCallback(carousel) {

    jQuery('.jcarousel-control a').bind('click', function() {

        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));

        return false;

    });



    jQuery('.jcarousel-scroll select').bind('change', function() {

        carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);

        return false;

    });



    jQuery('#carousel-next').bind('click', function() {

        carousel.next();

        return false;

    });



    jQuery('#carousel-prev').bind('click', function() {

        carousel.prev();

        return false;

    });

	

	  // 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();

    });



};







function highlight(carousel, obejctli,liindex,listate){

     jQuery('.jcarousel-control a:nth-child('+ liindex +')').attr("class","active");

};

function removehighlight(carousel, obejctli,liindex,listate){

     jQuery('.jcarousel-control a:nth-child('+ liindex +')').removeAttr("class","active");

};



jQuery.easing['BounceEaseOut'] = function(p, t, b, c, d) {

	if ((t/=d) < (1/2.75)) {

		return c*(7.5625*t*t) + b;

	} else if (t < (2/2.75)) {

		return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;

	} else if (t < (2.5/2.75)) {

		return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;

	} else {

		return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;

	}

};





// Ride the carousel...

jQuery(document).ready(function() {

    jQuery("#mycarousel").jcarousel({

        scroll: 1,     

		visible: 1,

		auto: 6,

        wrap: 'last',

	//	easing: 'BounceEaseOut',

        animation: 1500,

		initCallback: mycarousel_initCallback,		

		itemVisibleInCallback:  highlight,

		itemVisibleOutCallback: removehighlight

    });

});
