/***********************************************************************
 * Name: Mark E. Olszewski
 * Date: 11 September 2009
 * Description: Script to rotate banner and half-page ads for SECPTA
 *           web site.
***********************************************************************/

if( document.images )
{
    bannerAdImages = new Array(
        //"./ads/SolonCoop_SECPTA_BannerAD09.gif"
        );

    bannerAdURLs = new Array(
        //"www.soloncoop.org"
        );
       
    n = Math.floor( Math.random() * bannerAdImages.length );
    
    thisBannerAd = n;

    halfPageAdImages = new Array(
        "./ads/family.fun.directory.september.2010.jpg",
        "./ads/solon.jewish.preschool.august.2010.jpg",
        "./ads/cuts.n.curls.august.2010.jpg",
        "./ads/the.pond.august.2010.jpg",
        "./ads/jill.miller.august.2010.jpg",
        "./ads/precious.resources.august.2010.jpg",
        "./ads/gallman.group.september.2010.jpg"
        );

    halfPageAdURLs = new Array(
        "www.familyfundirectory.com",
        "www.solonjewishpreschool.com",
        "www.cutsncurls.net",
        "www.skateatthepond.com",
        "",
        "www.preciousresourcespreschool.com",
        "www.clevelandhomes.com"
        );
    
    n = Math.floor( Math.random() * halfPageAdImages.length );

    thisHalfPageAd = n;
}                    


function cycleAds()
{
    if( document.images )
    {
        if( document.bannerAd.complete )
        {
            if( ++thisBannerAd == bannerAdImages.length)
            {
                thisBannerAd = 0;
            }

            document.bannerAd.src = bannerAdImages[thisBannerAd];
        }

        if( document.halfPageAd.complete )
        {
            if( ++thisHalfPageAd == halfPageAdImages.length)
            {
                thisHalfPageAd = 0;
            }

            document.halfPageAd.src = halfPageAdImages[thisHalfPageAd];
        }
    }

    setTimeout( "cycleAds()", 10000 ); // milliseconds
}

function gotoBannerAdURL()
{
    //document.location.href = "http://" + bannerAdURLs[thisBannerAd];
    window.open( "http://" + bannerAdURLs[thisBannerAd] )
}  

function gotoHalfPageAdURL()
{
    //document.location.href = "http://" + bannerAdURLs[thisBannerAd];
    window.open( "http://" + halfPageAdURLs[thisHalfPageAd] )
}
