/////////////////////////////////////////////////////////////////////////////
///////////// Javascript For Changing the Ads in the sidebar////////////////
////////////      By Erin B. Lillis - All original code ////////////////
////////////// (except for ad code generated by affiliate sponsors) ///////
//////////////           September 2008                      //////////////
////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////   ARRAYS                        /////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

//create arrays that hold the different ad codes
	//var testArray = new Array ();
	var adBoxAArray = new Array ();
	var adBoxBArray = new Array ();
	//var adBannerArray = new Array (); //where the Google ads are currently located
	
	//populate arrays
	
	/*testArray[0] ="<b>DEBUG 01</b>";
	testArray[1] = "<i>DEBUG 02</i>";
	testArray[2] = "<h3>debug 03</h3>";
	testArray[3] = "stillll debugging";*/

///////////////////adBoxAArray - Amazon & Sideshow Collectibles ////////////////
///////////////////////////////////////////////////////////////////////////////
	adBoxAArray[0] = '<iframe src="http://rcm.amazon.com/e/cm?t=friedgreenobsess&o=1&p=6&l=st1&mode=books&search=collectibles&fc1=8C8C8C&lt1=_blank&lc1=7FAAFF&bg1=FFFFFF&f=ifr" marginwidth="0" marginheight="0" width="120" height="150" border="0" frameborder="0" style="border:none;" scrolling="no"></iframe>';

	adBoxAArray[1] = '<a href="http://affiliates.sideshowtoy.com/Tracker.aspx?aid=1635&bid=64&cid=45" target="_blank"><img src="http://www.sideshowtoy.com/affiliates/banners/1601_120x120.gif" height="120" width="120" border="0" alt="Faery of the Twilight"/></a>';

	adBoxAArray[2] = '<a href="http://affiliates.sideshowtoy.com/Tracker.aspx?aid=1635&bid=159&cid=4" target="_blank"><img src="http://www.sideshowtoy.com/affiliates/banners/2009_120x120.gif" height="120" width="120" border="0" alt="Vampire Willow"/></a>';

	adBoxAArray[3] = '<iframe src="http://rcm.amazon.com/e/cm?t=friedgreenobsess&o=1&p=6&l=st1&mode=books&search=collectibles&fc1=8C8C8C&lt1=_blank&lc1=7FAAFF&bg1=FFFFFF&f=ifr" marginwidth="0" marginheight="0" width="120" height="150" border="0" frameborder="0" style="border:none;" scrolling="no"></iframe>';

	adBoxAArray[4] = '<a href="http://affiliates.sideshowtoy.com/Tracker.aspx?aid=1635&bid=1777&cid=46" target="_blank"><img src="http://www.sideshowtoy.com/affiliates/banners/7808_120x120.gif" height="120" width="120" border="0" alt="Autopsy Scully"/></a>';

	adBoxAArray[5] = '<a href="http://affiliates.sideshowtoy.com/Tracker.aspx?aid=1635&bid=4228&cid=8" target="_blank"><img src="http://www.sideshowtoy.com/affiliates/banners/ssc_v6_120x120.gif" height="120" width="120" border="0" alt="General Sideshow Banners"/></a>';

	adBoxAArray[6] = '<iframe src="http://rcm.amazon.com/e/cm?t=friedgreenobsess&o=1&p=6&l=st1&mode=books&search=collectibles&fc1=8C8C8C&lt1=_blank&lc1=7FAAFF&bg1=FFFFFF&f=ifr" marginwidth="0" marginheight="0" width="120" height="150" border="0" frameborder="0" style="border:none;" scrolling="no"></iframe>';

	adBoxAArray[7] = '<a href="http://affiliates.sideshowtoy.com/Tracker.aspx?aid=1635&bid=4255&cid=-1" target="_blank"><img src="http://www.sideshowtoy.com/affiliates/banners/collect_120x120.gif" height="120" width="120" border="0" alt="General- Sideshow Collect for Life"/></a>';

	adBoxAArray[8] = '<a href="http://affiliates.sideshowtoy.com/Tracker.aspx?aid=1635&bid=4334&cid=8" target="_blank"><img src="http://www.sideshowtoy.com/affiliates/banners/contest_120x120.gif" height="120" width="120" border="0" alt="General- Sideshow Contests"/></a>';


//////////////////////////////adBoxBArray  (ENTERTAINMENT EARTH ADS)///////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////


	adBoxBArray[0] = '<a href="http://www.entertainmentearth.com/aff-home.asp?id=CO-706022332"><IMG SRC="images/ad_entearth.gif" width="120" height="120" alt="Entertainment Earth" BORDER="0"></a>';

	adBoxBArray[1] = '<a href="http://www.entertainmentearth.com/aff-home.asp?id=CO-706022332"><IMG SRC="images/ad_entearth02.gif" width="120" height="120" alt="Entertainment Earth" BORDER="0"></a>';

	adBoxBArray[2] = '<a href="http://www.entertainmentearth.com/aff-home.asp?id=CO-706022332"><IMG SRC="images/ad_entearth03.gif" width="120" height="120" alt="Entertainment Earth" BORDER="0"></a>';

	adBoxBArray[3] = '<a href="http://www.entertainmentearth.com/aff-home.asp?id=CO-706022332"><IMG SRC="images/ad_entearth04.gif" width="120" height="120" alt="Entertainment Earth" BORDER="0"></a>';

	adBoxBArray[4] = '<a href="http://www.entertainmentearth.com/aff-home.asp?id=CO-706022332"><IMG SRC="images/ad_entearth05.gif" width="120" height="120" alt="Entertainment Earth" BORDER="0"></a>';

	adBoxBArray[5] = '<a href="http://www.entertainmentearth.com/aff-home.asp?id=CO-706022332"><IMG SRC="images/ad_entearth06.gif" width="120" height="120" alt="Entertainment Earth" BORDER="0"></a>';


