var adImages = new Array();
var adURLs = new Array();
adImages[0] = "../pix/banner_ads/esher_banner_tickets_new.gif";
adURLs[0] = "https://kiosk.iristickets.co.uk/k?v=esherrfc";
adImages[1] = "../pix/banner_ads/Banner-rugby_gif.gif";
adURLs[1] = "www.opus2international.com/";
adImages[2] = "../pix/banner_ads/royalton_banner.gif";
adURLs[2] = "www.princesssquare.com/";


thisAd = 0;

// The following function cycles through each banner image.
// Notice the use of the variable thisAd to go from 0 to 2 and then
// back to 0. JavaScript has an object called document whose
// member adBanner can be set to the current banner to display.

function cycleAds()
{
    if (document.images)
    {
        if (document.adBanner.complete)
        {
            if (++thisAd == adImages.length)
                thisAd = 0;

            document.adBanner.src = adImages[thisAd];
        }
    }

    // change to next banner every 15 seconds
    setTimeout("cycleAds()", 9000);
}

// This function is used to direct the user to the website when
// the user clicks on a particular banner image.

function gotoAd()
{
    window.open("http://" + adURLs[thisAd]);
	// document.location.href = "http://" + adURLs[thisAd];
	// document.location.href = adURLs[thisAd];
}

