$(document).ready(function() {

	// code for product tabs
	$("#cs_product_navigation li a").click(function() {
		// highlight clicked tab
		$("#cs_product_navigation li").attr("class", "");
		$(this).parent().attr("class", "selected");
		
		// remove annoying box from tab
		$(this).blur();

		// display appropriate page
		$("div.product.content").css("display", "none");
		var selectedPage = $("div.product.content." + $(this).attr("href").replace("#", ""));
		$(selectedPage).css("display", "block");

		// resize frame to fit current page
		var newHeight = $(selectedPage).height() + $(selectedPage).attr("offsetTop") + 20;
		$("div#cs_product_body_main").css("height", newHeight + "px");
		
		return false;
	});
	
	// lightbox on gallery images
	$("#cs_product_images a").lightBox({ fixedNavigation: true });
	$("#cs_product_features .feature a").lightBox({ fixedNavigation: true });
	
	var loc = document.location.toString();
	$("a#product-sendtofriend").attr("href", "mailto:?subject=" + document.title.replace(/ /g, "%20") + "&body=" + loc); // .replace("http://", "http%3A%2F%2F").replace(/\//g, "%2"));
	
});