//__ browser check code from Dynamic Web Coding - www.dyn-web.com and www.dreamingdigital.ca
var dom = (document.getElementById) ? true : false;
var ns6 = ((navigator.userAgent.toLowerCase().indexOf("gecko")>-1) && dom) ? true: false;
var ie5 = ((navigator.userAgent.toLowerCase().indexOf("msie")>-1) && dom) ? true : false;
var ns4 = (document.layers && !dom) ? true : false;
var ie4 = (document.all && !dom) ? true : false;
var nodyn = (!ns6 && !ns4 && !ie4 && !ie5) ? true : false;
var mac = (navigator.userAgent.toLowerCase().indexOf("mac")!=-1) ? true: false;
var windows = (navigator.userAgent.toLowerCase().indexOf("windows")!=-1) ? true: false;

//__ Random Image Link Script By Website Abstraction (http://www.wsabstract.com) and Java-scripts.net (http://www.java-scripts.net)
//__ EXTENSIVELY Modified for Don Rice's application by Dreaming Digital www.dreamingdigital.ca

// change this variable to where you store your images in relation to the page.
var img_dir = "/TopBanner/";

// 1 of 4 random image generator functions
function dd_random_img_1(){
  var the_img_layer = "top_pic_holder_1";	
  var myimages = new Array();
  //fill the images array "myimages" with pictures. You can have as many as you wish and you can name the files whatever you want as well
  myimages[1] = img_dir + "Pict1.jpg";
  myimages[2] = img_dir + "Pict2.jpg";
  myimages[3] = img_dir + "Pict3.jpg";
  myimages[4] = img_dir + "Pict4.jpg";

  var ry = Math.floor(Math.random() * myimages.length);
  if (ry == 0)
	ry = 1;
	
  if(ie5){	
  document.images[the_img_layer].style.filter="blendTrans(duration=2)";
  document.images[the_img_layer].filters.blendTrans(duration=2).Apply();
  document.images[the_img_layer].filters.blendTrans.Play();
  document.images[the_img_layer].src = myimages[ry];    
  }
  else {
  document.images[the_img_layer].src = myimages[ry];
  }
}


// 2 of 4 random image generator functions
function dd_random_img_2(){
  var the_img_layer = "top_pic_holder_2";
  var myimages = new Array();
  //fill the images array "myimages" with pictures. You can have as many as you wish and you can name the files whatever you want as well
  myimages[1] = img_dir + "Pict5.jpg";
  myimages[2] = img_dir + "Pict6.jpg";
  myimages[3] = img_dir + "Pict7.jpg";
  myimages[4] = img_dir + "Pict8.jpg";

  var ry = Math.floor(Math.random() * myimages.length);
  if (ry == 0)
	ry = 1;
  if(ie5){	
  document.images[the_img_layer].style.filter="blendTrans(duration=2)";
  document.images[the_img_layer].filters.blendTrans(duration=2).Apply();
  document.images[the_img_layer].filters.blendTrans.Play();
  document.images[the_img_layer].src = myimages[ry];    
  }
  else {
  document.images[the_img_layer].src = myimages[ry];
  }
}


// 3 of 4 random image generator functions
function dd_random_img_3(){
  var the_img_layer = "top_pic_holder_3";	
  var myimages = new Array();
  //fill the images array "myimages" with pictures. You can have as many as you wish and you can name the files whatever you want as well
  myimages[1] = img_dir + "Pict9.jpg";
  myimages[2] = img_dir + "Pict10.jpg";
  myimages[3] = img_dir + "Pict11.jpg";
  myimages[4] = img_dir + "Pict12.jpg";

  var ry = Math.floor(Math.random() * myimages.length);
  if (ry == 0)
	ry = 1;
  if(ie5){	
  document.images[the_img_layer].style.filter="blendTrans(duration=2)";
  document.images[the_img_layer].filters.blendTrans(duration=2).Apply();
  document.images[the_img_layer].filters.blendTrans.Play();
  document.images[the_img_layer].src = myimages[ry];    
  }
  else {
  document.images[the_img_layer].src = myimages[ry];
  }
}


// 4 of 4 random image generator functions
function dd_random_img_4(){
  var the_img_layer = "top_pic_holder_4";	
  var myimages = new Array();
  //fill the images array "myimages" with pictures. You can have as many as you wish and you can name the files whatever you want as well
  myimages[1] = img_dir + "Pict13.jpg";
  myimages[2] = img_dir + "Pict14.jpg";
  myimages[3] = img_dir + "Pict15.jpg";
  myimages[4] = img_dir + "Pict16.jpg";

  var ry = Math.floor(Math.random() * myimages.length);
  if (ry == 0)
	ry = 1;
  if(ie5){	
  document.images[the_img_layer].style.filter="blendTrans(duration=2)";
  document.images[the_img_layer].filters.blendTrans(duration=2).Apply();
  document.images[the_img_layer].filters.blendTrans.Play();
  document.images[the_img_layer].src = myimages[ry];    
  }
  else {
  document.images[the_img_layer].src = myimages[ry];
  }
}

function dd_init_top_image_show() {
  setTimeout("setInterval('dd_random_img_1()',5000)",1);    //in miliseconds (1000/sec) of how long to wait before launching the function.
  setTimeout("setInterval('dd_random_img_2()',5000)",1500); //in miliseconds (1000/sec) of how long to wait before launching the function.
  setTimeout("setInterval('dd_random_img_3()',5000)",3000); //in miliseconds (1000/sec) of how long to wait before launching the function.
  setTimeout("setInterval('dd_random_img_4()',5000)",4500); //in miliseconds (1000/sec) of how long to wait before launching the function.  
}
  
function dd_build_top_images() {
  dd_random_img_1(); 
  dd_random_img_2(); 
  dd_random_img_3(); 
  dd_random_img_4();
  setTimeout('dd_init_top_image_show()',1000); //in miliseconds (1000/sec) of how long to wait before launching the function. Remember, this is all after the page loads.
}
