function loadHomepageAdd(){
// all the homepage ad data
var homepageAds = new Array();
homepageAds[0] = new Array("61", "FAQ", "FAQ", "Get answers to your questions...", "...about libraries, library cards, online services, computer support, downloads and more.", "/images/pages/ad_61_image0.jpg", "/services/help/faq.htm");
homepageAds[1] = new Array("51", "Good Reads", "Good Reads", "Looking for something good to read?", "Check out our recommended lists to see what\'s new and what\'s hot.", "/images/pages/ad_51_image0.jpg", "/books-materials/book-lists/newsletter-book-lists.htm");
homepageAds[2] = new Array("60", "Lose power during the storm?", "Lose power during the storm?", "Get food and financial help", "You may be eligible to receive a credit and replacement food", "/images/pages/ad_60_image0.jpg", "/about-us/community-partner-links/Default.htm");
homepageAds[3] = new Array("9", "Read The Books", "Read The Books", "Accelerated Reader Lists", "Search your school\'s list and find your books in the library.", "/images/pages/ad_9_image0.jpg", "/kids-teens/kids/book-lists-kids/read-books-ar.htm");
homepageAds[4] = new Array("33", "Tax Time", "Tax Time", "Need tax help?", "Get free income tax preparation help from volunteer consultants. ", "/images/pages/ad_33_image0.jpg", "/services/research-corner/subject-links/tax-time.htm");

// generate a random number
var homepageAdItems = homepageAds.length;
var randomNumber = Math.round( (homepageAdItems-1) * Math.random() );
// get the location on the page to load the rivet bit
var handle=document.getElementById("homepage_ad");
if (handle) 
{
var content = "";
content += "<img src=\"" + homepageAds[randomNumber][5] + "\" border=\"0\" width=\"98px\" height=\"98px\" /><h2>" + homepageAds[randomNumber][2] +"</h2><h4>" + homepageAds[randomNumber][3] + "</h4><p>" + homepageAds[randomNumber][4] + "&nbsp;<a href=\"" + homepageAds[randomNumber][6] + "\">Learn More &raquo;</a></p><div class=\"arrows\"><a  onclick=\"adPrevious(" +  (randomNumber - 1) + ")\"><img src=\"/images/featurette-arrow-prev.gif\" border=\"0\" alt=\"&laquo;\" /></a><a  onclick=\"adNext(" + (randomNumber + 1) + ")\"><img src=\"/images/featurette-arrow-next.gif\" border=\"0\" alt=\"&raquo;\" /></a></div> ";
handle.innerHTML = content;
}
// change to add every 10 seconds
setTimeout("loadHomepageAdd()", 10000);
}
function adPrevious(index){
// all the homepage ad data
var homepageAds = new Array();
homepageAds[0] = new Array("61", "FAQ", "FAQ", "Get answers to your questions...", "...about libraries, library cards, online services, computer support, downloads and more.", "/images/pages/ad_61_image0.jpg", "/services/help/faq.htm");
homepageAds[1] = new Array("51", "Good Reads", "Good Reads", "Looking for something good to read?", "Check out our recommended lists to see what\'s new and what\'s hot.", "/images/pages/ad_51_image0.jpg", "/books-materials/book-lists/newsletter-book-lists.htm");
homepageAds[2] = new Array("60", "Lose power during the storm?", "Lose power during the storm?", "Get food and financial help", "You may be eligible to receive a credit and replacement food", "/images/pages/ad_60_image0.jpg", "/about-us/community-partner-links/Default.htm");
homepageAds[3] = new Array("9", "Read The Books", "Read The Books", "Accelerated Reader Lists", "Search your school\'s list and find your books in the library.", "/images/pages/ad_9_image0.jpg", "/kids-teens/kids/book-lists-kids/read-books-ar.htm");
homepageAds[4] = new Array("33", "Tax Time", "Tax Time", "Need tax help?", "Get free income tax preparation help from volunteer consultants. ", "/images/pages/ad_33_image0.jpg", "/services/research-corner/subject-links/tax-time.htm");

// get the location on the page to load the rivet bit
var handle=document.getElementById("homepage_ad");
if (handle) 
{
var content = "";
if (index >= 0)
{
content += "<img src=\"" + homepageAds[index][5] + "\" border=\"0\" width=\"98px\" height=\"98px\" /><h2>" + homepageAds[index][2] +"</h2><h4>" + homepageAds[index][3] + "</h4><p>" + homepageAds[index][4] + "&nbsp;<a href=\"" + homepageAds[index][6] + "\">Learn More &raquo;</a></p><div class=\"arrows\"><a  onclick=\"adPrevious(" +  (index - 1) + ")\"><img src=\"/images/featurette-arrow-prev.gif\" border=\"0\" alt=\"&laquo;\" /></a><a  onclick=\"adNext(" + (index + 1) + ")\"><img src=\"/images/featurette-arrow-next.gif\" border=\"0\" alt=\"&raquo;\" /></a></div> ";
handle.innerHTML = content;
}
else
{
content += "<img src=\"" + homepageAds[homepageAds.length-1][5] + "\" border=\"0\" width=\"98px\" height=\"98px\" /><h2>" + homepageAds[homepageAds.length-1][2] +"</h2><h4>" + homepageAds[homepageAds.length-1][3] + "</h4><p>" + homepageAds[homepageAds.length-1][4] + "&nbsp;<a href=\"" + homepageAds[homepageAds.length-1][6] + "\">Learn More &raquo;</a></p><div class=\"arrows\"><a  onclick=\"adPrevious(" +  (homepageAds.length - 2) + ")\"><img src=\"/images/featurette-arrow-prev.gif\" border=\"0\" alt=\"&raquo;\" /></a><a  onclick=\"adNext(" + (0) + ")\"><img src=\"/images/featurette-arrow-next.gif\" border=\"0\" alt=\"&raquo;\" /></a></div> ";
handle.innerHTML = content;
}
}
}
function adNext(index){
// all the homepage ad data
var homepageAds = new Array();
homepageAds[0] = new Array("61", "FAQ", "FAQ", "Get answers to your questions...", "...about libraries, library cards, online services, computer support, downloads and more.", "/images/pages/ad_61_image0.jpg", "/services/help/faq.htm");
homepageAds[1] = new Array("51", "Good Reads", "Good Reads", "Looking for something good to read?", "Check out our recommended lists to see what\'s new and what\'s hot.", "/images/pages/ad_51_image0.jpg", "/books-materials/book-lists/newsletter-book-lists.htm");
homepageAds[2] = new Array("60", "Lose power during the storm?", "Lose power during the storm?", "Get food and financial help", "You may be eligible to receive a credit and replacement food", "/images/pages/ad_60_image0.jpg", "/about-us/community-partner-links/Default.htm");
homepageAds[3] = new Array("9", "Read The Books", "Read The Books", "Accelerated Reader Lists", "Search your school\'s list and find your books in the library.", "/images/pages/ad_9_image0.jpg", "/kids-teens/kids/book-lists-kids/read-books-ar.htm");
homepageAds[4] = new Array("33", "Tax Time", "Tax Time", "Need tax help?", "Get free income tax preparation help from volunteer consultants. ", "/images/pages/ad_33_image0.jpg", "/services/research-corner/subject-links/tax-time.htm");

// get the location on the page to load the rivet bit
var handle=document.getElementById("homepage_ad");
if (handle) 
{
var content = "";
if (index < homepageAds.length)
{
content += "<img src=\"" + homepageAds[index][5] + "\" border=\"0\" width=\"98px\" height=\"98px\" /><h2>" + homepageAds[index][2] +"</h2><h4>" + homepageAds[index][3] + "</h4><p>" + homepageAds[index][4] + "&nbsp;<a href=\"" + homepageAds[index][6] + "\">Learn More &raquo;</a></p><div class=\"arrows\"><a  onclick=\"adPrevious(" +  (index - 1) + ")\"><img src=\"/images/featurette-arrow-prev.gif\" border=\"0\" alt=\"&laquo;\" /></a><a  onclick=\"adNext(" + (index + 1) + ")\"><img src=\"/images/featurette-arrow-next.gif\" border=\"0\" alt=\"&raquo;\" /></a></div> ";
handle.innerHTML = content;
}
else
{
content += "<img src=\"" + homepageAds[0][5] + "\" border=\"0\" width=\"98px\" height=\"98px\" /><h2>" + homepageAds[0][2] +"</h2><h4>" + homepageAds[0][3] + "</h4><p>" + homepageAds[0][4] + "&nbsp;<a href=\"" + homepageAds[0][6] + "\">Learn More &raquo;</a></p><div class=\"arrows\"><a  onclick=\"adPrevious(" +  (homepageAds.length - 1) + ")\"><img src=\"/images/featurette-arrow-prev.gif\" border=\"0\" alt=\"&laquo;\" /></a><a  onclick=\"adNext(" + (1) + ")\"><img src=\"/images/featurette-arrow-next.gif\" border=\"0\" alt=\"&raquo;\" /></a></div> ";
handle.innerHTML = content;
}
}
}
