var ImageOpacity = new Array();

function link_fade_in (id) {
	if (!ImageOpacity[id]) {
		ImageOpacity[id] = 0;
	}
	link_opacity(id,ImageOpacity[id],100,75);
}

function link_fade_out (id) {
	if (ImageOpacity[id]) {
		link_opacity(id,ImageOpacity[id],0,75);
	}
	else {
		ImageOpacity[id] = 0;
	}
}

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

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("link_changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            ImageOpacity[id] = i;
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("link_changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            ImageOpacity[id] = i;
            timer++; 
        } 
    }
} 

//change the opacity for different browsers 
function link_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 + ")"; 
} 
