$(document).ready(function() {

	$(".jquery-info").hide(); 
	$(".tab_content").hide();
	$("#drop-artprints").hide();
	$("#drop-wallart").hide();
	$("#drop-accessories").hide();
	$("ul.tabs li:first").addClass("active").show();
	$(".tab_content:first").show(); 
	
	$("ul.tabs li").click(function() {

		$("ul.tabs li").removeClass("active"); 
		$(this).addClass("active");
		$(".tab_content").hide();

		var activeTab = $(this).find("a").attr("href");
		$(activeTab).fadeIn(900);
		return false;
	});

	$("#nav li#accessories").hover(function() {	
		$("#drop-accessories").fadeIn(400);
		$("#drop-wallart").fadeOut(200);
		$("#drop-artprints").fadeOut(200);
	});
	
	$("#nav li#artprints").hover(function() {	
		$("#drop-artprints").fadeIn(400);
		$("#drop-wallart").fadeOut(200);
		$("#drop-accessories").fadeOut(200);
	});
	
	$("#nav li#wallart").hover(function() {
		$("#drop-wallart").fadeIn(400);
		$("#drop-artprints").fadeOut(200);
		$("#drop-accessories").fadeOut(200);
	});

	  var showDelay = 200;
	  var showTimer = null;

	  $('#nav').live('mouseleave', function()
	  {
		  if (showTimer)
	      clearTimeout(showTimer);
	      showTimer = setTimeout(function()
	      {
	        		$("#drop-wallart").fadeOut(200);
	        		$("#drop-artprints").fadeOut(200);
	        		$("#drop-accessories").fadeOut(200);
	      }, showDelay);
	    });
	  	
	  
	  $(".prodimgcontain a").click(function(event) {
			event.preventDefault();
		});
		$(".prodimg a.click").click(function(event) {

		});
		$(".prodimg").mouseleave(function(event) {
			
		});
		
		$('.thumb:nth-child(1) img').click(function(event) {
			$('.prodimgcontain .prodimg:nth-child(1)').fadeOut(250);
			event.preventDefault();
			setTimeout(
					  function() 
					  {
			var thumb1 = $('.thumb:nth-child(1) img').attr("src");
			var defaultimg = $('.prodimgcontain .prodimg:nth-child(1)').attr("src");
			$('.prodimgcontain .prodimg:nth-child(1)').attr("src", thumb1);
			$('.prodimgcontain .prodimg:nth-child(1)').css("max-width", "387px");
			$('.prodimgcontain .prodimg:nth-child(1)').fadeIn(500);
					  }, 250);
		});
		
		$('.thumb:nth-child(2) img').click(function(event) {
			$('.prodimgcontain .prodimg:nth-child(1)').fadeOut(250);
			event.preventDefault();
			setTimeout(
					  function() 
					  {
			var thumb2 = $('.thumb:nth-child(2) img').attr("src");
			var defaultimg = $('.prodimgcontain .prodimg:nth-child(1)').attr("src");
			$('.prodimgcontain .prodimg:nth-child(1)').attr("src", thumb2);
			$('.prodimgcontain .prodimg:nth-child(1)').css("max-width", "387px");
			$('.prodimgcontain .prodimg:nth-child(1)').fadeIn(500);
					  }, 250);
		});
		
		$('.thumb:nth-child(3) img').click(function(event) {
			$('.prodimgcontain .prodimg:nth-child(1)').fadeOut(250);
			event.preventDefault();
			setTimeout(
					  function() 
					  {
			var thumb3 = $('.thumb:nth-child(3) img').attr("src");
			var defaultimg = $('.prodimgcontain .prodimg:nth-child(1)').attr("src");
			$('.prodimgcontain .prodimg:nth-child(1)').attr("src", thumb3);
			$('.prodimgcontain .prodimg:nth-child(1)').css("max-width", "387px");
			$('.prodimgcontain .prodimg:nth-child(1)').fadeIn(500);
					  }, 250);
		});
	
});
