 $(document).ready(function(){
	 
		
//	Default slider for the promo section. This is using the inbuilt jquery.bxSlider to output the buttons
//		
		$('#featured_promo').bxSlider({
            displaySlideQty: 3,
            moveSlideQty: 1             
        });
	
//
//	Slider with jquery.bxSlider with custom buttons. 
//				
		
		 var slider = $('#featured_product').bxSlider({
            displaySlideQty: 5,
            moveSlideQty: 1,    
        	controls: false
			
        	
        });

//
//	Add click slide function to custom buttons styled in css
//	
		
		 $('#product_prev').click(function() {
            slider.goToPreviousSlide();
            return false;
        });
        
        $('#product_next').click(function() {
            slider.goToNextSlide();
            return false;
        });
		
		//	on class "prod" hover
		$(".prod").hover((function(){
			//	get the id attribute from the item that is being hovered
			var product = '.' + $(this).attr('id');
			//	create the hover image id from the id attribute e.g. #1_hover
			var prod_no = '#' + 'hover_' + $(this).attr('id');
			//	get the offset co-ord for the "prod"
			var co_ord = $(this).offset();
			//	get the position co-ord for the "prod"
			var co_ord2 = $(this).position();
			//	get window width
			var sw = $(window).width();
			//	position of hover image equals window width divided by 2 tak the offset value.
			var position = ((sw/2)-co_ord.left);
			//	From this equations we find that the following positions have the same values for any browser width. 1.	474	  2. 285 3. 96	 4. -93	 5. -282.
			//	From these values we know that IF the value is less than 0 THEN the hover is in position 4 or 5 and we want it to display the left of the "prod" ELSE itds position 1 2 or 3 and we want it to display on the right
			$(product).css({
					'background-color' : '#e4e1d2'
				});

			if(position<0){
				$(prod_no).css({
					'position' : 'absolute',
					'left' : (co_ord2.left - 125),
					'top' : 0
				});
				$(prod_no).fadeIn('slow', function() {
						// Animation complete
					  });
				
			}else{
				
				$(prod_no).css({
					
					'position' : 'absolute',
					'left' : (co_ord2.left + 182),
					'top' : 0
				});
				$(prod_no).fadeIn('slow', function() {
						// Animation complete
					  });
			}
		}), (function() {
				var prod_no = '#' + 'hover_' + $(this).attr('id');
				var product = '.' + $(this).attr('id');
				$(prod_no).stop(true, true);
				$(product).css({
					'background' : 'none'
				});
				$(prod_no).css({
					'display' : 'none'
				});
			
			}));	

		
	 		
		$('#news_text_holder').newsTicker({
			showTime: 7000,
			effectTime: 1000
		});
	 

});




	 
          
	

