// JavaScript Document
<!-- Begin
var theImages = new Array()
var theLinks = new Array()
// To add more image files, continue with the
// pattern below, adding to the array.
// change var nDisplay to the number of adverts to show concurrently

theImages[0] = 'adImages/lingflor.jpg'
theImages[1] = 'adImages/alexjones.jpg'
theImages[2] = 'adImages/alexnash.jpg'
theImages[3] = 'adImages/alplumbing.jpg'
theImages[4] = 'adImages/carbonsky.jpg'
theImages[5] = 'adImages/hearnden.jpg'
theImages[6] = 'adImages/nuexseal.jpg'
theImages[7] = 'adImages/wildlifecentre.jpg'
theImages[8] = 'adImages/printroom.jpg'

theLinks[0] = 'http://www.lingfield-florist.co.uk/'
theLinks[1] = 'http://www.alexjonesfuneraldirectors.co.uk/'
theLinks[2] = 'http://www.alexnash.co.uk/'
theLinks[3] = '#'
theLinks[4] = 'http://www.carbonskyline.co.uk/'
theLinks[5] = 'http://www.hearndenassociates.co.uk/'
theLinks[6] = 'http://www.nuex.co.uk/'
theLinks[7] = 'http://www.britishwildlifecentre.co.uk/'
theLinks[8] = '#'

var noLinkA = 3;
var noLinkB = 8;

var p = theImages.length;
var nDisplay = 3; //the number of images to be displayed
var preBuffer = new Array()
var preBcount = 0;
var accept = "";
var whichImage = 0;

function slideit(){
while (preBcount < nDisplay)
{
whichImage = Math.round(Math.random()*(p-1));

  for (i = 0; i <= preBuffer.length; i++)
  {
    if (preBuffer[i]==whichImage)
    {
      accept = "no";
      break;      
    }
    else
    {
      accept = "yes";
    }
  }

  if (accept == "yes")
    {
      preBuffer[preBcount]=whichImage;
      preBcount++;
    }
}

document.images.slide1.src=eval("theImages[preBuffer[0]]"); 
document.images.slide2.src=eval("theImages[preBuffer[1]]");
document.images.slide3.src=eval("theImages[preBuffer[2]]"); 

preBcount = 0;

//call function "slideit()" every 10 seconds
setTimeout("slideit()",10000)
}

function slidelink1(){
//block opening new page if there is no url for advertiser
if (preBuffer[0] !== noLinkA && preBuffer[0] !== noLinkB){
window.open(theLinks[preBuffer[0]]);
}}
function slidelink2(){
//block opening new page if there is no url for advertiser
if (preBuffer[1] !== noLinkA && preBuffer[1] !== noLinkB){
window.open(theLinks[preBuffer[1]]);
}}
function slidelink3(){
//block opening new page if there is no url for advertiser
if (preBuffer[2] !== noLinkA && preBuffer[2] !== noLinkB){
window.open(theLinks[preBuffer[2]]);
}}

//  End -->

