$(document).ready(function() {
    $('a[href*=#]').click(function() {

	    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 
	        && location.hostname == this.hostname) {

	            var $target = $(this.hash);

	            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');

	            if ($target.length) {

	                var targetOffset = $target.offset().top;

	                $('html,body').animate({scrollTop: targetOffset}, 1000);

	                return false;

	            }

	        }

	    });
	
		
	
	$('#cartDetails').tabSlideOut({
        tabHandle: '.handle',                     //class of the element that will become your tab
        pathToTabImage: "/images/cart_btn.png", //path to the image for the tab //Optionally can be set using css
        imageHeight: '45px',                     //height of tab image           //Optionally can be set using css
        imageWidth: '184px',                       //width of tab image            //Optionally can be set using css
        tabLocation: 'top',                      //side of screen where tab lives, top, right, bottom, or left
        speed: 300,                               //speed of animation
        action: 'click',                          //options: 'click' or 'hover', action to trigger animation
        topPos: '0px',                          //position from the top/ use if tabLocation is left or right
        leftPos: '',                          //position from left/ use if tabLocation is bottom or top
        fixedPosition: false                      //options: true makes it stick(fixed position) on scroll
    });

	
		
	
		$("a.flyout").fancybox({
				'transitionIn'	:	'fade',
				'transitionOut'	:	'fade',
				'speedIn'		:	600, 
				'speedOut'		:	200, 
				'overlayShow'	:	false,
				'height'		:   300,
				'width'			:   400,
				'autoDimensions':   false,
				'hideOnContentClick' : false
			});
			
			
			$("a.swatches_box").fancybox({
					'transitionIn'	:	'fade',
					'transitionOut'	:	'fade',
					'speedIn'		:	600, 
					'speedOut'		:	200, 
					'overlayShow'	:	false,
					'height'		:   500,
					'width'			:   800,
					'autoDimensions':   false,
					'hideOnContentClick' : false
				});
				
				$("a.swatches_box2").fancybox({
						'transitionIn'	:	'fade',
						'transitionOut'	:	'fade',
						'speedIn'		:	600, 
						'speedOut'		:	200, 
						'overlayShow'	:	false,
						'height'		:   500,
						'width'			:   800,
						'autoDimensions':   false,
						'hideOnContentClick' : false
					});
					
					$("a.swatches_box3").fancybox({
							'transitionIn'	:	'fade',
							'transitionOut'	:	'fade',
							'speedIn'		:	600, 
							'speedOut'		:	200, 
							'overlayShow'	:	false,
							'height'		:   500,
							'width'			:   800,
							'autoDimensions':   false,
							'hideOnContentClick' : false
						});
			
			$("a[href$=.jpg],a[href$=.png],a[href$=.gif]").fancybox();
			
			$("#mailingFrm").bind("submit", function() {

				$.fancybox.showActivity();

				$.ajax({
					type		: "POST",
					cache	: false,
					url		: "refer.php",
					data		: $(this).serializeArray(),
					success: function(data) {
						$.fancybox(data,{
							'transitionIn'	:	'fade',
							'transitionOut'	:	'fade',
							'speedIn'		:	600, 
							'speedOut'		:	200, 
							'overlayShow'	:	false,
							'height'		:   300,
							'width'			:   400,
							'autoDimensions':   false,
							'hideOnContentClick' : false
						});
					}
				});

				return false;
			});
			
			
				$('.alert').click(function(){
					var answer = confirm(jQuery(this).attr('title'));
					// jQuery(this).attr('title') gets anchor title attribute
					return answer; // answer is a boolean
				});
	
			
			jQuery('#mycarousel').jcarousel({
			    	wrap: 'circular'
			    });
			
				$("#scroller").simplyScroll({
							autoMode: 'loop',
							frameRate: 26,
							speed: 1
						});
			
});