function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/*************************************************************************
  This code was created by Dynamic Web Coding at www.dyn-web.com
  Copyright 2001-3 by Sharon Paine 
  Permission granted to First Crescent Designs and their clients
  to use this code as long as this entire notice is included.
  All others must contact www.dyn-web.com for permission to use this code.
*************************************************************************/

// Allows for selection of first image at random 
var advent_ar = new Array("adventurous1.jpg","adventurous5.jpg","adventurous4.jpg","adventurous9.jpg","adventurous10.jpg","adventurous11.jpg");
var meet_ar = new Array("meetpeople18.jpg","meetpeople2.jpg","meetpeople16.jpg","meetpeople5.jpg","meetpeople20.jpg","meetpeople14.jpg","meetpeople6.jpg","meetpeople15.jpg","meetpeople19.jpg","meetpeople21.jpg");
var ride_ar = new Array("skiride1.jpg","skiride4.jpg","skiride5.jpg","skiride6.jpg","skiride3.jpg","skiride8.jpg","skiride9.jpg","skiride10.jpg","skiride11.jpg");

function initImgRotation() {
  // create rotating image objects here 
  // arguments: image name, rotation speed (milliseconds)
  var rotator1 = new rotateImgObj('skiride1',5150);
  // add the images to rotate into that image object (point to array above)
  rotator1.addImages(ride_ar);
  rotator1.rotate();
 
  var rotator2 = new rotateImgObj('meetpeople1', 5273);
  rotator2.addImages(meet_ar);
  rotator2.rotate();
  
  var rotator3 = new rotateImgObj('adventurous1', 4011);
  rotator3.addImages(advent_ar);
  rotator3.rotate();

  // starts rotation for all defined rotateImgObjs
  for (var i=0; i<rotateImgObjs.length; i++) 
    rotateImgObjs[i].timer = setInterval(rotateImgObjs[i].animString + ".rotate()", rotateImgObjs[i].speed);
}


// If all the images you wish to display are in the same location, you can specify the path here 
rotateImgObj.imagesPath = "images/";

rotateImgObjs = []; // holds all rotating image objects defined
// constructor 
function rotateImgObj(nm,s) {
  this.speed=s; this.ctr=0; this.timer=0;  
  this.imgObj = document.images[nm]; // get reference to the image object
  this.index = rotateImgObjs.length; rotateImgObjs[this.index] = this;
  this.animString = "rotateImgObjs[" + this.index + "]";

  this.addImages = addRotatingImages; 
  this.rotate = rotateImg;
}

function addRotatingImages(ar) {
  this.imgObj.imgs = [];
  for (var i=0; i<ar.length; i++) {
    this.imgObj.imgs[i] = new Image();
    this.imgObj.imgs[i].src = rotateImgObj.imagesPath + ar[i];
  }
}

// controls rotation
// Modified to randomly select from array 
function rotateImg() {
  var ctr = Math.floor( Math.random() * this.imgObj.imgs.length );
  if (ctr == this.ctr) ctr = (ctr > 0)? --ctr: ++ctr;
  this.ctr = ctr;
  this.imgObj.src = this.imgObj.imgs[this.ctr].src;
}
// end rotator code 
/////////////////////////////////////////////////////////////////////


// open javascript for the open browserw indow function with assigned specific location and size. Also only opens one window at a time

function MM_openBrWindow(page) { //v2.0
	linkWindow = window.open(page, "newHTML","toolbar=yes,menubar=yes,location=yes,scrollbars=yes,status=yes,resizable=yes,copyhistory=1,top=200,left=200,width=600,height=300");
	linkWindow.focus();
}