So many excellent Javascript developers have written animation functions, you'd really do yourself a favor (and your viewers) to use theirs. People are suggesting jQuery, which is great. MooTools is another great alternative.
However, if you want a nudge in a direction of how to write animation in Javascript, I cooked something up here real fast. Note that there's been no cross-browser testing, I'm sure it doesn't work in IE6 (IE7 even?). Nor would I want to, I appreciate the code others have already tested for me.
This is just an idea of how you could do so with native Javascript:
function fadeIn(el, speed) {
el.style.opacity = 0;
var interval = setInterval(function(){
el.style.opacity = parseFloat(el.style.opacity) + 0.1;
if(el.style.opacity == 1.0) {
clearInterval(interval);
}
},speed / 10);
}