Not sure what you are asking, but may I suggest something a little tidier?
function fade(n, el) {
el.style.opacity = n;
n = n - 0.1;
if (n.toFixed(1) > 0) {setTimeout(function() {fade(n, el);},100);}
else {setTimeout(function() {hide(el);}, 100);}
}
function hide(el) {
el.style.visibility='hidden';
}
and then initially call
fade(0.9, document.getElementById("myDiv"));
eg: http://jsfiddle.net/XY4yM/