// JavaScript Document

function changePresImg(url){
	curImg = document.getElementById('presentation_img');
	
		curImg.style.filter = 'alpha(opacity=0)';
		curImg.style.opacity = 0;
		curImg.src = url;
		
		fade(curImg);
}

function fade(){
	
	//Have browser check for 'opacity'/'filter' here.
	
	
	//An important thing to note is in what scope these strings are evaluated. 
	//They are evaluated in the global scope, so any variables or functions not accessible 
	//from the global scope will be undefined when the time comes for the string to be executed. 
	
	curImg.style.opacity = Number(curImg.style.opacity) + 0.02;
	curImg.style.filter = 'alpha(opacity='+(Number(curImg.style.opacity)*100)+')';
	
	if(curImg.style.opacity >= 1){
		
		return;
		
	}
	
	//When set this way img is not defined in line 41
	//Problem: The img variable refered to here emanates from the window object. And there is obviously
	//No img definition in the window object, hence: undefined.
	setTimeout("fade()", 15);
	
}
