$(document).ready(function() {
	
	
	$('.slide-inner-wrapper').click(function() {
		var href = $(this).attr("data-url");
  		document.location.href = href;
  		return false;
	});
	
	$("ul#featured").cycle({
		fx: 'scrollLeft', //not fade
		pause: 1,
		timeout:  10000, 
		prev: '#prev',
		next: '#next',
		pager: '#nav',
   		before:  onBefore,
   		after: onAfter,
		pagerAnchorBuilder: function(index, el) {
        	return '<a href="#"></a>'; // whatever markup you want
    	},
		slideExpr: 'li'
	});
	
	$("#slider ul").cycle({
		fx: 'fade',
		pause: 1,
		timeout:  6000, 
		pager: '#slider_nav',
		pagerAnchorBuilder: function(index, el) {
        	return '<a href="#"></a>'; // whatever markup you want
    	},
		slideExpr: 'li'
	});

	

	$("#slideshow").hover(function() {
    	$(".navigation a span").fadeIn();
  	},
  		function() {
    	$(".navigation a span").fadeOut();
  	});
  	$('ul#featured').swipe({
 		swipeLeft: function() { $('ul#featured').cycle("next"); },
  		swipeRight: function() { $('ul#featured').cycle("prev") },
  		threshold: {
   			x: 15,
   			y: 99999
  		},
  		preventDefaultEvents: false
	});
	$('#slider ul').swipe({
 		swipeLeft: function() { $('#slider ul').cycle("next"); },
  		swipeRight: function() { $('#slider ul').cycle("prev") },
  		threshold: {
   			x: 15,
   			y: 99999
  		},
  		preventDefaultEvents: false
	});
	function onAfter() {
    	$('span.caption').fadeIn('slow');
	}
	function onBefore() {
    	$('span.caption').fadeOut('1000');
	}
	
	$("#app p img").hover(
		function()
		{
			$(this).animate(
			{
				'top':'-235px',
				'left':'155px'
			}, 100);
		},
		function()
		{
			$(this).animate(
			{
				'top':'-225px',
				'left':'150px'
			}, 100);	
		}
	);

});
