	 $(document).ready(function(){

	    myHeight = $("body").height() - 62 - 113;
		if($('div#content').height() < myHeight) {
			$('div#content').height(myHeight);
			$('div#contentinner').height(myHeight);
		}
					$(".lightbox").lightbox({
			    fitToScreen: true,
			    imageClickClose: false
		    });

			$("div.crop").click(function() {
				
				imgcode = $(this).attr('imagecode');
				
				$("a.sidelink." + imgcode).addClass("active");
				
				$(this).css("z-index","10").animate({ width: "431px", left: "0px", backgroundPosition: "0px 0px" }, 400, "linear", function () {
					//
				});
				
				$("div.thumbnails").fadeOut(1000);
				$("div.thumbnails." + imgcode).fadeIn(1000);
				
				$thestart=false;
				return false;

				
			});

			
			$("a.sidelink").click(function() {
			    myid = $(this).attr("id");
					imgcode = $(this).attr('imagecode');
			    $(this).addClass("active");
			    $(this).siblings().removeClass("active");
			    
					pic_reset(myid);

					$("div.thumbnails").fadeOut(1000);
					$("div.thumbnails." + imgcode).fadeIn(1000);					
					
					$thestart=false;
					return false;

			});			

			$('img#top_two').wait().mouseout(function () {
				$('div#prod_sub').hide();
			});			
		
			$('div#prod_sub').mouseover(function () {
				$('div#prod_sub').show();
			});	
		
			$('div#prod_sub').mouseout(function () {
				$('div#prod_sub').hide();
			});		
			
	});

	$.fn.wait = function(time, type) {
        time = time || 1000;
        type = type || "fx";
        return this.queue(type, function() {
            var self = this;
            setTimeout(function() {
                $(self).dequeue();
            }, time);
        });
    };	
	
	function pic_reset(myid) {
		
			if($("div.imga").css("width") == "431px") {
				$("div.imga").stop();
				$("div.imga").animate({ width: "53px", left: "0px", backgroundPosition: "0px 0px" }, 400, "linear", function () {	
					$(this).css("z-index",1);	
					$("div." + myid).css("z-index","10").animate({ width: "431px", left: "0px", backgroundPosition: "0px 0px" }, 400, "linear", function () { });
				});
			} else if($("div.imgb").css("width") == "431px") {
				$("div.imgb").stop();
				$("div.imgb").animate({ width: "53px", left: "54px", backgroundPosition: "0px 0px" }, 400, "linear", function () {	
					$(this).css("z-index",1);	
					$("div." + myid).css("z-index","10").animate({ width: "431px", left: "0px", backgroundPosition: "0px 0px" }, 400, "linear", function () { });
				});
			} else if($("div.imgc").css("width") == "431px") {
				$("div.imgc").stop();
				$("div.imgc").animate({ width: "53px", left: "108px", backgroundPosition: "0px 0px" }, 400, "linear", function () {	
					$(this).css("z-index",1);	
					$("div." + myid).css("z-index","10").animate({ width: "431px", left: "0px", backgroundPosition: "0px 0px" }, 400, "linear", function () { });
				});
			} else if($("div.imgd").css("width") == "431px") {
				$("div.imgd").stop();
				$("div.imgd").animate({ width: "53px", left: "162px", backgroundPosition: "0px 0px" }, 400, "linear", function () {	
					$(this).css("z-index",1);	
					$("div." + myid).css("z-index","10").animate({ width: "431px", left: "0px", backgroundPosition: "0px 0px" }, 400, "linear", function () { });
				});
			} else if($("div.imge").css("width") == "431px") {
				$("div.imge").stop();
				$("div.imge").animate({ width: "53px", left: "216px", backgroundPosition: "0px 0px" }, 400, "linear", function () {	
					$(this).css("z-index",1);	
					$("div." + myid).css("z-index","10").animate({ width: "431px", left: "0px", backgroundPosition: "0px 0px" }, 400, "linear", function () { });
				});
			} else if($("div.imgf").css("width") == "431px") {
				$("div.imgf").stop();
				$("div.imgf").animate({ width: "53px", left: "270px", backgroundPosition: "0px 0px" }, 400, "linear", function () {	
					$(this).css("z-index",1);	
					$("div." + myid).css("z-index","10").animate({ width: "431px", left: "0px", backgroundPosition: "0px 0px" }, 400, "linear", function () { });
				});
			} else if($("div.imgg").css("width") == "431px") {
				$("div.imgg").stop();
				$("div.imgg").animate({ width: "53px", left: "324px", backgroundPosition: "0px 0px" }, 400, "linear", function () {	
					$(this).css("z-index",1);	
					$("div." + myid).css("z-index","10").animate({ width: "431px", left: "0px", backgroundPosition: "0px 0px" }, 400, "linear", function () { });
				});
			} else if($("div.imgh").css("width") == "431px") {
				$("div.imgh").stop();
				$("div.imgh").animate({ width: "53px", left: "378px", backgroundPosition: "0px 0px" }, 400, "linear", function () {	
					$(this).css("z-index",1);	
					$("div." + myid).css("z-index","10").animate({ width: "431px", left: "0px", backgroundPosition: "0px 0px" }, 400, "linear", function () { });
				});
			} else {
					$("div." + myid).css("z-index","10").animate({ width: "431px", left: "0px", backgroundPosition: "0px 0px" }, 400, "linear", function () { });
				}
				
	}
