// Based on script created by Computerhope - http://www.computerhope.com & Barry Pranklin - http://www.pranklin.com
// Script is used to generate 3 unique random images out of 9, pair them up with their matching caption, to be placed on the page

// array of instructor images
var imagesI = new Array(10);
imagesI[0] = "<a href='instructors/giampietro.php'><img src='media/instructors/GiampietroR.gif' alt='Rob Giampietro'>";
imagesI[1] = "<a href='instructors/formosa.php'><img src='media/instructors/FormosaD.gif' alt='Dan Formosa'>";
imagesI[2] = "<a href='instructors/devillart.php'><img src='media/instructors/DevillartS.gif' alt='Sem Devillart'>";
imagesI[3] = "<a href='instructors/decesare.php'><img src='media/instructors/DeCesareP.gif' alt='Pamela DeCesare'>";
imagesI[4] = "<a href='instructors/weisman.php'><img src='media/instructors/WeismanD.gif' alt='David Wisman'>";
imagesI[5] = "<a href='instructors/lerman.php'><img src='media/instructors/LermanS.gif' alt='Scott Lerman'>";
imagesI[6] = "<a href='instructors/guarriello.php'><img src='media/instructors/GuarrielloT.gif' alt='Tom Guarriello'>";
imagesI[7] = "<a href='instructors/liberson.php'><img src='media/instructors/LibersonJ.gif' alt='Josh Liberson'>";	
imagesI[8] = "<a href='instructors/postrel.php'><img src='media/instructors/PostrelV.gif' alt='Virginia Postrel'>";
imagesI[9] = "<a href='instructors/shear.php'><img src='media/instructors/ShearR.gif' alt='Richard Shear'>";

// array of captions, matches the image index
var captionI = new Array(10);
captionI[0] = "<b>Rob Giampietro, Faculty</b></a><br />Designer, Writer,Formerly Co-founder and Principal of Giampietro+Smith, Freelance Designer at Pentagram...";
captionI[1] = "<b>Dan Formosa, Faculty</b></a><br />Consultant, Product Design and Design Research, Co-founder, Smart Design and a member of the design...";
captionI[2] = "<b>Sem Devillart, Faculty</b></a><br />Co-founder and managing partner at Popular Operations. Popular Operations provides high-level...";
captionI[3] = "<b>Pamela DeCesare, Faculty</b></a><br />Executive Vice President Design Management, Sterling Brands, Formerly Director, Global...";
captionI[4] = "<b>David Weisman, Faculty</b></a><br />When he’s not being a weekend warrior or playing jazz saxophone, David is consulting on brand strategy...";
captionI[5] = "<b>Scott Lerman, Faculty</b></a><br />CEO and Founding Partner, Lucid Brands Scott has built his career by helping companies navigate critical...";
captionI[6] = "<b>Tom Guarriello, Faculty</b></a><br />Chief Idea Officer, Principal, TrueTalk Consulting, Inc. Formerly practicing clinical psychologist...";
captionI[7] = "<b>Josh Liberson, Faculty</b></a><br />Founding Principle, Helicopter, Clients include: Condé Nast, Capitol Records, André Balazs Properties...";
captionI[8] = "<b>Virginia Postrel, Faculty</b></a><br />Author: The Substance of Style and The Future and Its Enemies. She is currently writing a book on glamour for The Free...";
captionI[9] = "<b>Richard Shear, Faculty</b></a><br />Founding Principal and Creative Director of The Shear Partnership. He founded the firm, in 1993, to establish a design...";
	
			// generates 3 unique numbers out of 9
			var Found=false;
			var Current = new Array();
			var MaxValue=10;   //max number of random numbers that need to be generated, take 0 into account
			var NumUnique=2; //unique numbers required
			var Count=0;
			var Current = new Array(NumUnique);
			
			function get_random(){
				var ranNum= Math.floor(Math.random()*MaxValue);
				return ranNum;
			}
			
			function GetUnique(){
				for (i=0;Count<NumUnique;Count++)
				{
				  Found=false;
				  var rndValue = get_random();
				  var j=0;
				  for (j=0;j<Current.length;j++)
				  {
					if (Current[j] == rndValue)
					{
					  Found=true;
					  break;
					}
				  }
				  if (Found)
				  {
					Count--;
				  } else {
					Current[Count]=rndValue;
				  }
				}
			}
			
			GetUnique();
			//alert("The unique numbers are: " + Current[0] + ", " + Current[1] + ", and " + Current[2]);

// functions that pair up the image and caption, and prepare html
function placeInstructor1(){
	 document.write(imagesI[Current[0]] + captionI[Current[0]]);
}

function placeInstructor2(){
	 document.write(imagesI[Current[1]] + captionI[Current[1]]);
}					                             