// JavaScript Document Home Page Gallery
$move_by = 405;
$frame_left = 0;
$frame_no = 1;

$(document).ready(function()
{
	$max_clicks = $("#image_container").children().size(); 
	$imgCont = $move_by * $max_clicks;
	
	$("#image_container").css({width : $imgCont});
	
function left() {	

	/* Set the new position & frame number */
			$new_frame_no = (($frame_no/1)-1);
			$new_left = (($frame_left/1) + $move_by);
			/* Check if we're moving too far over */
			if($new_frame_no <= 0)
				{
					/* Move the images all the way left, minus one frame */
					$new_left = -($move_by*$max_clicks)+$move_by;
					$new_frame_no = $max_clicks;
				}
			$new_left_attr = $new_left+"px";
			$("#image_container").animate({left: $new_left_attr}, 800 );
			$frame_left = $new_left;
			$frame_no = $new_frame_no;
			
		}
		
function right() {

			/* Set the new position & frame number */
			$new_frame_no = (($frame_no/1)+1);
			$new_left = (($frame_left/1) - $move_by);
			/* Check if we're moving too far over */
			if($new_frame_no >= $max_clicks +1)
				{		
					/* Move all the way right, to the beginning*/
					$new_left = 0;
					$new_frame_no = 1;
				}				
			$new_left_attr = $new_left+"px";
			$("#image_container").animate({left: $new_left_attr}, 800 );
			$frame_left = $new_left;
			$frame_no = $new_frame_no;
		}

	
	
	$("#sleft").click(function()
		{
			left()			
		});
		
	$("#sright").click(function()
		{
			right()
		});
	
	setInterval(function(){
		right();
	}, 8000);
		
});


$descWidth = 890;

//Her Works book page

$(function() {

	$noOfItems = $("ul#booklinks li a").size();
	$totalWidth = $descWidth * $noOfItems;
	
	$("#descriptionScroll").css({width: $totalWidth});

	$("ul#booklinks li a").click(function() {
		
		$clicked = $(this).attr("class");
		
		if 
		
		($clicked == "book-q quon") {
		$("#descriptionScroll").animate({left : -2670}, 800);
		} 
		
		else if

		($clicked == "book-dq dq") {
		$("#descriptionScroll").animate({left : 0}, 800);
		} 		
		
		else if

		($clicked == "book-d dam") {
		$("#descriptionScroll").animate({left : -1780}, 800);
		} 	

		else if

		($clicked == "book-tw wrek") {
		$("#descriptionScroll").animate({left : -890}, 800);
		} 			
	
	});
	
});


// Quotes changer

 

