if (document.images)
{
    //Array of images to rotate through	
    adImages = new Array(
						 "../../images/banners/center/banner_center_aeropress.jpg",
                         "../../images/banners/center/banner_center_mytv.jpg",  
						 "../../images/banners/center/banner_center_denioven.jpg",
                         "../../images/banners/center/banner_center_cow.gif",
						 "../../images/banners/center/banner_center_riddex.jpg",                                                   
                         "../../images/banners/center/banner_center_pocket_laser.gif",
                         "../../images/banners/center/banner_center_canon.jpg"
                         );

    //Array of urls which correspond to the above images
    adURLs = new Array(
					   "index.php?main_page=product_info&products_id=1966",
                       "index.php?main_page=index&cPath=42_168",
					   "index.php?main_page=product_info&products_id=1968",
                       "index.php?main_page=product_info&products_id=1943",
                       "index.php?main_page=product_info&products_id=1162",
                       "index.php?main_page=product_info&products_id=1973",
                       "index.php?main_page=product_info&products_id=1911"
                        );
    var thisAd = 0;
}

//Determine which image to show
function selectImg(direction) {
//alert(direction);
        if (direction == "prev") thisAd--; 
        if (direction == "next") thisAd++; 

            //If we reach the end of the cycle
            if (thisAd == adImages.length)
                thisAd = 0;
            //If we reach the beginning of the cycle
            if (thisAd < 0)
                thisAd = adImages.length - 1;

            document.adBanner.src = adImages[thisAd];
    }

//Cycle through the ads
function cycleAds() {
//alert(thisAd);
    if (document.images) {

        if (document.adBanner.complete) {

            selectImg("next");

            }
        }

    // change to next banner
    setTimeout("cycleAds()", 7500);
    }

//This function is just to simulate the delay for the first item
function initBanners() {
    setTimeout("cycleAds()", 7500);
    }

// This function is used to direct the user to the website when
// the user clicks on a particular banner image.

function gotoAd()
{
    document.location.href = adURLs[thisAd];
}
