// JavaScript Document

jQuery.noConflict();

jQuery('#js-warning').css('display', 'none');

jQuery(document).ready(function() {
	
	jQuery("ul#nav_493724").superfish({
		pathClass:  'current',
		autoArrows: false,
		pathLevels: 1,
		delay: 0,
		animation: {height: 'show'},
		speed: 0
	});
	
	jQuery('ul#nav_493724 li').removeAttr('style');
	
	jQuery('#home-feature').cycle({ 
		fx: 'fade', 
		timeout: 5200,
		speed: 1000,
		next: '#feature-control-right',
		prev: '#feature-control-left'
	});
	
	jQuery('ul#nav_493724 li').each(function() {
		if (jQuery(this).children('ul')) {
			var dropdownWidth = 160
			var navItem = jQuery(this).width();
			var dropdownLeft = dropdownWidth-navItem
			var dropdown = jQuery(this).find('ul');
			jQuery(dropdown).css('left', dropdownLeft/-2);
			jQuery(this).children('ul').prepend('<li class="start"></li>');
			jQuery(this).children('ul').append('<li class="end"></li>');
		}
	});
	
	jQuery('.catalogue-item div.text a').append('&nbsp;<img alt="" src="../images/category_arrow.png" />');
	
//	jQuery('.content #product-search-container').mouseover(function() {
//		jQuery(this).css('background','0 -37px no-repeat url(../images/content_finder_bg.png)');
//		jQuery(this).stop().animate({
//			height: '205px'
// 		},300 );
//	});
	
//	jQuery('.content #product-search-container').mouseout(function() {
//		if ( jQuery(this).height() == '205px' ) {
//			jQuery(this).animate({
//				height: '30px'
//			},300, function() {
//				jQuery(this).delay(1000).css('background','top left no-repeat url(../images/content_finder_bg.png)');
//			});
//		} else {		
//			jQuery(this).stop().animate({
//				height: '30px'
//			},300, function() {
//				jQuery(this).css('background','top left no-repeat url(../images/content_finder_bg.png)');
//			});
//		};
//	});
	
	jQuery('.content #product-search-title').toggle(function() {
		jQuery('.content #product-search-container').css('background','0 -37px no-repeat url(/images/content_finder_bg.png)');
		jQuery('.content #product-search-container').stop().animate({ height: '205px'},150 );
	}, function() {
		jQuery('.content #product-search-container').animate({ height: '37px' },150, function() {
			jQuery('.content #product-search-container').stop().css('background','top left no-repeat url(/images/content_finder_bg.png)');
		});
	});
	
	jQuery('#CAT_ProductCatalogue').find('option:nth-child(2)').remove();
	jQuery('#CAT_ProductCatalogue').find('option:contains("------")').remove();
	jQuery("#CAT_ProductCatalogue option:contains('Suppliers') ~ option").remove();
	jQuery('#CAT_ProductCatalogue').find('option:contains("Suppliers")').remove();
	

//	if (jQuery.url.attr("path") == "/products") {
//		jQuery('#content').html('');
//		jQuery('#main-nav-products ul').clone().attr('id', 'product-list').appendTo('#content');
//		jQuery('#product-list li').each( function() {
//			jQuery(this).addClass('catalogue-item');
//		});
//		jQuery('#product-list li:first-child').remove();
//		jQuery('#product-list li:last-child').remove();
//		jQuery('#product-list').css('display', 'block');
//		jQuery('#product-list').css('visibility', 'visible');
//		jQuery('#product-list').css('left', '0');
//	} else {  
//	
//	};

	jQuery("#font-sizer").toggle(
	  function () {
		jQuery(this).css('background-position', 'bottom');
		jQuery("#content").css("font-size","115%");
	  },
	  function () {
		jQuery(this).css('background-position', 'top');
		jQuery("#content").css("font-size","100%");
	  }
	);

});

