/** Script used in the Cross Action Product Page */
$(document).ready(function(){
	// Add the tabs click functionality
	$(".tab span a").click(function(){
		// Get the tab to open
		var selectedTab = $(this).attr('rel');
		/// Toggle tabs functionality
		if(selectedTab == "tab1"){
			$(".tab2").removeClass("active");
			$(".tab1").addClass("active");
			$("#tab_2").css('display', 'none');
			$("#tab_1").css('display', 'block');
		} else if (selectedTab == "tab2"){
			$(".tab1").removeClass("active");
			$(".tab2").addClass("active");
			$("#tab_1").css('display', 'none');
			$("#tab_2").css('display', 'block');
		}
		return false;
	});
	
	// Add click functionality to the "More" button
	$(".more").click(function(){
		// Box to display
		var detailBox = $(".detail",$(this).parent());
		// If the detail box to open is hidden, then hide all the others and show it
		if(detailBox.css('display') == 'none'){
			$(".detail").fadeOut();
			detailBox.fadeIn();
			// When users clicks on the zoom popup, it will disapear
			detailBox.click(function(){
				$(this).fadeOut();
			});
		}
		return false;
	});
});
