;$j = jQuery.noConflict();

$j(document).ready
(
	function()
	{
		/**
		 * Main navigation
		 */
		$navigation = $j('#nav');
		
		$j('> li:last', $navigation).addClass('last');
		
		
		/**
		 * Products images
		 */
		$j('.fancybox').fancybox
		({
			titlePosition: 'inside'
		});
		
		
		/**
		 * Gallery slideshow
		 */
		$galleryContainer = $j('.cms-home .slideshow');
		
		if ($galleryContainer.length)
		{
			$galleryContainer.easySlider
			({
				prevId: 		'slideshow-prev',
				nextId: 		'slideshow-next',	
				auto:			true,
				pause:			3000,
				continuous:		true,
				numeric:		true,
				numericId:		'controls',
				numericPrev:	true,
				numericNext:	true,
				numericClass:	'link-number'
			});
			
			$galleryContainer
				.wrap($j('<div class="slideshow-wrapper"></div>')).parent()
				.append($j('#controls'))
				.append($j('<div class="cover">&nbsp;</div>'));
		}
	
        
                /**
                 * This code will add the target
                 * 
                 * Any links that start with http:// or https:// but doesn't 
                 * start with our URL then we will add a _blank target to it
                 * 
                 */

                 $j('a[href^="http://"], a[href^="https://"]').not('a[href^="http://love-craft.co.uk"], a[href^="https://love-craft.co.uk"], a[href^="http://www.love-craft.co.uk"], a[href^="https://www.love-craft.co.uk"]').attr({
                    target: "_blank", 
                    title: "Opens in a new window"
                });
                 
                    
                /*$j('a[href^="http://"], a[href^="https://"]').attr({
                    target: "_blank", 
                    title: "Opens in a new window"
                });*/
        }
);
