jQuery(document).ready(function() {
	
	//search bar watermark
	jQuery(function($){
		$("#search-txt").Watermark("Search...");
	});
	
	//cart pop-out
	var $div = $('#popOutDiv');
	var height = $div.height();
	$div.hide().css({ height : 0 });
	
	$('.popOutBtn').click(function () {																	
		if ($div.is(':visible')) {
			overlayOff();
			$div.animate({ height: 0 }, { duration: 700, complete: function () {
				$div.hide();							
			}});
		} else {
			overlayOn();
			$div.show().animate({ height : height }, { duration: 700 });
		}				
		return false;
	});
	
	//add-remove page overlay
	function overlayOn() {
		$('.sign-in').css({'z-index':'1'});
		$('#overlayDiv').css({'filter':'alpha(opacity=0)','width':'100%','height':'100%'});
		$('#overlayDiv').animate({'opacity': .8},800);
	}
	
	function overlayOff() {					
		$('#overlayDiv').animate({'opacity': 0}, { duration: 800, complete: function () {
			$('#overlayDiv').css({'filter':'alpha(opacity=0)','width':'0','height':'0'});
			$('.sign-in').css({'z-index':'500'});
		}});
	}	
	
	//fly-out menus
	$('#flyout-nav .menu-first').css({'margin-top':'0px'});
	$('.flyout-menu').click(function () {
    	$('.down-list', this).fadeIn(200);//.slideDown(0);
    });	
    $('.flyout-menu').mouseleave(function () {
      $('.down-list', this).fadeOut(200);
    });
	
    //product captions
    $('img.captify').captify({
		// all of these options are... optional
		// ---
		// speed of the mouseover effect
		speedOver: 'fast',
		// speed of the mouseout effect
		speedOut: 'normal',
		// how long to delay the hiding of the caption after mouseout (ms)
		hideDelay: 400,	
		// 'fade', 'slide', 'always-on'
		animation: 'slide',		
		// text/html to be placed at the beginning of every caption
		prefix: '',		
		// opacity of the caption on mouse over
		opacity: '0.7',					
		// the name of the CSS class to apply to the caption box
		className: 'caption-bottom',	
		// position of the caption (top or bottom)
		position: 'bottom',
		// caption span % of the image
		spanWidth: '100%'
	});
    
});

