﻿var mayfest = window.mayfest || {};

$(function() {

    mayfest.home = (function() {
        
        function initStyles() {
            $('.btn').hover(function() { 
                if (!$(this).hasClass('ui-state-disabled')) { $(this).addClass('ui-state-hover'); } }, function() { $(this).removeClass('ui-state-hover'); });
            $('.ui-widget-header').removeClass('ui-corner-all').addClass('ui-corner-top').css('border', 'none');
        }
        
        function initRoundAbout() {
            $('#roundabout').rotator({ stop: $('#mayfest-promo-content') });
        
//            var interval;
//            
//            $('#roundabout').roundabout({
//                    duration: 600,
//                    easing: 'easeInOut',
//                    minOpacity: 0.2,
//                    maxScale: 1.2,
//                    minScale: 0.8
//                })
//                .roundabout_setTilt(-30)
//                .hover(function() {
//                    clearInterval(interval);
//                }, function() {
//                    interval = autoPlay();
//                });
//            
//            function autoPlay() {
//                return setInterval(function() {
//                    $('#roundabout').roundabout_animateToNextChild();
//                }, 3000);
//            }
//            
//            interval = autoPlay();
        }
        
//        function initCarousel() {
//            $('.carousel li').addClass('no-focus')
//                .hover(function() { $(this).removeClass('no-focus'); }, function() { $(this).addClass('no-focus'); });
//            
//            $('#thurs-carousel').jCarouselLite({ btnNext: '.next1', btnPrev: '.prev1', easing: 'easeOut', speed: 1000, visible: 3 });
//            $('#fri-carousel').jCarouselLite({ btnNext: '.next2', btnPrev: '.prev2', easing: 'easeOut', speed: 1000, visible: 3 });
//            $('#sat-carousel').jCarouselLite({ btnNext: '.next3', btnPrev: '.prev3', easing: 'easeOut', speed: 1000, visible: 3 });
//            $('#sun-carousel').jCarouselLite({ btnNext: '.next4', btnPrev: '.prev4', easing: 'easeOut', speed: 1000, visible: 3 });
//        }
//        
//        function initTabs() {
//            $('.tab-content').addClass('ui-corner-bottom');
//            $('.tab-content:gt(0)').hide();
//            $('.tabs-nav li:first').addClass('tab-selected');
//            $('.tabs-nav li:last').css({ 'margin-right': '0', 'width': '151px' });
//            $('.tabs-nav li').hover(function() { $(this).addClass('tab-hover'); }, function() { $(this).removeClass('tab-hover'); })
//                .click(function() { switchTab(this); });
//            $('.tabs-nav li a').click(function() { switchTab(this); return false; });
//        
//            function switchTab(el) { 
//                var $el = $(el);
//                $('.tabs-nav li').removeClass('tab-selected');
//                $('.tab-content').hide();
//                if (el.href) { 
//                    $(el).parent().addClass('tab-selected');
//                    $('#' + $el.attr('href')).show();
//                }
//                else {
//                    $el.addClass('tab-selected');
//                    var id = $el.children(0).attr('href');
//                    $('#' + id).show();
//                }
//                return false;
//            }
//            
//            // hack for IE
//            $('.next').removeClass('ui-state-disabled');
            
//        }
        
        function initCountDown() {
        
            var today = new Date();

            var mfDay = new Date("April 29, 2010")
                msPerDay = 24 * 60 * 60 * 1000;
            var timeLeft = (mfDay.getTime() - today.getTime());
            var eDaysLeft = timeLeft / msPerDay;
            var daysLeft = Math.floor(eDaysLeft);
            $('#countdown').text(daysLeft + ' Days');
            $('#countdown-2').text(daysLeft + ' Days');
        }
        
        initStyles();
        //initCarousel();
        initRoundAbout();
        //initTabs();
        //initCountDown();
        
    })();
    
});