/*
External JavaScript Functions
for a Banner Ad Rotator/Server
to feature sponsors, partners, affiliates, and supporters
including friends, family, and public service ads
Copyright (c) 2007-2011 by Rob L. Dey
Updated 05/04/2008, 10/03/2008, 01/24/2009, 03/01/2011 RLD
*/

/*
Common Banner Sizes: (width x height in pixels)
Top/Bottom Bars-
Half Banner: 234x60
Full Banner: 468x60
Left/Right Bars-
Button 1: 120x60
Button 2: 120x90
Vertical Banner: 120x240
Skyscraper: 120x600
Square Button: 125x125
Navigation-
Micro Button: 80x15
Micro Bar: 88x31
*/

if (document.images)
{
  // Banner ads should be 468x60 24-bit color or less (.png or .jpg), with 1px black outline preferred
  var adImages = new Array(
    "afterspirit_ban_ol.png",
    "natradio_ban_ol.png",
    "stid2_ban_ol.png",
    "OTBbanner_ad.png",
    "deyBANNERad-08.png",
    "FFTBANNERad-07.png",
    "FWBANNERad-08.png",
    "stid2_ban_blu_ol.png",
    "ghh_bnnrad08.png");
  var adNames = new Array(
    "AfterSpirit",
    "Nat Radio Co.",
    "Shark Tooth Identification",
    "Outta the Blue",
    "Deystudio",
    "Food For Thought",
    "Funguswacker5000",
    "Shark Tooth Identification",
    "Great Halls of Healing");
  var adURLs = new Array(
    "www.afterspirit.com",
    "www.natradioco.com",
    "www.natradioco.com/stid2",
    "www.outta-the-blue.com",
    "www.deystudio.com",
    "www.foodforthought-healthstore.com",
    "www.funguswacker5000.com",
    "www.natradioco.com/stid2",
    "www.greathallsofhealing.com");
  var thisAd = 0;
}

if (document.images)
{
  // Banner ads should be 125x125 24-bit color or less (.png or .jpg), with 1px black outline preferred
/*
  var adImagesSq = new Array(
    "afterspirit_ban_ol_sq.png",
    "natradio_ban_ol_sq.png");
  var adNamesSq = new Array(
    "AfterSpirit",
    "Nat Radio Co.");
  var adURLsSq = new Array(
    "www.afterspirit.com",
    "www.natradioco.com");
*/
  var thisAdSq = 0;
}

// Change sponsor every 5 seconds sequentially or randomly with each page load (top/bottom ads)
function cycle_ad()
{
  if (document.images)
  {
    thisAd = Math.round((adImages.length-1)*Math.random()); // Comment out for timed sequential mode
    if (document.banner.complete)
    {
      document.banner.src="./images/banners/" + adImages[thisAd];
      document.banner.alt=adNames[thisAd] + " (" + adURLs[thisAd] + ")";
      //if (++thisAd == adImages.length) thisAd = 0; // Comment out for random mode
    }
  }
  //setTimeout("cycle_ad()", 5000); // Comment out for random mode
}

function link_ad()
{
  window.open("http://" + adURLs[thisAd] + "/"); // Open link in new window, unnamed
  //window.location.href="http://" + adURLs[thisAd] + "/"; // Open link in same window
  //document.URL="http://" + adURLs[thisAd] + "/"; // Open link in same window
}

// Change sponsor every 5 seconds sequentially or randomly with each page load (left/right side ads)
function cycle_ads()
{
  if (document.images)
  {
    thisAd = Math.round((adImages.length-1)*Math.random()); // Comment out for timed sequential mode
    if (document.banner.complete)
    {
      document.banner.src="./images/banners/" + adImages[thisAd];
      document.banner.alt=adNames[thisAd] + " (" + adURLs[thisAd] + ")";
      //if (++thisAd == adImages.length) thisAd = 0; // Comment out for random mode
    }
/*
    thisAdSq = Math.round((adImagesSq.length-1)*Math.random()); // Comment out for timed sequential mode
    if (document.banner.complete)
    {
      document.bannersq.src="./images/banners/" + adImagesSq[thisAdSq];
      document.bannersq.alt=adNamesSq[thisAdSq] + " (" + adURLsSq[thisAdSq] + ")";
      //if (++thisAdSq == adImagesSq.length) thisAdSq = 0; // Comment out for random mode
    }
*/
  }
  //setTimeout("cycle_ads()", 5000); // Comment out for random mode
}

function link_ads()
{
  window.open("http://" + adURLsSq[thisAdSq] + "/"); // Open link in new window, unnamed
  //window.location.href="http://" + adURLsSq[thisAdSq] + "/"; // Open link in same window
  //document.URL="http://" + adURLsSq[thisAdSq] + "/"; // Open link in same window
}

