/*
	Author: Talhah Mahomedy (tmahomedy@barrowsonline.com)
	Project: Barrows | Retail Marketing Specialists
	Function: Javascript for handling all book events

	copyright 2011 Barrows Design And Manufacture
*/

$(document).ready(function(){
    $('.books, .books_light_close, .au_books').live('click', function(){
        var books;

        if($(this).hasClass('au_books')){
            books = $(this).next().attr('id');
        }else{
			books = $(this).attr('id');
		}
        category_number = books.replace('books_', '');
        category = 'books';
        background_color = '#FFF';

        goto_location(category, category_number, background_color, 0);

    });

	$('.books_light_section_home').live('click', function(){
        category_number = 1
        category = 'books';
        background_color = '#FFF';

        goto_location(category, category_number, background_color, 0);

    });

	// Handle books thumb select
	$('.books_thumb').live('click', function(){
		var book_id = $(this).attr('id');

		//Get Ajax and handle
		$.ajaxQueue({
			url: 'include/content/books/books_ajax.php?action=get_book_synopsis&book_id='+book_id+'&cache='+new Date().getTime(),
			async: true,
			dataType: "html",
			success: function(data){
				$('.light_holder').html(data);
			}
		});
	});

});

