function changeOpacity(id, opacityStart, opacityEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacityStart > opacityEnd) {
		for(i = opacityStart; i >= opacityEnd; i--) {
		    //setTimeout(setOpacity, (timer * speed), id, i);
			setTimeout("setOpacity('" + id + "'," + i + ")", (timer * speed));
			timer++;
		}
		//set visibility hidden
		if (opacityEnd == 0)
		    setTimeout("setVisible('" + id + "', false)", (timer * speed));
	} else if(opacityStart < opacityEnd) {
	    //set visibility visible
		if (opacityEnd == 100)
		    setTimeout("setVisible('" + id + "', true)", (timer * speed));
		for(i = opacityStart; i <= opacityEnd; i++) {
			//setTimeout(setOpacity, (timer * speed), id, i);
			timer++;
			setTimeout("setOpacity('" + id + "'," + i + ")", (timer * speed));
		}
	}
}

//change the opacity for different browsers
function setOpacity(id, opacity) {
	var style = document.getElementById(id).style;
	style.opacity = (opacity / 100);
	style.MozOpacity = (opacity / 100);
	style.KhtmlOpacity = (opacity / 100);
	style.filter = "alpha(opacity=" + opacity + ")";
}

//change visibility
function setVisible(id, visible) {
    var style = document.getElementById(id).style;
    style.visibility = ((visible == true) ?  "visible" : "hidden");
}