var ToutCount1=2; // the total # of touts for New Releases
var ToutCount2=2; // the total # of touts for Coming Soon
var toutNext1=0;
var toutNext2=0;
var speed=4000;
var speed2=5000;
var timer="off";

var ToutImages=new MakeImageArray(ToutCount1);
var ToutLinks=new Array(ToutCount1);

var ToutImages2=new MakeImageArray(ToutCount2);

var ToutImages2books=new MakeImageArray(ToutCount2);

var val1=randRange(0,ToutCount1-1);
var val2=randRange(0,ToutCount2-1);


// Updating Notes - comment/uncomment out the New Releases & Coming Soon lines
// depending on the # of touts you are adding/removing, update the counts on Lines 1 & 2 above.
// Ex: Coming Soon has a toutcount of 2 for this update, so line 52 was commented out.
// If for the next update it will have 3 touts, change the value of ToutCount2 in line 2 above to
// equal 3 and uncomment out line 52 and update the image path.


//NEW RELEASES
ToutImages[0].src="http://shop.scholastic.com/content/stores/media/products/65/9780545214865_lg.jpg";
ToutImages[1].src="http://shop.scholastic.com/content/stores/media/products/51/9780545267151_lg.jpg";




ToutLinks[0]="http://shop.scholastic.com/webapp/wcs/stores/servlet/ProductDisplay_73306_-1_10001_10002";
ToutLinks[1]="http://shop.scholastic.com/webapp/wcs/stores/servlet/ProductDisplay_73308_-1_10001_10002";

// ToutLinks[2]="http://shop.scholastic.com/webapp/wcs/stores/servlet/ProductDisplay_73303_-1_10001_10002";
// ToutLinks[3]="http://shop.scholastic.com/webapp/wcs/stores/servlet/ProductDisplay_73304_-1_10001_10002";
// ToutLinks[4]="http://shop.scholastic.com/webapp/wcs/stores/servlet/ProductDisplay_73305_-1_10001_10002";




//COMING SOON

ToutImages2books[0].src="http://shop.scholastic.com/content/stores/media/products/53/9780545305853_lg.jpg";
ToutImages2books[1].src="http://shop.scholastic.com/content/stores/media/products/51/9780545267151_lg.jpg";



function MakeImageArray(n) {
  	this.length=n;
  	if (document.images) {
	  	for (var i=0; i<n; i++) {
	    	this[i]=new Image();
	  	}
  	}
  	return this;  
}

//used in books\index.html only
function cyclebooks() {
	if (document.images){
		if (toutNext2==ToutCount2) toutNext2=0;
		document.images["toutImage2books"].src=ToutImages2books[toutNext2].src;
		toutNext2+=1;
		setTimeout("cyclebooks()",speed);
	}
}

function getToutLink() {open(ToutLinks[val1],'_blank');}

function randRange(lowVal,highVal) {return Math.floor(Math.random()*(highVal-lowVal+1))+lowVal;}

function init() {
	document.images["toutImage"].src=ToutImages[val1].src;
}

//Removed from homepage
//function init() {
//	document.images["toutImage2"].src=ToutImages2[val2].src;
//}

