// jQuery Compatibility mode
jQuery.noConflict();

// Leave no trace
(function($) {
    // On DOM load
    $(function() {
        //////// DEV FUNCTIONALITY
        // TODO: Remove for production

        // So dummy links don't affect the URL
//        $('a[href="#"]').click(function() { return false; });

//        ///////// Persist logged in/logged out state
//        
//        // Read in cookies
//        var allCookies = document.cookie, cookies = {}, tmp;
//        if(allCookies) {
//            var pairs = allCookies.split(';');
//            for(var i = 0, il = pairs.length; i < il; i++) {
//                tmp = pairs[i].split('=');
//                cookies[tmp[0]] = tmp[1];
//            }
//        }
//        
//        // Apply appropriate CSS class to page
//        $('#container').removeClass('logged_in logged_out').addClass(cookies['logged_in'] && cookies['logged_in'] === '1' ? 'logged_in' : 'logged_out');
//        
//        // Sign In/Sign Out clicking funx
//        $('a.logout').click(function() {
//            document.cookie = "logged_in=0;max-age=0;path=/";
//            location.href = location.pathname;
//        });

//        $('#btn_signin').click(function() {
//            document.cookie = "logged_in=1;max-age=" + (60*60*24*365) + ";path=/";
//        });
        
        // END DEV FUNCTIONALITY

        // Init functionality
        CZ.initWatermarks();
        CZ.initCarousel();
        CZ.initHomeFeatures();
        CZ.initButtonRollovers();
        CZ.initDropdownFX();
        CZ.initQuickLookPopups();
        CZ.initFormValidation();
        CZ.initClearTextFieldDefaults();
        CZ.initSendToFriend();
        CZ.initRedeemedButtons();
        CZ.initCategoriesRetailersControls();        
        CZ.initOffsiteLinks();
        CZ.initScrollingMap();
        CZ.initPrintControls();
        CZ.initCloseControls();
        CZ.initTabs();
        CZ.initTableAccordion();
        CZ.preloadImages([
            'images/btn_sml_grey_sml.png',
            'images/btn_sml_grey_med.png',
            'images/btn_bg_ltgrey_med.png',
            'images/btn_bg_grey_lrg.png'
        ]);
        CZ.initBrowserCompat();

    }); // END On DOM load
    
    // This one needs to be run after the whole page has loaded, not just on DOM load
    $(window).load(function() {
        CZ.initRealPeopleModule();
    });

})(jQuery);
