
/**************************************************************************************/
/*  Image Rotator																																			*/

pic_width=185;   /*change to match the height of all your images */
pic_height=104;   /* change to match the width of all your images */
border_size=0;   /* change to the border size you want on the images */

/* define image urls */
if (document.images)
{
     pic1 = new Image(pic_width,pic_height);
     pic1.src="http://www.med.ubc.ca/__shared/templates/images/home_left_middle.jpg";  
     pic2 = new Image(pic_width,pic_height); 
     pic2.src="http://www.med.ubc.ca/__shared/templates/images/home_right_middle.jpg"; 
     pic3 = new Image(pic_width,pic_height);
     pic3.src="http://www.med.ubc.ca/__shared/templates/images/home_right.jpg";  
     pic4 = new Image(pic_width,pic_height);
     pic4.src="http://www.med.ubc.ca/__shared/templates/images/left_middle_image.jpg";  
     pic5 = new Image(pic_width,pic_height);
     pic5.src="http://www.med.ubc.ca/__shared/templates/images/right_middle_image.jpg"; 
     pic6 = new Image(pic_width,pic_height);
     pic6.src="http://www.med.ubc.ca/__shared/templates/images/right_image.jpg"; 
     pic_large1 = new Image (236,pic_height);
     pic_large1.src = "http://www.med.ubc.ca/__shared/templates/images/home_left.jpg";
     pic_large2 = new Image (236,pic_height);
     pic_large2.src = "http://www.med.ubc.ca/__shared/templates/images/left_image.jpg";
}    


function homePageImages()
{
 if (document.images)
 {
 	var first = get_random(2);
  var second = get_random(6);  
  var third = get_random(6);
  while(third == second)
  {
  	third = get_random(6);
  }
  var fourth = get_random(6);
  while((fourth == second) || (fourth == third))
  {
  	fourth = get_random(6);
  }

  var pics= new Array(6) 
   pics[0]=pic1.src;
   pics[1]=pic2.src;
   pics[2]=pic3.src;
   pics[3]=pic4.src;
   pics[4]=pic5.src; 
   pics[5]=pic6.src;
  var pics_large = new Array(2)
   pics_large[0] = pic_large1.src;
   pics_large[1] = pic_large2.src;

  document.write("<img class='firstImage' src='" + pics_large[first - 1] + "' width='236' height='" + pic_height + "'><img src='" + pics[second - 1] + "' width='" + pic_width + "' height='" + pic_height + "'><img src='" + pics[third - 1] + "' width='" + pic_width + "' height='" + pic_height + "'><img src='" + pics[fourth - 1] + "' width='" + pic_width + "' height='" + pic_height + "'>");
 }
}


/* Random Number generator */
 function get_random(maxNum)
{
  if (Math.random && Math.round)
  {
    var ranNum= Math.round(Math.random()*(maxNum-1));
    ranNum+=1;
    return ranNum;
  }
  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;
  }
}

