window.onload = function(){
var oDiv = document.getElementById('alpha');
oDiv.onmouseover = function(){
startChange(1);
};
oDiv.onmouseoout = function(){
startChange(0.3);
};
}
var timer = null;
var alpha = 0.3;
function startChange(target){
var oDiv = document.getElementById('alpha');
clearInterval(timer);
timer = setInterval(function(){
var speed = 0;
if (alpha > target) {
speed = -0.03;
} else {
speed = 0.03;
}
if (alpha == target) {
clearInterval(timer);
} else {
alpha += speed;
oDiv.style.opacity = alpha;
}
},30)
}