var switchSecondaryBanner = true;
var secondaryBanner = new Array();
//var secondaryBannerFile = new Array();
//var secondaryBannerLink = new Array();
//var secondaryBannerNewWindow = new Array();
//var secondaryBannerAltTag = new Array();
//var i=-1;

// write out the div where everything will be
//document.write('<div style="height: 144px;"><div id="secondary-banners"></div><div id="sbnav"></div></div>');
  
//specify images and corresponding links below. You can have as many as you wish

for (i=0; i< secondaryBannerFile.length; i++)
{
 if (secondaryBannerFile[i].substring(secondaryBannerFile[i].lastIndexOf(".")+1,secondaryBannerFile[i].length) == "swf")
 {
  // flash
  secondaryBanner[i] = '<div class="flashobj">';
  secondaryBanner[i] += '<OBJECT codeBase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="214" height="144">';
  secondaryBanner[i] += '<PARAM NAME="Movie" VALUE="'+secondaryBannerFile[i]+'">';
  secondaryBanner[i] += '<PARAM NAME="Play" VALUE="true">';
  secondaryBanner[i] += '<PARAM NAME="Loop" VALUE="-1">';
  secondaryBanner[i] += '<PARAM NAME="Quality" VALUE="High">';
  secondaryBanner[i] += '<param name="WMode" value="transparent">';
  secondaryBanner[i] += '<embed pluginspage="http://www.macromedia.com/go/getflashplayer" src="'+secondaryBannerFile[i]+'" type="application/x-shockwave-flash" quality="high" play="true" width="214" height="144" wmode="transparent" />';
  secondaryBanner[i] += '</OBJECT>';
  secondaryBanner[i] += '</div>';
 }
 else
 {
  // regular image
  secondaryBanner[i] = '<a href='+'"'+secondaryBannerLink[i]+'"';
  if (secondaryBannerNewWindow[i]) secondaryBanner[i] += ' target="_blank"';
  secondaryBanner[i] += '>';
  secondaryBanner[i] += '<img src="' + secondaryBannerFile[i] + '" border="0" alt="' + secondaryBannerAltTag[i]+'">';
  secondaryBanner[i] += '</a>';
  
  // pre-load images
  temp = new Image();
  temp.src=secondaryBannerFile[i];
 }
}

// choose a banner at random and display it 
var whichSecondaryBanner = Math.floor(Math.random() * secondaryBannerFile.length);
//document.getElementById("secondary-banners").innerHTML = secondaryBanner[whichSecondaryBanner];

function secondaryBannerSkipTo(whichBanner)
{
 document.getElementById("secondary-banners").innerHTML = secondaryBanner[whichBanner];
}

function prevSecondaryBanner() { secondaryBannerSkip(-1); switchSecondaryBanner = false; }
function nextSecondaryBanner() { secondaryBannerSkip(1); switchSecondaryBanner = false; }

function secondaryBannerSkip(howmany)
{
 whichSecondaryBanner = whichSecondaryBanner + howmany;
 if (whichSecondaryBanner >= secondaryBannerFile.length) whichSecondaryBanner -= secondaryBannerFile.length;
 if (whichSecondaryBanner < 0) whichSecondaryBanner += secondaryBannerFile.length;
 
 window.setTimeout("secondaryBannerSkipTo(" + whichSecondaryBanner + ")", 250);
}

// check whether there are multiple banners
switchSecondaryBanner = (switchSecondaryBanner && secondaryBannerFile.length > 1);

// write banner-switching links
if (switchSecondaryBanner)
{
 document.write('<div style="width: 170px;"><div id="secondary-banners"></div><div id="sbnav" align="center">');
 document.write('<nobr>');
 document.write('<a href="javascript:void(0);" onClick="prevSecondaryBanner();"><img src="/images/home/arrow-left.gif" alt="Previous" border="0"></a>');
 document.write(' ');
 document.write('<a href="javascript:void(0);" onClick="nextSecondaryBanner();"><img src="/images/home/arrow-right.gif" alt="Next" border="0"></a>');
 document.write('</nobr>');
 document.write('</div></div>');
}
else
{
 // need to add whitespace if we don't have the banner-switching links
 //document.write('<br />');
 document.write('<div style="height: 144px;"><div id="secondary-banners"></div><div id="sbnav"></div></div>');
}

document.getElementById("secondary-banners").innerHTML = secondaryBanner[whichSecondaryBanner];

// automatically rotate
function secondaryTimedSwitch()
{
 if (switchSecondaryBanner)
 {
  secondaryBannerSkip(1);
  window.setTimeout("secondaryTimedSwitch()",12000);
 }
}

//secondaryTimedSwitch();