//set the opacity of an element to a specified value
function setOpacity(obj, o) {

    obj.style.opacity = (o / 100);
    obj.style.MozOpacity = (o / 100);
    obj.style.KhtmlOpacity = (o / 100);
    obj.style.filter = 'alpha(opacity=' + o + ')';
}


//set default values for parameters and starting image
function showBox(id, speed, pause, caption) {
    if(speed == null) {
        speed = 30;
    }
    
    if(pause == null) {
        pause = 1500;
    }

	try {
    	var box = document.getElementById(id);
	if(box != null) {
	    startFadeIn(box, speed, pause, caption);
	}
	} catch (e) {
	
	}
}

//make image a block-element and set the caption
function startFadeIn(box, speed, pause, caption) {

    box.style.display = 'block';
    continueFadeIn(box, 0, speed, pause, caption);
}



//set an increased opacity and check if the image is done blending
function continueFadeIn(box, opacity, speed, pause, caption) {

    opacity = opacity + 3;

    if (opacity < 90) {

	setTimeout(function() {fadeIn(box, opacity, speed, pause, caption)}, speed);

    } 
}

//set the opacity to a new value and continue the fading
function fadeIn(box, opacity, speed, pause, caption) {
    setOpacity(box,opacity);
    continueFadeIn(box, opacity, speed, pause, caption);
}