function showPicture(strBoxId) {

	var objCover = document.getElementById("cover");
	var objImageBox = document.getElementById(strBoxId);
	
	objCover.style.display = "block";
	objImageBox.style.display = "block";
	
	opacity('cover', 0, 75, 1000);
	
	if (document.body.style.overflow = "hidden") {
	
		objCover.style.width = "100%";
		objCover.style.height = "100%";

	}

}

function closePicture(strBoxId) {

	var objCover = document.getElementById("cover");
	var objImageBox = document.getElementById(strBoxId);
	
	opacity('cover', 75, 0, 1000);

	objCover.style.display = "none";
	objImageBox.style.display = "none";
	
	document.body.style.overflowY = "scroll";

}

function changeImage(strBoxId, strFileName) {

	var objImg = document.getElementById("imageWrapper");
	
	objImg.innerHTML = '';
	
	objImg.innerHTML = '<img id="galleryImage" src="images/400/'+strFileName+'.png" />';
	
	showPicture(strBoxId);

}

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 + ")";
}