$(document).ready(function(){	

    var winHeight, winWidth;
    
    function resize() {
      winHeight = Math.min(window.innerHeight);
      winHeight = 490;
      winWidth = Math.min(window.innerWidth);
      $(".app").each(function() {
          $(this).css("width", winWidth).css("height", winHeight);
        });
    };

    $('#topapps').cycle({
		fx: 'scrollHorz', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
        delay: 0, 
        prev:'.arrow_left',
        next:'.arrow_right',
        speed: 1000,
        timeout: 14000,
        slideResize:  0,
        before: function () {
          resize();
        },
        after: function () {
          resize();
        }
	});
    
    $(window).resize(function() {
        resize();
    });

    $('#iphone_slideshow').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
        delay: 0, 
        speed: 4200,
	});

    $('#slideshow').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
        delay: 0, 
        speed: 4200,
	});

    $('.slideshow').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
        delay: 0, 
        speed: 4200,
	});
  
    $('.app_category_nav a').click(function() {
        $('.selected-link').removeClass('selected-link');
        $('.selected-cat').removeClass('selected-cat').addClass('hidden-cat');
        $(this).addClass('selected-link');
    });
    

    $('.app_category_nav .kids a').click(function() {
        $('#kids').removeClass('hidden-cat').addClass('selected-cat');
        return false;
    });
    $('.app_category_nav .grownups a').click(function() {
        $('#grownups').removeClass('hidden-cat').addClass('selected-cat');
        return false;
    });
    $('.app_category_nav .comingsoon a').click(function() {
        $('#comingsoon').removeClass('hidden-cat').addClass('selected-cat');
        return false;
    });
    $('.app_category_nav .all a').click(function() {
        $('#all').removeClass('hidden-cat').addClass('selected-cat');
        return false;
    });
});


