$(function(){
        
        // Fancybox
        $("a.fancybox").fancybox({
            'transitionIn' : 'elastic',
            'transitionOut' : 'elastic',
            'speedIn' : 600, 
            'speedOut' : 200, 
            'overlayShow' : false,
            'padding' : 0,
            'titleShow' : false,
            'hideOnContentClick' : true
        });
        
        // Fancybox for Images
        $("a.fancyboxImg").fancybox({
            'transitionIn' : 'elastic',
            'transitionOut' : 'elastic',
            'speedIn' : 600, 
            'speedOut' : 200, 
            'overlayShow' : false,
            'padding' : 20,
            'titleShow' : false,
            'hideOnContentClick' : true
        });
        
        // Fancybox for Albums
        $("#gallery a.fancybox").fancybox({
            'transitionIn' : 'elastic',
            'transitionOut' : 'elastic',
            'speedIn' : 600, 
            'speedOut' : 200, 
            'overlayShow' : false,
            'padding' : 10,
            'titleShow' : true,
            'hideOnContentClick' : true
        });
        
        // Button Hover Effect		
        $('.bt').hover(
            function () {
                $(this).animate({opacity: ".5"},
                {queue:false,duration:100});
            }, function () {
                $(this).animate({opacity: "1"},
                {queue:false,duration:500});
        });
        
		// Dropdown Menus
        $('ul.menu').superfish({ 
            hoverClass:    'sfHover',          // the class applied to hovered list items 
            pathClass:     'sfCurrent', 	   // the class you have applied to list items that lead to the current page 
            pathLevels:    1,                  // the number of levels of submenus that remain open or are restored using pathClass 
            delay:         500,                // the delay in milliseconds that the mouse can remain outside a submenu without it closing 
            animation:     {opacity:'show'},   // an object equivalent to first parameter of jQuery's .animate() method 
            speed:         'fast',             // speed of the animation. Equivalent to second parameter of jQuery's .animate() method 
            autoArrows:    false,               // if true, arrow mark-up generated automatically = cleaner source code at expense of initialisation performance 
            dropShadows:   false,               // completely disable drop shadows by setting this to false 
            disableHI:     false,              // set to true to disable hoverIntent detection 
            onInit:        function(){},       // callback function fires once Superfish is initialised – 'this' is the containing ul 
            onBeforeShow:  function(){},       // callback function fires just before reveal animation begins – 'this' is the ul about to open 
            onShow:        function(){},       // callback function fires once reveal animation completed – 'this' is the opened ul 
            onHide:        function(){}        // callback function fires after a sub-menu has closed – 'this' is the ul that just closed 
        });

		// Rotating Banner
        $('#banner').jcarousel({
            auto: 3,
            wrap: 'circular',
            animation: 2000,
            scroll: 1,
            buttonNextHTML: "<a id='next' class='bt'>Next</a>",
            buttonPrevHTML: "<a id='prev' class='bt'>Previous</a>"
        });
        
        // Store Search Auto Complete
        var options, a;
        options = {
            serviceUrl:'includes/storeSearch.inc.php',
            minChars:2,
            width: 150,
            // callback function:
            onSelect: function(value, data){
                $("#idField").val(data);
                $("#searchForm").submit();
            }
        };
        a = $('#searchField').autocomplete(options);
        
        // Store Search Validate
        $("#searchForm").validate({
            submitHandler: function(form) {
                form.submit();
            },
            rules: {
                id: "required",
                search: "required"
            },
            messages: {
                id: "",
                search: ""
            }

        })

        

                    
});