///////////////////adBannerArray  (Google & Misc skyscraper banners)///////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////

//this array is created as an alternative to the Google ad scripts that are currently
//in the right sidebar ... the google scripts don't seem to work when called from the array
/*adBannerArray[0] = '<a href="http://affiliates.sideshowtoy.com/Tracker.aspx?aid=1635&bid=209&cid=4" target="_blank"><img src="http://www.sideshowtoy.com/affiliates/banners/2014_160x600.jpg" height="600" width="160" border="0" alt="Vampire Spike"/></a>';

adBannerArray[1] = '<a href="http://affiliates.sideshowtoy.com/Tracker.aspx?aid=1635&bid=4312&cid=8" target="_blank"><img src="http://www.sideshowtoy.com/affiliates/banners/ssc_v4_160x600.jpg" height="600" width="160" border="0" alt="General- Sideshow Collectibles Version 4"/></a>';*/

//////////////////////////////////////////////////////////////////////////////////////
//////////////////////////// Initialization/OnLoad function //////////////////////////
/////////////////////////////////////////////////////////////////////////////////////

window.onload = function () {//an anonymous function loads with the page and calls the ad slideshows

	//alert("window.onload - I have loaded");
	
//on the load of the page, verify that the ad slots exist by looking to see if the browser
//can view things by id name and then looking for their id names
//ad slots = sponsor01, sponsor02 and googleads
	if(!document.getElementById) {
		return false;
	}
	if (!document.getElementById("sponsor01")) {
		return false;
	}
	if (!document.getElementById("sponsor02")) {
		return false;
	}
	if (!document.getElementById("googleads")) {
		return false;
	}
	
	//these variables didn't work - probably something to do with scope - figure out later
	//var ad_box1 = "window.document.getElementById(\"sponsor01\")";
	//var ad_box2 = "window.document.getElementById(\"sponsor02\")";
	//var ad_banner = "window.document.getElementById(\"googleads\")";
	

// set up counters for the slideshow actions
	var ad1Count = 0;
	var ad2Count = 0;
	//var adBannerCount = 0;  //for the Google/skyscraper area
	
	///////////////SPONSOR 01 - SLIDESHOW/BANNER ROTATION FUNCTION//////////////////////
	////////////////////////////////////////////////////////////////////////////////////
	function adShow01() {
	 	//alert ("In adShow01 function now. The counter = " + ad1Count + ". The adArray is " + testArray[ad1Count] + ".");
		
		//if the ad1 counter is greater than the length of the array, the counter will reset to 0
		if(ad1Count > (adBoxAArray.length-1)){
			ad1Count=0;
		}
		//this tells the page to load the HTML strings from the arrays into the ad box
		window.document.getElementById("sponsor01").innerHTML=adBoxAArray[ad1Count];
		//this changes the ad every 10 seconds
		setTimeout(adShow01, 10000);
		//this increases the counter number by 1
		ad1Count++;
	} //end of adShow01() function
	
	
	///////////////SPONSOR 02 - SLIDESHOW/BANNER ROTATION FUNCTION//////////////////////
	////////////////////////////////////////////////////////////////////////////////////
	function adShow02() {
	 	
		if(ad2Count > (adBoxBArray.length-1)){
			ad2Count=0;
		}
		//this tells the page to load the HTML strings from the arrays into the ad box
		window.document.getElementById("sponsor02").innerHTML=adBoxBArray[ad2Count];
		//this changes the ad every 10 seconds
		setTimeout(adShow02, 10000);
		//this increases the counter number by 1
		ad2Count++;
	} //end of adShow02() function
	
/*	////////GOOGLE ADs/Skyscraper - SLIDESHOW/BANNER ROTATION FUNCTION//////////////////
	////////////////////////////////////////////////////////////////////////////////////
	function bannerShow() {
	 	
		if(adBannerCount > (adBannerArray.length-1)){
			adBannerCount=0;
		}
		//this tells the page to load the HTML strings from the arrays into the ad box
		window.document.getElementById("googleads").innerHTML=adBannerArray[adBannerCount];
		//this changes the ad every 10 seconds
		setTimeout(bannerShow, 10000);
		//this increases the counter number by 1
		adBannerCount++;
	} //end of adShow02() function*/
	
	
	
	//calling the slideshow/banner rotation functions
	adShow01();
	adShow02();
	//bannerShow(); for the Google/skyscraper banner rotataion
	
}//end the anonymous initialization function
















