var preloadedimages=new Array();
for (i=0;i<photos.length;i++){
preloadedimages[i]=new Image();
preloadedimages[i].src=photos[i];
}

var which=0;
function applyeffect(){
if (document.all && photoslider.filters){
photoslider.filters.revealTrans.Transition=Math.floor(Math.random()*23);
photoslider.filters.revealTrans.stop();
photoslider.filters.revealTrans.apply();
}
}



function playeffect(){
if (document.all && photoslider.filters) {
photoslider.filters.revealTrans.play();
}
}

function forward(){
if (which<photos.length-1){
 which++;
} else {
 which=0;
}
applyeffect();
document.images.photoslider.src=photos[which];
playeffect();
}


function changepic() {
if (which<photos.length-1){
 which++;
} else {
 which=0;
}
document.images.photoslider.src=photos[which];
}

function opacity(id, opacStart, opacEnd, millisec, outfade) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
    if(outfade) {
    setTimeout("changepic()", (timer++ * speed));
    setTimeout("opacity('" + id + "', "+opacEnd+","+opacStart+","+millisec+",false)", (timer++ * speed));
    }
} 

//change the opacity for different browsers 
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 + ")"; 
}
function autochange() {
   //if (document.all && photoslider.filters) {
   //forward();
   //} else {
   opacity("photoslider",100,0,1000,true);
   //}
   setTimeout("autochange()",5000);
}
setTimeout("autochange()",5000);

