jQuery(document).ready(function() {
		    
		    jQuery('.tooltip').tipsy({gravity: jQuery.fn.tipsy.autoNS});
		    
		    jQuery('#slides').cycle({
				fx: 'scrollBothWays',
				speed: 300,
				timeout:  0,
				prev: '#prev',
				next: '#next',
				pager: '#pager'
			});
			jQuery('.swipe').swipe({
				 threshold: { x: 100, y: 100 },
				 swipeLeft: function() { jQuery("#next").click() },
				 swipeRight: function() { jQuery("#prev").click() },
			})
			
			jQuery('.featured').dblclick(function() {
			  jQuery('.featured').hide('slow', function() {
			  });
			});
			
		});
		
		
		jQuery.fn.cycle.transitions.scrollBothWays = function(jQuerycont, jQueryslides, opts) {	
			jQuerycont.css('overflow','hidden');
			opts.before.push(jQuery.fn.cycle.commonReset);

			// custom transition fn (trying to get it to scroll forward and backward)
		
			opts.fxFn = function(curr, next, opts, cb, fwd) {
			
				var w = jQuerycont.width();	
				opts.cssFirst = { left: 0 };
				opts.animIn	  = { left: 0 };
		
				if(fwd){
					opts.cssBefore= { left: w, top: 0 };
					opts.animOut  = { left: 0-w };
				}else{
					opts.cssBefore= { left: -w, top: 0 };
					opts.animOut  = { left: w };
				};
		
				var jQueryl = jQuery(curr), jQueryn = jQuery(next);
				var speedIn = opts.speedIn, speedOut = opts.speedOut, easeIn = opts.easeIn, easeOut = opts.easeOut, animOut = opts.animOut, animIn = opts.animIn;
		
				jQueryn.css(opts.cssBefore);
		
				var fn = function() {jQueryn.show();jQueryn.animate(animIn, speedIn, easeIn, cb);};
		
				jQueryl.animate(animOut, speedOut, easeOut, function() {
					if (opts.cssAfter) jQueryl.css(opts.cssAfter);
					if (!opts.sync) fn();
				});
				if (opts.sync) fn();
			};
		};
