﻿jQuery(document).ready(function() {
    var $j = jQuery.noConflict();

    // Init Function
    function initjQuery() {
        //  ==========================================
        //  Setup header input text box to clear on focus
        $j('.hdr-input').each(function() {
            $j(this).CreateAutoSelect();
        });

        //  ==================
        //  Horizontal Sliders
        if ($j('.spotlight').length > 0) {
            $j('.spotlight').each(function() {
                $j(this).CreateSlider({ disableOnLast: false });
            });
        }

        if ($j('.productSlider').length > 0) {
            $j('.productSlider').each(function() {
                $j(this).css({ overflow: 'visible' });
                $j(this).prev().css({ left: '45px' });

                $j(this).CreateSlider({ animationTime: 500, btnHeight: 'full', disableOnLast: false });
            });
        }

        //  ===========
        //  Create Tabs
        if ($j('.tabs-holder').length > 0) {
            $j('.tabs-holder').each(function() {
                var id = $j(this).attr('id');
                $j(this).CreateTabs({ tabsID: id });
            });
        }

        // =======================
        // Initialize datepickers
        if ($j('.hasdatepicker').length > 0) {
            $j('.hasdatepicker').datepicker({ dateFormat: 'mm/dd/yy', changeYear: true });
        }
        
        //  ======================
        //  Product - List to Grid
        if ($j('.toggleViews').length > 0) {
            $j('.toggleViews').each(function() {
                $j(this).CreateGrid2List();
            });
        }

        //  ======================
        //  Footer Collapsing Menu
        if ($j('.ftr-collapse').length > 0) {
            $j('.ftr-collapse').each(function() {
                $j(this).CreateToggle({ toggleType: 'group', groupToggleParent: '.ftr-collapse', groupToggleTag: 'h4' });
            });
        }
    };

    initjQuery();
});
