function setupExploreBox() {
		// Add correct z-indexes
		var zIndex = 999;
		$('#explore ul li ul').parent().each(function(index) {
			$(this).css('z-index',zIndex)
			zIndex--;
		});
		
		// Zebra List
		$('#explore div ul').each(function() {
			$(this).children('li:even').addClass('odd');
		});
		
		$(function() {
			roConfig = {
				sensitivity: 3,
				interval: 200,
				timeout: 200,
				over: function() {
					$(this).find('ul').slideDown('fast');
				},
				out: function() {
					$(this).find('ul').delay(50).slideUp('fast');
				}
			}
			$('#explore div ul li').hoverIntent(roConfig)
		})
		
		//$("#explore ul li a").click(function() {
				//parent.window.location = $(this).attr("href"); return false;
		//});
}

if (typeof(window['exploreOnly']) == "undefined") {
		$(document).ready(function() {
			// NAVIGATION
			$('#navigation ul').superfish({
				delay:       500,                            // half second delay on mouseout 
				animation:   {opacity:'show',height:'show'},  // slide-down animation 
				speed:       'fast',                          // faster animation speed 
				autoArrows:  false,                           // disable generation of arrow mark-up 
				dropShadows: false                            // disable drop shadows 
			});
			
			// EXPLORE POLYPIPE POP-UP
			$('#explore').hide();
			
			// Open
			$('.explore').click( function() {
				// If the 'Explore' box contents haven't been loaded, load them and set up event handler for 'close' button
				if ($('#explore').html() == "") {
					$('#explore').load('/common/explore/popup-contents.php', function() {
						setupExploreBox();
						
						$('#explore .close').click( function() {
							$('#explore').fadeOut();
						});
						
						$('#explore').fadeIn();
					});
				}
				// Otherwise, contents are already loaded - just show it
				else {
					$('#explore').fadeIn();
				}
			});
			// Close
			
			
			// FANCYBOX SET UP
			
			// Gallery
			$("a.fancygallery").fancybox({
				'overlayOpacity': 0.7,
				'overlayColor': '#0b2853',
				'titlePosition': 'over',
				'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Image ' +  (currentIndex + 1) + ' / ' + currentArray.length + (title.length > 0 ? ' - ' + title : '') + '</span>';
				}
			});
			
			// Simple pop-up
			$("a.fancybox").fancybox({
				'overlayOpacity': 0.7,
				'overlayColor': '#0b2853'
			});
			
			// Gallery functionality
			$('.view-images').click(function() {
				$(this).siblings('.gallery-thumbs').children('a.fancygallery').first().trigger('click');
				return false;
			});
			
			//CYCLE
			
			// Cycle (simple)
			$('.basic-slides').cycle({
				fx: 'fade'
			});
		
			// Cycle (with nav)
			$('.pager-slides').cycle({ 
				speed:       200, 
				timeout:     5000, 
				pager:      '.slidenav'
			});
			
			// Cycle (with thumb nav)
			$('.thumb-slides').cycle({
				fx: 'fade'
			})
			
			$('.slidenav-thumbs .prev').click(function() {
				$('.thumb-slides').cycle('prev');
				return false;
			});
			
			$('.slidenav-thumbs .next').click(function() {
				$('.thumb-slides').cycle('next');
				return false;
			});
			
			$('.slidenav-thumbs .thumbs .thumb').each(function(index) {
				var thumbID = '#thumb_' + (index+1);
				$(thumbID).click(function() {
						$('.thumb-slides').cycle(index);
						return false;
				});
			});
			
			
			// Accordion
			$("#accordion").accordion({
				active: false,
				autoHeight: false,
				collapsible: true
			});
			
			// Pop-up images in product tables
			if (jQuery().imgPreview) {
				$('.productlist tr').imgPreview({
					srcAttr: 'rel',
					containerID: 'productThumbPreview'
				});
			}
		});

}
