/*

Javascript for Advanced Bionics
Created by Rareview Interactive
http://www.rareview.com

*/


/* =jQuery
============================================================================== */
	
$(document).ready(function() {

	 
/* Homepage Carousel
	-------------------------------------------------------------------------- */

	// change selected state on carousel nav


	var afterEndCallback = function(visible){

		curr = $(visible).attr("class");

		$("#home-carousel-nav a.selected").removeClass("selected");

		$("#home-carousel-nav a." +curr).addClass("selected");

		$("#aboutus-carousel-nav a.selected").removeClass("selected");

		$("#aboutus-carousel-nav a." +curr).addClass("selected");

		$("#product-carousel-nav a.selected").removeClass("selected");

		$("#product-carousel-nav a." +curr).addClass("selected");

	}


	// cycle the photos

		
	    $("#home-carousel-photos").jCarouselLite({

	    	visible: 1,

   		start: 0,

	        btnNext: ".next",

	        btnPrev: ".prev",

	        btnGo: ["#home-carousel-nav .panel-1", "#home-carousel-nav .panel-2", "#home-carousel-nav .panel-3", "#home-carousel-nav .panel-4", "#home-carousel-nav .panel-5", "#home-carousel-nav .panel-6"],

	        easing: "easeInOutQuart",

	        speed: 1000,

	        auto: 6000 // change this value to shorten or extend the delay between the auto rotation. Must match the auto value below as well

	    });

	    
	    // cycle the text

	    
	    $("#home-carousel-text").jCarouselLite({

	    	visible: 1,

   		start: 0,
	        btnNext: ".next",

	        btnPrev: ".prev",

	        btnGo: ["#home-carousel-nav .panel-1", "#home-carousel-nav .panel-2", "#home-carousel-nav .panel-3", "#home-carousel-nav .panel-4", "#home-carousel-nav .panel-5", "#home-carousel-nav .panel-6"],

	        easing: "easeInOutQuart",

	        speed: 1000,

	        auto: 6000, // change this value to shorten or extend the delay between the auto rotation. Must match the auto value above as well

	        vertical: true,

	        afterEnd: afterEndCallback

	    });



	 /* About Us Carousel
	-------------------------------------------------------------------------- */

	    // cycle the photos

	    $("#aboutus-carousel-photos").jCarouselLite({

	    	visible: 1,

   		start: 0,

	        btnNext: ".next",

	        btnPrev: ".prev",

	        btnGo: ["#aboutus-carousel-nav .panel-1", "#aboutus-carousel-nav .panel-2", "#aboutus-carousel-nav .panel-3", "#aboutus-carousel-nav .panel-4", "#aboutus-carousel-nav .panel-5", "#aboutus-carousel-nav .panel-6", "#aboutus-carousel-nav .panel-7", "#aboutus-carousel-nav .panel-8"],

	        easing: "easeInOutQuart",

	        speed: 1000,

	        auto: 11000 // change this value to shorten or extend the delay between the auto rotation. Must match the auto value below as well

	    });

	    // cycle the text

	    $("#aboutus-carousel-text").jCarouselLite({

	    	visible: 1,

   		start: 0,

	        btnNext: ".next",

	        btnPrev: ".prev",

	        btnGo: ["#aboutus-carousel-nav .panel-1", "#aboutus-carousel-nav .panel-2", "#aboutus-carousel-nav .panel-3", "#aboutus-carousel-nav .panel-4", "#aboutus-carousel-nav .panel-5", "#aboutus-carousel-nav .panel-6", "#aboutus-carousel-nav .panel-7", "#aboutus-carousel-nav .panel-8"],

	        easing: "easeInOutQuart",

	        speed: 1000,

	        auto: 11000, // change this value to shorten or extend the delay between the auto rotation. Must match the auto value above as well

	        vertical: true,

	        afterEnd: afterEndCallback

	    });



	 /* Product Carousel
	-------------------------------------------------------------------------- */


 	    // cycle the photos

	    $("#product-carousel-photos").jCarouselLite({

	    	visible: 1,

   		start: 0,

	        btnNext: ".next",

	        btnPrev: ".prev",

	        btnGo: ["#product-carousel-nav .panel-1", "#product-carousel-nav .panel-2", "#product-carousel-nav .panel-3", "#product-carousel-nav .panel-4"],

	        easing: "easeInOutQuart",

	        speed: 1000,

	        auto: 8000 // change this value to shorten or extend the delay between the auto rotation. Must match the auto value below as well

	    });


	    // cycle the text

	    $("#product-carousel-text").jCarouselLite({

	    	visible: 1,

   		start: 0,

	        btnNext: ".next",

	        btnPrev: ".prev",

	        btnGo: ["#product-carousel-nav .panel-1", "#product-carousel-nav .panel-2", "#product-carousel-nav .panel-3", "#product-carousel-nav .panel-4"],

	        easing: "easeInOutQuart",

	        speed: 1000,

	        auto: 8000, // change this value to shorten or extend the delay between the auto rotation. Must match the auto value above as well

	        vertical: true,

	        afterEnd: afterEndCallback

	    });
/*News Rotator*/

$(".newsRotator").jCarouselLite({
	btnNext: ".nextNews",
	btnPrev: ".prevNews",
	visible: 1,
	speed: 800,
	vertical: true

});



    
	/* Tooltips
	-------------------------------------------------------------------------- */
   
		$(".tooltip-button").click(function() {
			if($(this).next(".tooltip-top").is(":visible")){
				$(this).next(".tooltip-top").animate({opacity: "hide", right: "30px"}, 200);
				$(this).removeClass("tooltip-button-selected");
				return false;
			} else{
				$(this).next(".tooltip-top").animate({opacity: "show", right: "50px"}, 200);
				$(this).addClass("tooltip-button-selected");
				return false;
			}
		});
			
	// end jQuery
	    
});
