<!--
// 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 = 6;

/* 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
	
	*/

	// Free Resources
	image[0][0]="Free Resources!";
	image[0][1]="http://resources.learningtree.ca/overview.aspx?wt.svl=resources_advert";
	image[0][2]="resources1 smallAd";

	// New Courses
	image[1][0]="New Courses - SQL Server 2012, ISO 20000, Certified Scrum & more!";
	image[1][1]="/info/new-courses.asp?wt.svl=newcourse_advert";
	image[1][2]="newCourses smallAd";


	// OTES
	image[2][0]="Cost-Effective &amp; Customized Training Delivered to You";
	image[2][1]="/info/on-site.htm?wt.svl=otes_advert";
	image[2][2]="otes smallAd";



	// AnyWare
	image[3][0]="Live, Online Training: Discover over 165 hands-on courses available anywhere.";
	image[3][1]="/anyware?wt.svl=anyware_advert";
	image[3][2]="anyware smallAd";

       

        // Special Price
	image[4][0]="Just $2,000 on Select Courses!";
	image[4][1]="/2000?wt.svl=sprice_advert";
	image[4][2]="specialPrice smallAd";


        // New to Learning Tree
	image[5][0]="Try us and Save! Limited-Time Offer!";
	image[5][1]="/newbiz?wt.svl=new_customer_advert";
	image[5][2]="newCustomer 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>');
}

//-->
