myCarousel = null; // This will be the carousel object 
myData = null; // This is the data for the carousel 

function onInitCarousel(carousel, state) { 
    if (state == 'init') { 
        myCarousel = carousel;
		//alert("Carousel Initialized " + myCarousel);
    } 
} 

function onItemLoadCallback(carousel, state) { 
    // build your items from myData[...] here 
	//alert("Carousel Load Call Back " + state);
} 

jQuery(document).ready(function($){
    $("div.team").click(function () {
		var mydiv = $(this);
		$.ajax({
		   type: "POST",
		   cache: false,
		   url: "/about-pzizz/the-pzizz-team/",
		   data: "post_expander=1&post_id="+mydiv.attr("id"),
		   success: function(data){
			 $("div#aboutus").hide().html(data).fadeIn("5000");
		   }
		 });
		return false;
    }); 
});

jQuery(document).ready(function($){
    $("li.myreview").click(function () {
		var myreview = $(this);
		$.ajax({
		   type: "POST",
		   cache: false,
		   url: "/reviews/",
		   data: "review=1&t_id="+myreview.attr("id"),
		   success: function(data){
			 $("div#aboutus").hide().html(data).fadeIn("5000");
		   }
		 });
		return false;
    }); 
});

jQuery(document).ready(function($){
    $("li.mycategory").click(function () {
		var mycat = $(this);
		//Change About us to Random Review from Category selection
		$.ajax({
		   type: "POST",
		   cache: false,
		   url: "/reviews/",
		   data: "rcategoryreview=1&c_id="+mycat.attr("id"),
		   success: function(data){
			 $("div#aboutus").hide().html(data).fadeIn("5000");
		   }
		 }); 
		//Get Category Listings
		$.ajax({
		   type: "POST",
		   cache: false,
		   url: "/reviews/",
		   data: "rcategory=1&c_id="+mycat.attr("id"),
		   success: function(data){
			 //Reset the Carousel so we can add new data
 			 myCarousel.reset();
			 //myCarousel.reload(); 
			 //Get New Data and load into Carousel
			 $("ul#mycarousel").html(data).fadeIn("5000");
			 $('#mycarousel').jcarousel({
				initCallback: onInitCarousel, 
				itemLoadCallback: onItemLoadCallback,
				scroll: 6,
				visible: 6
			});
			
			//Rebind Click Event on each testimonial
			$("li.myreview").click(function () {
				var myreview = $(this);
				$.ajax({
				   type: "POST",
				   cache: false,
				   url: "/reviews/",
				   data: "review=1&t_id="+myreview.attr("id"),
				   success: function(data){
					 $("div#aboutus").hide().html(data).fadeIn("5000");
				   }
				 });
				return false;
			}); 
		   }
		 });
		return false;
    }); 
});