$(document).ready(function() {
	curr = ($('a[href = ?' + currbook + ']').parent().attr('rel'));
	if(curr != undefined){
		$('a[href = ?' + currbook + '] > img').css('border', '2px solid #FF3A00');
	}
	  $("#slider").sudoSlider({
		prevNext: false,
		continuous: true,
		startSlide: curr
	  });
	$('p.expand').expander({
    slicePoint:       100,  // default is 100
    expandText:         '[read more]', // default is 'read more...'
    collapseTimer:    0, // re-collapses after 5 seconds; default is 0, so no re-collapsing
    userCollapseText: '[close]'  // default is '[collapse expanded text]'
  });
		$('.nav > div').mouseover(function() {
  				path = "img/" + $(this).find('img').attr('id') + "1.png";
  				$(this).find('img').attr("src", path);
  				$(this).find('ul').css("visibility", "visible");
		});
		$('.nav > div').mouseout(function() {
				$(this).find('ul').css("visibility", "hidden");
  				if($(this).find('img').attr('class') != "active tab"){
  					path = "img/" + $(this).find('img').attr('id') + ".png";
  					$(this).find('img').attr("src", path);
  				}
		});
		$('.nav > div > ul > li').mouseout(function() {
  				$(this).css('background-color', '#f44513');
  				$(this).children().css('color', '#ffffff');
		});
		$('.nav > div > ul > li').mouseover(function() {
  				$(this).css('background-color', '#ffff99');
  				$(this).children().css('color', '#f33a14');
		});
		$(".binside img:first-child").css("display", "block").attr("class", "show");
		$('#description').css("color", "#006400");
		$('#next').click(function() {
			if ($(".show").next().length) {
				$(".show").next().css("display", "block").attr("class", "show");
				$(".show:first").css("display", "none").removeClass("show");
			}
		});
		$('#prev').click(function() {
			if ($(".show").prev().length) {
				$(".show").prev().css("display", "block").attr("class", "show");
				$(".show:last").css("display", "none").removeClass("show");
			}
		});
		$('.book').click(function() {
			$('.book').css("color", "#F33A14");
			$(this).css("color", "#006400");
		});
		$('#look').click(function() {
			$('.bcontent').css("display", "none");
			$('.binsidewrap').css("display", "block");
		});
		$('#description').click(function() {
			$('.binsidewrap').css("display", "none");
			$('.bcontent').css("display", "block");
			$('.bpraise').css("display", "none");
			$('.bdesc').css("display", "block");
		});
		$('#reviews').click(function() {
			$('.binsidewrap').css("display", "none");
			$('.bcontent').css("display", "block");
			$('.bdesc').css("display", "none");
			$('.bpraise').css("display", "block");
		});
		$('.nav > div > ul > li').click(function() {
			location.href = ($(this).children()[0].href);
		});
		$('#lft').click(function() {
			 $("#slider").sudoSlider('prev');
		});
		$('#rght').click(function() {
			 $("#slider").sudoSlider('next');
		});
		$('.colleft > .colhead').click(function() {
			 location.href = "?page_id=2";
		});
		$('.colright > .colhead').click(function() {
			 location.href = "?page_id=554";
		});
	if(location.hash == "#reviews"){
		$('#reviews').trigger('click');
	}
	if(location.hash == "#description"){
		$('#description').trigger('click');
	}
	if(location.hash == "#look"){
		$('#look').trigger('click');
	}
});
