<!--

n = 0;
t = 0;

posi =5;

function pausecomp(millis) {
    var date = new Date();
    var curDate = null;

    do { curDate = new Date(); }
    while(curDate-date < millis);
} 

function opacity(id, opacStart, opacEnd, millisec) {
    //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++;
        }
    }
}

//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 shiftOpacity(id, millisec) {
    //if an element is invisible, make it visible, else make it ivisible
    if(document.getElementById(id).style.opacity == 0) {
        opacity(id, 0, 100, millisec);
    } else {
        opacity(id, 100, 0, millisec);
    }
} 

function blendimage(divid, imagefile, millisec) {
    var speed = Math.round(millisec / 100);
    var timer = 0;
    			
    //set the current image as background
    //document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";

	//make image transparent
    
    //make new image
    //document.getElementById(divid).src = imagefile1;	
	
    //fade in image
    for(i = 0; i <= 100; i++) {
        setTimeout("changeOpac(" + i + ",'" + divid + "')",(timer * speed));
        timer++;
	}
		
	changeOpac(0, divid);
	//document.getElementById(divid).style.backgroundImage = "url(" + imagefile + ")";
	document.images[divid].src = imagefile;
}

function startSS(){
	t = setTimeout("runSS(" + posi + ")", 1 * 1);
}

function runSS(n){
	n++;
	if(n >= SLIDES.length){
		n = 0;
	}
					
 	blendimage('stage', S[n].src, 1000);
	

	posi = n;
		
	document.getElementById("view_gallery").href = SLIDES[n][1];
    
	//f.wichIm[n].selected = true;
	t = setTimeout("runSS(" + posi + ")", display * 1000);
}


// -->

