window.onload = function() {
var oBtn = document.getElementById('go');
var oBtn2 = document.getElementById('go2');
var t = null;
var alpha = 0;
var bShow = true;
var ray = '';
ray = setInterval(function() {
if (bShow) {
rayMove(100);
} else {
rayMove(0);
}
bShow = !bShow;
function rayMove(iTarget) {
if (t) clearInterval(t);
t = setInterval(function() {
doMove(iTarget);
}, 30);
}
function doMove(iTarget) {
var iSpeed = 0;
if (alpha < iTarget) {
iSpeed = 2;
} else {
iSpeed = -2;
}
alpha += iSpeed;
oBtn2.style.filter = "alpha(opacity:" + alpha + ")";
oBtn2.style.opacity = alpha / 100;
}
}, 2000);
oBtn2.onmouseover = function() {
clearInterval(ray);
}
oBtn2.onmouseout = function() {
ray = setInterval(function() {
if (bShow) {
rayMove(100);
} else {
rayMove(0);
}
bShow = !bShow;
function rayMove(iTarget) {
if (t) clearInterval(t);
t = setInterval(function() {
doMove(iTarget);
}, 30);
}
function doMove(iTarget) {
var iSpeed = 0;
if (alpha < iTarget) {
iSpeed = 2;
} else {
iSpeed = -2;
}
alpha += iSpeed;
oBtn2.style.filter = "alpha(opacity:" + alpha + ")";
oBtn2.style.opacity = alpha / 100;
}
}, 2000);
}
}