$(document).ready( function(){
 			$('.product-description .images').find('> a').not("#imglink2").lightBox({fixedNavigation:true});
 			$('.product-description .images a#imglink2').lightBox({fixedNavigation:true});

   $(".product-description .smallimgs").click(function() {
   	var locs =  "main"+$(this).attr("id");
	$(".product-description .images .mainimgs").css("visibility", "hidden");
	$(".product-description .images img[id="+locs+"]").css("visibility", "visible");
   });
  if($('#categories-nav').length!=0){
   	var cnavh =  $('#categories-nav').height()+80;
   	var p = $("#categories-nav");
  	var offset = p.offset();
   	$(".cat-item a").click(function() {
   	$('a.current').removeClass("current");
   		var location =  $(this).attr("title");
   		$('#'+location).addClass("current");
   		$('a.current').css("height", +cnavh+"px");
   		$('#categories-nav').addClass("floaty");
   		$('#categories-nav.floaty').css("left", +offset.left+"px");
   	});
   	if($(window).scrollTop() > offset.top){
   		var location =  $(this).attr("title");
   		$('#'+location).addClass("current");
   		$('a.current').css("height", +cnavh+"px");
   		$('#categories-nav').addClass("floaty");
   		$('#categories-nav.floaty').css("left", +offset.left+"px");
   	}
   	$(window).scroll(function() {
 		if($(window).scrollTop() < offset.top){
			$('#categories-nav').removeClass("floaty");
	    	$('a.current').removeClass("current");
		}
		else if($(window).scrollTop() > offset.top){
   		var location =  $(this).attr("title");
   		$('#'+location).addClass("current");
   		$('a.current').css("height", +cnavh+"px");
   		$('#categories-nav').addClass("floaty");
   		$('#categories-nav.floaty').css("left", +offset.left+"px");
   		}
   	});

   	$("th.top a").click(function() {
	   $('#categories-nav').removeClass("floaty");
	   $('a.current').removeClass("current");
   	});
  }


 } );

