		$(document).ready( function() {
		
		$('.btn').mouseup( function(){
			$(this).blur();
		});
		
		//On Click of a tab
		$("ul.tabs li").click(function() {
			$("ul.tabs li").removeClass("active"); //Remove any "active" class
			$(this).addClass("active"); //Add "active" class to selected tab

			var tabContainerHeight = $('.tab-content:visible').height(); // Get currently visible .tab-content height
		
			$(".tab-content").stop(true,true).fadeOut('fast'); // Fade out all tab content
	
			$('.tab-container').css({'height' : tabContainerHeight}); // Apply height to the container
	
			var activeTab = $(this).find('a').attr("href"); // Find the href attribute value to identify the active tab + content			
			$(activeTab).stop(true, true).fadeTo("fast", 0); // Fade in the active ID content but don't show it
			var newTabContainerHeight = $(activeTab).height(); // Get currently visible .tab-content height
			$('.tab-container').stop(true,true).animate({'height' : newTabContainerHeight},"fast", function(){
				$(activeTab).fadeTo("fast",1); // Fade in the content
			}); // Animate the container to the new height
			
			return false;
		});
		
		// HoverIntent functions
		function fadeMenuIn() { // This function is called by hover intent 'over:'
				$(this).addClass("active");
				$(this).find('.subnav').fadeIn('fast'); // Fade in the menu
		}
		
		function fadeMenuOut() { // This function is called by hover intent 'out:'
			$(this).removeClass("active");
			$(this).find('.subnav').fadeOut('fast'); // Fade out the menu
		}
		
		// Main Hover Intent function
		$('#menu li.has-subnav').hoverIntent({
			sensitivity: 7, // number = sensitivity threshold (must be 1 or higher)
			interval: 100,   // number = milliseconds of polling interval
			over: fadeMenuIn,  // function = onMouseOver callback (required)
			timeout: 300,   // number = milliseconds delay before onMouseOut function call
			out: fadeMenuOut    // function = onMouseOut callback (required)
		})
		
		
		// Clear search box on focusin
		$('.remove-text').focusin(
			function() {
				if (this.value == this.defaultValue) {
					this.value = '';
				}
			}
		);
		
		// Restore search box on focusout
		$('.remove-text').focusout(
			function() {
				if (this.value == '') {
					this.value = this.defaultValue;
				}
			}
		);		
		
		// Get title attribute and display it
		var original = $('#colours h3').text();
		
		$('#colours a').removeAttr('title');
		
		$('#colours a').hover( function() {
			var title = $(this).attr('rel');
			$('#colours h3').text('Available Colours: ' + title);
		}, function(){
			$('#colours h3').text(original);
		});
		
		// Hover effects on images
		$('#tab3 a').hover( function(){
			$(this).stop(true,false).animate({opacity:0.8});
		}, function(){
			$(this).stop(true,false).animate({opacity:1});
		});
		
		
		// Scroll to top
		$('a[href=#top]').click(function(){
        $('html, body').animate({scrollTop:0}, 'slow');
        return false;
    });
		
		// Add arrow to li on hover of links
		$('.product-list li a').hover ( function(){
			$(this).css({ 'text-decoration' : 'none' })
			if ($.browser.msie && $.browser.version.substr(0,1)<8) {
				$(this).closest('li').css({ 'background' : 'url(../../images/va/arrow.gif) center 300px no-repeat'});
			} else {
				$(this).closest('li').css({ 'background' : 'url(../../images/va/arrow.png) center 296px no-repeat'});
			}
			
		}, function(){
					$(this).closest('li').css({ 'background' : 'none'});
			});
		
		// Add arrow to li on focusin of links
		$('.product-list li a').focusin( function(){
			if ($.browser.msie && $.browser.version.substr(0,1)<8) {
				$(this).closest('li').css({ 'background' : 'url(../../images/va/arrow.gif) center 300px no-repeat'});
			} else {
				$(this).closest('li').css({ 'background' : 'url(../../images/va/arrow.png) center 296px no-repeat'});
			}
		});
		
		// Add arrow to li on focusout of links
		$('.product-list li a').focusout( function(){
			$(this).closest('li').css({ 'background' : 'none'});
		});
		
	});
