function changeopac(opacity, id)
{
    var object = document.getElementById(id).style;
    
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
} 

function blend(divid, imageid, imagefile, millisec)
{
    var speed = Math.round(millisec / 100);
    var timer = 0;
    
    document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
    
    changeopac(0, imageid);
    
    document.getElementById(imageid).src = imagefile;

    for(i = 0; i <= 100; i++) 
    {
        setTimeout("changeopac(" + i + ",'" + imageid + "')",(timer * speed));
        timer++;
    }
} 

function opacity(id, opacStart, opacEnd, millisec) 
{
    var speed = Math.round(millisec / 100);
    var timer = 0;

    if(opacStart > opacEnd) 
    {
        for(i = opacStart; i >= opacEnd; i--) 
        {
            setTimeout("changeopac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } 
    else if(opacStart < opacEnd) 
    {
        for(i = opacStart; i <= opacEnd; i++)
        {
            setTimeout("changeopac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
} 