function randadd0()
{
// Enter the number of ads per side of the top banner
var left_ad_count = 2;
var right_ad_count = 2;

// Enter the number of right side tile ads
var tile_ad_count = 2;

//create an array of ad images

//var left_array = new Array(new Image(120,60), new Image(120,60), new Image(120,60), new Image(120,60), new Image(120,60), new Image(120,60));
//left_array[0].src="/images/DentaKitBannerAd_Free69_Ship_Jan08.jpg";
//left_array[1].src="images/Damon1_Mar06_1yr.jpg";
//left_array[2].src="images/Damon2_Mar06_1yr.jpg";
//left_array[3].src="images/Damon3_Mar06_1yr.jpg";
//left_array[4].src="images/Damon4_Mar06_1yr.jpg";
//left_array[5].src="images/Damon5_Mar06_1yr.jpg";

// This is for the left top banner
// New image rotation as of March 2011
// Create and populate an array of image files. 
// We'll pick the actual entry later
var left_array = new Array(new Image(120,60), new Image(120,60));
left_array[0].src="/images/DentaKitBannerAd_Free69_Ship_Jan08.jpg";
left_array[1].src="images/Oral_Breeze_Ad_March06-Number2.gif";

// This is for the right top banner 
// New image rotation as of March 2011
// Create and populate an array of image files. 
// We'll pick the actual entry later
var right_array = new Array(new Image(120,60), new Image(120,60));
right_array[0].src="images/DClear-BannerAd-ArchWired-415x110-v2A.JPG";
right_array[1].src="images/DClear-BannerAd-ArchWired-415x110-v2B.jpg";


// Obsolete code, even prior to March 2011
// Randomize and pick an Evertain image
//var et_spinner=Math.round(Math.random()*3)-1;
//if (et_spinner==0)
//   right_array[2].src="images/Evertain_1_March07.jpg";
//else if (et_spinner==1)
//   right_array[2].src="images/Evertain_2_March07.jpg";
//else right_array[2].src="images/Evertain_3_March07.jpg";
//else if (et_spinner==2)
//   right_array[2].src="images/Evertain_3_March07.jpg";

// This is for the right tile
// Create and populate an array of image files. 
// We'll pick the actual entry later
var tile_array = new Array(new Image(120,60), new Image(120,60));
tile_array[0].src="images/DClear-BannerAd-ArchWired-210x210-v3A.JPG";
tile_array[1].src="images/DClear-BannerAd-ArchWired-210x210-v4B.JPG";


// I use constants so it will be easy to change values if I put up new ads
// These will be used later to link to the appropriate site based the position 
// we are in the array
 var DK="http:\/\/www.dentakit.com\/";
 var IB="http:\/\/www.ibraces.com\/";
 var AW="http:\/\/www.archwired.com\/";
 var OB="http:\/\/www.dentakit.com\/oralirrigators.html";
 var DA="http:\/\/www.damonbraces.com\/";
 var IC="http:\/\/www.iceclearbraces.com\/";
//var ET="http:\/\/www.evertain.com\/";


// new links
var DA2A = "http:\/\/www.damonbraces.com\/go\/415v2a";
var DA2B = "http:\/\/www.damonbraces.com\/go\/415v2b";
var DA3A = "http:\/\/www.damonbraces.com\/go\/210v3a";
var DA4B = "http:\/\/www.damonbraces.com\/go\/210v4b";

// Get a random number for the left side
// Uncomment this when the left side must rotate
//get a random number between 0 and the number of ads available

// first, flip a coin. if it's heads, then the left banner belongs to dentakit.
// otherwise, it goes to damon
var left_spinner=Math.round(Math.random()*2)-1;
if (left_spinner == 0)
	left_random_value = 0;
else
{
	var left_random_value=Math.round(Math.random()*left_ad_count)-1;
	while(left_random_value<1 || left_random_value>left_ad_count)
	{ 
	   left_random_value=Math.round(Math.random()*left_ad_count)-1;
	}
}

//get a random number between 0 and the number of ads available
 var right_random_value=Math.round(Math.random()*right_ad_count)-1;
 while(right_random_value<0 || right_random_value>right_ad_count)
 { 
 	right_random_value=Math.round(Math.random()*right_ad_count)-1;
 }
 
 //get a random number between 0 and the number of ads available
 // for the tiles
 var tile_random_value=Math.round(Math.random()*tile_ad_count)-1;
 while(tile_random_value<0 || tile_random_value>tile_ad_count)
 { 
 	tile_random_value=Math.round(Math.random()*tile_ad_count)-1;
 }


// Here's we actually change the banner ad picture
document.link0.src=left_array[left_random_value].src;
document.link1.src=right_array[right_random_value].src;
document.link2.src=tile_array[tile_random_value].src;

//change the banner ad link to match the picture - left side
// Uncomment below when the left side rotates
// The order here must match the array from earlier
// That way we'll point at the correct link
if(left_random_value==0)
   document.links[0].href=DK;
else if(left_random_value==1)
   document.links[0].href=DK;
        
//change the banner ad link to match the picture - right side banner
// The order here must match the array from earlier
// That way we'll point at the correct link
 if(right_random_value==0)
  document.links[1].href=DA2A;
 else if(right_random_value==1)
  document.links[1].href=DA2B;
  

// Associate the link with the correct image
if(tile_random_value==0)
  document.links[54].href=DA3A;
else if(tile_random_value==1)
  document.links[54].href=DA4B;

}
