﻿var indexCounter = 0;
var maxCounter = 9;
var SlideShowStarted = 0;

var arrayofSlides = [['Images/SupplierLogos/Blanco.jpg', "http://www.blanco.co.uk/"], ['Images/SupplierLogos/bosch.jpg', "http://www.bosch.co.uk"],
	     ['Images/SupplierLogos/Burbridge.jpg', "http://www.burbidge.co.uk/"], ['Images/SupplierLogos/elica.jpg', "http://www.elica.co.uk/"], ['Images/SupplierLogos/Franke.JPG', "http://www.franke.co.uk/"],
	     ['Images/SupplierLogos/Neff.jpg', "http://www.neff.co.uk/"], ['Images/SupplierLogos/Perrin & Rowe.jpg', "http://www.triflowconcepts.com/perrin-and-rowe/category/list/26/Kitchen "], ['Images/SupplierLogos/Rangemaster.jpg', "http://www.rangemaster.co.uk/"],
	     ['Images/SupplierLogos/Second Nature.jpg', "http://www.sncollection.co.uk/"], ['Images/SupplierLogos/Stori.jpg', "http://www.kitchenstori.com/"]];


    function SlideShow() {
        var backgroundImage = document.getElementById("imgSlide");
        var SupplierLink = document.getElementById('supplierlink');
        if (SlideShowStarted == 0) {
            backgroundImage.src = arrayofSlides[0][0];
            SupplierLink.href = arrayofSlides[0][1];
            $(document).ready(function() {
                    $("#Slides").fadeIn(2000, function() {
                        SlideShowStarted = 1;
                        setTimeout("SlideShow()", 9000);
                    });
            });
        }
        else {
            $(document).ready(function() {
                $("#Slides").fadeOut(2000, function() {
                    indexCounter += 1;
                    if (indexCounter == maxCounter) {
                        indexCounter = 0;
                    }
                    backgroundImage.src = arrayofSlides[indexCounter][0];
                    SupplierLink.href = arrayofSlides[indexCounter][1];
                }
	            );
                $("#Slides").fadeIn(3500, function() { setTimeout("SlideShow()", 9000); });
            });
        }
    }
    $(document).ready(function() {
        SlideShow();
    });
    

