/* Product Javascript */
/* Load-time stuff */
$(document).ready(function() {
	//Lightbox-enable the images
	$('div.product a.lightbox').lightbox();	
	
});

/**
 * Add a book to the basket
 *
 * @param int The product ID
 * @param string The function (buy or loan)
 * @return bool False to stop the link firing
 */
function addToBasket(productId,request) {
	//Add to the basket - but only for these request methods
	if (request=='buy' || request=='loan' || request=='download') {
		//Send via ajax
		var ajaxUri=httpUrl+"ajax/basket/add/"+encodeURIComponent(request)+"/uniqueId/"+uniqueId+"/productId/"+productId+"/";
				
		//Post to the basket, then redirect to it to avoid repeat basket adding
		$.ajax({
				async: false,
				type: "GET",
				url: ajaxUri
		});
		//Redirect to the basket page
		window.location.href=httpUrl+"basket/";

	}
	return false;
}

