// JavaScript Document

// Photo blending - courtesy of http://brainerror.net/scripts/javascript/blendtrans/


//change the opacity for different browsers 
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 + ")"; 
	
	//if( opacity > target )
//		setTimeout("changeOpac(" + (opacity+1) + ", " + target +  ", " + speed +  ", '" + imageid + "')",speed); 		
//	if( opacity < target )
//		setTimeout("changeOpac(" + (opacity-1) + ", " + target ", " + speed + ", '" + imageid + "')",speed); 		


} 

function blendimage(divid, imageid, imagefile, millisec) { 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 
     
    //set the current image as background 
    document.getElementById(divid).style.backgroundImage = document.getElementById(imageid).style.backgroundImage;
     
    //make image transparent 
    changeOpac(0, imageid); 
     
    //make new image 
    document.getElementById(imageid).style.backgroundImage = "url(" + imagefile + ")";  

    //fade in image 
    for(i = 0; i <= 100; i++) { 
		//alert("changeOpac(" + i + ",'" + imageid + "')      " + (timer * speed));
        setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed)); 
        timer++; 
    } 
} 
