// (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 = 7000

// Duration of crossfade (seconds)
var crossFadeDuration = 3

// Specify the image files
var Pic = new Array() // don't touch this
// to add more images, just continue
// the pattern, adding to the array below

Pic[0] = 'images/billboard/billboard1.jpg';
Pic[1] = 'images/billboard/billboard2.jpg';
Pic[2] = 'images/billboard/billboard3.jpg';
Pic[3] = 'images/billboard/billboard4.jpg';

// likewise, if more images are added, 
// add more url to link to when image is clicked
var url;
var Urls = new Array()
Urls[0] = "http://www.kckps.org/schools/";
Urls[1] = "http://www.kckps.org/students/";
Urls[2] = "http://www.kckps.org/parents/";
Urls[3] = "http://www.kckps.org/community/";

// =======================================
// do not edit anything below this line
// =======================================

var t
var j = 0
var p = Pic.length

var preLoad = new Array()
for (i = 0; i < p; i++){
   preLoad[i] = new Image()
   preLoad[i].src = Pic[i]
}

function runSlideShow(){
   if (document.all){
      document.images.blendimage.style.filter="blendTrans(duration=2)"
      document.images.blendimage.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.blendimage.filters.blendTrans.Apply()      
   }
   document.images.blendimage.src = preLoad[j].src
   if (document.all){
      document.images.blendimage.filters.blendTrans.Play()
   }
   j = j + 1
   if (j > (p-1)) j=0
   t = setTimeout('runSlideShow()', slideShowSpeed)
}

function slideShow() {
    var millisec = 700;
	var speed = Math.round(millisec / 100); 
    var timer = 0; 
    var divid = 'blenddiv';
	var imageid = 'blendimage';
	var imagefile = Pic[j];
	
    //set the current image as background 
    document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")"; 
    
    //make image transparent 
    startfade = (saf)?0:0;
    changeOpac(startfade, imageid); 
	
	//make new image 
    setTimeout("swapImage('" + imageid + "', '" + imagefile + "')", 0);
	
    //fade in image
	for(i = startfade; i <= 100; i++) { 
        setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed)); 
        timer++; 
    }
	
	url = Urls[j];
	
	j = j + 1
	if (j > (p-1)) j=0
	t = setTimeout('slideShow()', slideShowSpeed);
} 

function changeOpac(opacity, id) {
	var object = document.getElementById(id).style; 
	object.opacity = (opacity / 100); 
	object.MozOpacity = (opacity / 100); 
	object.KhtmlOpacity = (opacity / 100); 
	object.filter = "alpha(opacity=" + opacity + ")";
	return true;
}

function billboardLink(){
	window.location.href = url;
}

function swapImage(imageid, imagefile){
	document.getElementById(imageid).src = imagefile;
}