<!--
// Originally by Rachel Scanlon (I think)
// Updated 1/13/11 by Jeremy Klemm
// 
// Usage:
// call chooseAdFrom(array); to randomly pick an ad from the ad numbers in your array
//
// Example: chooseAdFrom(['0','1']);
// Result: Will choose randomly from ads 0 and 1 and display the chosen ad as the output 
// 


/* number of ads we need to store data for */
totalImages = 9;

/* number of properties for each image */
imageProperties = 3;


 var image = new Array(totalImages);

   for (x=0; x<=(totalImages - 1); x++){
      image[x]=new Array(imageProperties);
   }



/* define image urls */

if (document.images)
 {
	/* 
	
	array items:	
			0 - alt text
			1 - hyperlink URL.
			2 - the image's classes
	
	*/

	// Voucher
	image[0][0]="Summer Special &ndash; Free Courses with Vouchers";
	image[0][1]="/info/ilt-voucher.htm?wt.svl=vouch_advert";
	image[0][2]="vouchers smallAd";

	// 2 Course Special
	image[1][0]="Summer Special &ndash; Save up to $1,200";
	image[1][1]="/info/twocourseoffer.htm?wt.svl=twocrs_advert";
	image[1][2]="two-crs smallAd";

	// Disney
	image[2][0]="Disney Institute Courses Now Available at Learning Tree";
	image[2][1]="/disneyinstitute?wt.svl=disney_advert";
	image[2][2]="disney smallAd";
	
	// Special Price
	image[3][0]="Save up to 40% on Select Courses!";
	image[3][1]="/specialprice?wt.svl=sprice_advert";
	image[3][2]="specialPrice smallAd";

	// Express
	image[4][0]="Learning Tree Express Courses &ndash; &frac12;- and 1-Day Courses";
	image[4][1]="/express?wt.svl=express_advert";
	image[4][2]="express smallAd";

	// Intructors
	image[5][0]="Meet Our Exceptional Instructors";
	image[5][1]="/instructors/featured.htm?wt.svl=instructor_advert";
	image[5][2]="instructor smallAd";

	// Resources
	image[6][0]="Free Resources - White Papers, Podcasts, and More!";
	image[6][1]="https://resources.learningtree.com/overview.aspx?wt.svl=resources_advert";
	image[6][2]="resources smallAd";

	// Intructors
	image[7][0]="Meet Our Exceptional Instructors";
	image[7][1]="/instructors/featured.htm?wt.svl=instructor_advert&v=banks";
	image[7][2]="instructor-banks smallAd";

	// Intructors
	image[8][0]="Meet Our Exceptional Instructors";
	image[8][1]="/instructors/featured.htm?wt.svl=instructor_advert&v=gagli";
	image[8][2]="instructor-gagliardo smallAd";


 }    


/* no need to edit past this point */






function get_random(maxNum) {
  if (Math.random && Math.round) {
    var ranNum= Math.round(Math.random()*(maxNum-1));
    ranNum+=1;
  }  else  {
	today=new Date();
	hours=today.getHours();
	mins=today.getMinutes();
	secn=today.getSeconds();
	if (hours==19)
		hours=18;
	var ranNum= (((hours+1)*(mins+1)*secn)%maxNum)+1;
  }
  return ranNum;
}

/* pass in an array of options to choose from, and this will randomly return one */
function chooseAdFrom(imgOptions) {
		
		var choose_one= get_random(imgOptions.length);  
		choose_one--;
		

		chosen = imgOptions[choose_one];
		
		document.write('<a href="'+image[chosen][1]+'" title="'+image[chosen][0]+'" class="'+image[chosen][2]+'"></a>');
}


/* show one image */
function showAd(img) {
		document.write('<a href="'+image[img][1]+'" title="'+image[img][0]+'" class="'+image[img][2]+'"></a>');
}

//-->
