$(document).ready(function() {
	var animateWhere;
	var showPort = 1;
		// Showcase Slider
	$(".outThumbs > a").livequery(function() {
		$(this).click(function() {
			
			var maxChildren = $(".thumbNails .slider").children("table").size();
			var viewWidth = $(".thumbNails").width();
			var goToPixel;
			
			if ($(this).hasClass("prevSel")==true) {
				if (showPort==1) {
					showPort = maxChildren;
				}
				else {
					showPort = showPort - 1;
				}
				goToPixel = Math.ceil(((showPort - 1) * viewWidth) * -1);
			}
			else if ($(this).hasClass("nextSel")==true) {
				if (showPort==maxChildren) {
					showPort = 1;
				}
				else {
					showPort = showPort + 1;
				}
				$(".portSelect ul li a").removeClass("activePort");
				goToPixel = Math.ceil(((showPort - 1) * viewWidth) * -1);
			}
			$(".thumbNails div.slider").animate({ left: goToPixel + 5 }, Math.round(Math.random() * 500 + 700), "easeInOutSine");
			return false;
		});
	});
	$(".thumbNails table a").livequery(function() {
		$(this).click(function() {
			if ($(this).hasClass("activeThumb")==false) {
				$(".thumbNails table a").removeClass("activeThumb");
				$(this).addClass("activeThumb");
				
				var findImage = $(this).children("img").attr("src");
				var newImage = findImage.replace("thumbs/", "");

				$(function () {
					var img = new Image();
					$(".disConcept").fadeTo("fast", 0);
					$(".loading").fadeIn("fast");
					$(img).load(function () {
						$('.disConcept').html(this);
						$(".loading").fadeOut("normal");
						$(".disConcept").fadeTo("fast", 1.00);
						$(this).width();
						$(this).height();
					}).error(function () {
						// notify the user that the image could not be loaded
					}).attr('src', newImage);
				});
			}
			return false;
		});
	});
});