var blend_interval = 4200;
var blend_speed = 3600;

function blendimages()
{
	blendimage('main_image_container', 'main_image', heads[head_idx], blend_speed);
	if( head_idx+1 < heads.length )
		head_idx++;
	else
		head_idx = 0;	
}
function blendimage(divid, imageid, imagefile, millisec) {
    var speed = Math.round(millisec / 100);
    var timer = 0;
    
    _eid(divid).style.backgroundImage = "url(" + _eid(imageid).src + ")";
    changeOpac(0, imageid);
    _eid(imageid).src = imagefile;
    for(i = 0; i <= 100; i+=2) {
        setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
        timer++;
    }
} 
function changeOpac(opacity, id) 
{
    var object = _eid(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}