jQuery(document).ready(function(){	
	
	
	// Main Slider
	jQuery(".image_thumb ul li:first").addClass('active'); //Add the active class (highlights the very first list item by default)
	jQuery(".image_thumb ul li").click(function(){
		//Set Variables
		var imgAlt = jQuery(this).find('img').attr("alt"); //Get Alt Tag of Image
		var imgTitle = jQuery(this).find('a').attr("href"); //Get Main Image URL
	
		if (jQuery(this).is(".active")) {  //If the list item is active/selected, then...
			return false; // Don't click through - Prevents repetitive animations on active/selected list-item
		} else
		{ //If not active then...
			//Animate the Description
				jQuery(".main_image img").attr({ src: imgTitle , alt: imgAlt}); //Switch the main image (URL + alt tag)
		}
		//Show active list-item
		jQuery(".image_thumb ul li").removeClass('active'); //Remove class of 'active' on all list-items
		jQuery(this).addClass('active');  //Add class of 'active' on the selected list
		return false;
	
	}) .hover(function(){ //Hover effects on list-item
		jQuery(this).addClass('hover'); //Add class "hover" on hover
		}, function() {
		jQuery(this).removeClass('hover'); //Remove class "hover" on hover out
	});
	
	//Paging  and Slider Function
	rotate = function(){
		var triggerID = active.attr("rel") - 1; //Get number of times to slide
	
		jQuery(".image_thumb li").removeClass('active'); //Remove all active class
		active.addClass('active'); //Add active class (the $active is declared in the rotateSwitch function)
		var imgAlt = active.find('img').attr("alt"); //Get Alt Tag of Image
		var imgTitle = active.find('a').attr("href"); //Get Main Image URL
		jQuery(".main_image img").attr({ src: imgTitle , alt: imgAlt}); //Switch the main image (URL + alt tag)
	
	
	}; 
	
	//Rotation  and Timing Event
	rotateSwitch = function()
	{
		play = setInterval(function()
		{ //Set timer - this will repeat itself every 7 seconds
			active = jQuery('.image_thumb ul li.active').next();
			if ( active.length === 0) {active = jQuery('.image_thumb ul li:first');}
			rotate(); 
		},
		3000); //Timer speed in milliseconds (7 seconds)
	};
	
	rotateSwitch(); //Run function on launch	
	
    jQuery('.featured-products').jcarousel();
	jQuery('select').uniform();

});
