/**
 * Multi Level Submenu
 */
$(function() {
	var $navMain = $('#nav-main');
	if ( !$navMain.size() ) return false;
	
	$navMain.supersubs({
		minWidth: 12,
		maxWidth: 28,
		extraWidth: 1
	}).superfish({
		speed: 55,
		delay: 500
	});
	
});

/**
 * input prompts
 */
$(function() {
	$('#header li.sign-up input.input').inputInit({
		content: 'Your email address'
	});
});

/**
 * the home page slider
 */
$(function() {
	var $slider = $('#slider-content');
	if ( $slider && $slider.find(' > p ').size() > 1 ) {
		$slider.cycle({
			fx:				'scrollLeft',
			pager:		'#slider-nav',
			timeout:	5000,
			speed:		333,
			delay:		5000
		});
		// set to center
		var $$ = $('#slider-nav').parent();
		$$.css({left:'50%', marginLeft:'-' + parseInt($$.outerWidth() / 2) + 'px', visibility:'visible'});
	}
})﻿;

/**
 * roll over to enlarge
 */
$(function() {
	var $root = $('#lightbox-image');
	if ( !$root.size() ) return false;
	
	$root.find('div.tabs p').hover(function() {
		$(this).tabs();
	});
});

/**
 * min height for content
 */
$(function() {
	var $content = $('#content');
	if ( !$content.size() ) return false;
	
	var minHeight = parseInt($content.css('min-height'));
	if ( minHeight !== undefined && minHeight && !isNaN(minHeight) ) {
		var isIE6 = $.browser.msie && $.browser.version == '6.0';
		if ( isIE6 === true && $content.outerHeight() < minHeight ) {
			$content.height(minHeight);
		}
	}
});

/**
 * tabs for product content
 */
$(function() {
	var $root = $('div.product-with-tabs');
	if ( !$root.size() ) return false;
	
	var $selected = $root.find('div.tabs h2.selected');
	$root.find('div.tabs h2').click(function() {
		if ( $selected && $selected.size() ) {
			$selected.removeClass('selected');
		}
		$(this).tabs();
		$selected = $(this).addClass('selected');
	});
});

/**
 * new window
 */
$(function() {
	var MORELINK = 'http://www.aquasanaaffiliates.com/t.asp?id=5218';
	$('div.the-product div.summary a').attr('target', '_blank');
	$('a[rel=new_window]').attr('target', '_blank');
	$('a[href=#]').attr('href', MORELINK).attr('target', '_blank');
});
