﻿$(document).ready(function() {
    $('#simpleslideshow').galleryView({
        panel_width: 445,
        panel_height: 291,
        transition_speed: 1500,
        transition_interval: 4000,
        nav_theme: 'dark',
        border: 'none',
        pause_on_hover: true,
        overlay_font_size: '1.2em',
        overlay_opacity: 0.6,
        overlay_color: 'white',
        background_color: '#4b2e88',
        overlay_text_color: '#4b2e88',
        overlay_height: 60
    });

    $("#ukimgmap area").hover(
        function() {
            var location = $(this).attr("id");
            over("/images/" + location + ".gif");
        },
            function() {
                $("#ukmap").attr("src", "/images/Map_Transparent.gif");
            });

    //Preload images for slideshow and Map
    jQuery.preLoadImages("/images/bg-serviced.jpg",
                         "/images/homeslide1.jpg",
                         "/images/homeslide2.jpg",
                         "/images/homeslide3.jpg",
                         "/images/homeslide4.jpg",
                         "/images/homeslide5.jpg",
                         "/images/homeslide6.jpg",
                         "/images/homeslide7.jpg",
                         "/images/homeslide8.jpg",
                         "/images/Map_Uk.gif",
                         "/images/Map_London.gif",
                         "/images/Map_Midlands.gif",
                         "/images/Map_North.gif",
                         "/images/Map_NorthEast.gif",
                         "/images/Map_NorthWest.gif",
                         "/images/Map_Scotland.gif",
                         "/images/Map_South.gif");
});
    
// functions for over and off
function over(image) {
//    $("#ukmap").fadeOut(100, function() {
//        // Animation complete.
//        $("#ukmap").attr("src", image);
//        $("#ukmap").fadeIn(100);
//    });

//*** Was using the above animated fadeouts but IE doesn't like it!! ***
           
        $("#ukmap").attr("src", image);
    }

(function($) {
    var cache = [];
    // Arguments are image paths relative to the current page.
    $.preLoadImages = function() {
        var args_len = arguments.length;
        for (var i = args_len; i--; ) {
            var cacheImage = document.createElement('img');
            cacheImage.src = arguments[i];
            cache.push(cacheImage);
        }
    }
})(jQuery)
