var Color;
var where = 0;
function initFade(obj) {
var r, g, b;
if (obj.className == 'row1')
{
r = 251;
g = 253;
b = 234;
}
else if (obj.className == 'row2')
{
r = 251;
g = 243;
b = 218;
}
Color= new Array(8);
for (var i = 0; i < 8; i++)
{
color = new RGBColor("rgb("+ r +", "+g+", "+ b +")");
Color[i] = color.toHex();
r -= 10;
g -= 10;
b -= 10;
}
}
function fadeIn(obj) {
if (where <= Color.length) {
obj.style.backgroundColor=Color[where];
where += 1;
setTimeout(function () { fadeIn(obj) }, 50);
} else {
setTimeout(function () { fadeOut(obj) }, 50);
}
}
function fadeOut(obj) {
if (where >= 0) {
obj.style.backgroundColor=Color[where];
where -= 1;
setTimeout(function () { fadeOut(obj) }, 50)
}
}