jQuery(document).ready(function(){
    jQuery('#ContentId').cycle({
        effect: 'fade',
        pager:  '#nav',
        pagerAnchorBuilder: function(idx, slide) {
            // return selector string for existing anchor
            return '#nav li:eq(' + idx + ') a';
        },
        pagerEvent: 'mouseover',
        fastOnEvent: 200,
        pauseOnPagerHover: true,
        slideExpr: '.slide'
    });

    $('#nav a').click(function(){
        window.location = $(this).attr('href');
    });

    jQuery('#fade').cycle({
        random: true,
        containerResize: false
    });

    // nav bar images preloader

    var images = ['./images/nav_capabilities_on.gif',
                   './images/nav_capabilities_off.gif',
                   './images/nav_catering_on.gif',
                   './images/nav_catering_off.gif',
                   './images/nav_choose_asb_on.gif',
                   './images/nav_choose_asb_off.gif',
                   './images/nav_contact_on.gif',
                   './images/nav_contact_off.gif',
                   './images/nav_events_on.gif',
                   './images/nav_events_off.gif',
                   './images/nav_gallery_on.gif',
                   './images/nav_gallery_off.gif',
                   './images/nav_home_on.gif',
                   './images/nav_home_off.gif',
                   './images/nav_location_on.gif',
                   './images/nav_location_off.gif',
                   './images/nav_services_on.gif',
                   './images/nav_services_off.gif',
                   './images/nav_where_on.gif',
                   './images/nav_where_off.gif',
                   './images/nav_whyasb_on.gif',
                   './images/nav_whyasb_off.gif',
                   './images/nav_whats_on_on.gif',
                   './images/nav_whats_on_off.gif',
                   './images/nav_blog_on.gif',
                   './images/nav_blog_off.gif'

                 ];

    jQuery(images).each(function(key, value) {

    var img = new Image();

    jQuery(img)

    .attr('src', value)

    });

});
