//PHOTO SLIDE SHOW
// (C) 2000 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this  header
// NS4-6,IE4-6
// Fade effect only in IE; degrades gracefully

// =======================================
// set the following variables
// =======================================

// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000

// Duration of crossfade (seconds)
var crossFadeDuration = 3

// Specify the image files
var Pic = new Array() 
var Button = new Array()

//ADD ONE ARRAY MEMBER FOR EACH PHOTO IN SLIDESHOW

Pic[0] = "glmedia/home/slide/photo/1.jpg"
Pic[1] = "glmedia/home/slide/photo/2.jpg"
Pic[2] = "glmedia/home/slide/photo/3.jpg"
Pic[3] = "glmedia/home/slide/photo/4.jpg"
Pic[4] = "glmedia/home/slide/photo/5.jpg"

//ADD ONE ARRAY MEMBER FOR EACH BUTTON IN SLIDESHOW (up to 6 in array)

Button[0] = "glmedia/home/slide/photo/buttons/D0.gif"
Button[1] = "glmedia/home/slide/photo/buttons/D1.gif"
Button[2] = "glmedia/home/slide/photo/buttons/D2.gif"
Button[3] = "glmedia/home/slide/photo/buttons/D3.gif"
Button[4] = "glmedia/home/slide/photo/buttons/D4.gif"


// =======================================
// do not edit anything below this line
// =======================================

var t
var ls
var j = 0
var s = 0
var p = Pic.length

var preLoad = new Array()
var preLoadButton = new Array()

for (i = 0; i < p; i++){
   preLoad[i] = new Image()
   preLoad[i].src = Pic[i]
   preLoadButton[i] = new Image()
   preLoadButton[i].src = Button[i]
}

function runSlideShow(){

   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=2)"
      document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply()
   }
   
   document.images.SlideShow.src = preLoad[j].src


	if (document.all) {
   	  document.images.SlideShow.filters.blendTrans.Play()
   	  } 
		
	ls = j  //stores the last value of J
	s = j  //flag for swapping the last button image when show loops.
	j = j + 1  //counter
	
    if (j > (p-1)) j=0  //resets j to zero to restart the slide loop
	if (j == 1) s=p  //sets flag to the total number of photos once show loops.
	t = setTimeout('runSlideShow()', slideShowSpeed)
	
	//sets the current slide button to dark image
	var buttonNum = "slide" + (j)  
	document.getElementById(buttonNum).src = preLoadButton[ls].src 
	
	//set the last slide button to light image
	if (j == 1){
	var newNum = "slide" + 0; 
	document.getElementById(newNum).src = "glmedia/home/slide/buttons/L" + (p-1) + ".gif" 
	} else {
	var newNum = "slide" + s; 
	document.getElementById(newNum).src = "glmedia/home/slide/buttons/L" + (ls-1) + ".gif" 
	}

}

//function for the slideshow buttons

function grabImage(p) {
	var picNum = p;
	document.getElementById("SlideShow").src = "glmedia/home/slide/" + picNum + ".jpg";

}

//END PHOTO SLIDE SHOW

//AD BLOC SLIDE SHOW


var slideimages=new Array()
var slidelinks=new Array()
function slideshowimages(){
for (i=0;i<slideshowimages.arguments.length;i++){
slideimages[i]=new Image()
slideimages[i].src=slideshowimages.arguments[i]
}
}

function slideshowlinks(){
for (i=0;i<slideshowlinks.arguments.length;i++)
slidelinks[i]=slideshowlinks.arguments[i]
}

function gotoshow(){
window.location=slidelinks[whichlink]
}

/*USE THIS VERSION TO OPEN PAGES IN NEW WINDOW
function gotoshow(){
if (!window.winslide||winslide.closed)
winslide=window.open(slidelinks[whichlink])
else
window.location=slidelinks[whichlink]
winslide.focus()
}
*/

//END AD BLOC SLIDE SHOW

//even the three main column heights on home page

function sortNum(a,b) { return b-a} 

function fixH2(one,two,three) {
if (document.getElementById(one)) {
var obj=new Array(3);
var option=[one,two,three];
for(var i=0; i<option.length; i++) {
document.getElementById(option[i]).style.height="auto";
obj[i]=document.getElementById(option[i]).offsetHeight;
nh=obj.sort(sortNum);
} 
nh1=nh.splice(1,2);

for(var i=0; i<option.length; i++) {
document.getElementById(option[i]).style.height=nh+"px";

}
}
}




