var $j = jQuery.noConflict();
$j(document).ready(function() {
	
	//Product Image Zoom
	var zoomValue = false;

	$j('#image,#zoom-btn').click(function() {
		var zoomValue = true;
		var home = $j('#header h1 a').attr('href');
		$j('.product-copy').hide();
		$j('#zoom-btn').toggle();
		$j('#close-zoom').toggle();
		var ImageUrl = $j('#image').attr('longdesc');
		var NewImage = new Image();
	   	NewImage.onload = function() {
			$j('.product-img-box').animate({'width':NewImage.width,'height' : NewImage.height}, 600);
			$j('#image').toggle();
			$j('#big-image').css('top','0px');
			$j('#big-image, #zoom').animate({'width':NewImage.width, 'height':NewImage.height}, 600);
			$j('#zoom').show();
	   	};
		NewImage.src = ImageUrl;
		$j('#big-image').attr('src', ImageUrl);
	});

	$j('#close-zoom, #big-image').click(closeZoom);

	function closeZoom() {
		var zoomValue = false;
		$j('#close-zoom').toggle();
		$j('#zoom-btn').toggle();
		$j('#big-image, #zoom').animate({'width':'380px', 'height':'380px'}, 600, function() { $j('#zoom').hide(); $j('.product-copy').fadeIn('fast'); }); //Set width and height to the dimension of your image
		$j('.product-img-box').animate({'width':'380px','height' : '380px'}, 600);	//Set width and height to the dimension of your image
		$j('#image').toggle("slow");
		
		return false;
	}

	//Image Load
	$j('a.product-details-thumbs').click(function() {
		$j('.product-copy').show();
		$j('#zoom').hide();
		var ImageUrl = $j(this).attr('href');
		var NewImage = new Image();
		$j('#image, #zoom-btn').hide();
	   	NewImage.onload = function() {
	   		$j('#image').attr('src', NewImage.src);
		   	new Effect.Appear('image', { duration: 0.5, queue: 'end'});	
		   	new Effect.Appear('zoom-btn', { duration: 0.5, queue: 'end'});	
	   	}
		NewImage.src = ImageUrl;
		return false;
	});
	
// Homepage Email Signup Form Default Text
	$j(".defaultText").focus(function(srcc)
	   {
	       if ($j(this).val() == $j(this)[0].title)
	       {
	           $j(this).removeClass("defaultTextActive");
	           $j(this).val("");
	       }
	   });
	   $j(".defaultText").blur(function()
	   {
	       if ($j(this).val() == "")
	       {
	           $j(this).addClass("defaultTextActive");
	           $j(this).val($j(this)[0].title);
	       }
	});
	$j(".defaultText").blur();
	
	// Collections Thumbnail Grid Hover State
	$j('li.product, .hoverable').hover(
	  function () {
	    $j(this).addClass('hover');
	  }, 
	  function () {
	    $j(this).removeClass('hover');
	  }
	);
	
	// Grid Clickable Full Item
	$j('.clickable').click(function(){
		window.location = $j(this).find('a').attr('href');
	});
	
	$j('.hasMore').hoverIntent( revealMenu,hideMenu );
	function revealMenu() { $j('.dropdown').slideDown('fast');}
	function hideMenu() { $j('.dropdown').slideUp('fast');}
	
	$j('a[rel="external"]').click( function() {
	        window.open( $j(this).attr('href') );
	        return false;
	    });
	
	
});

