// JavaScript Document

function fadeInObject(id) {	
	var obj = document.getElementById(id);
	var current = parseInt(obj.style.opacity*100);

	if (current < 100) {
		var step = 10;
		if (current + step > 100) {
			current = 100;	
		}
		else {
			current += step;
		}
		obj.style.opacity = current/100;
		obj.style.filter = "alpha(opacity="+current+")";
		
		fadeTimer = setTimeout("imagePortFadeIn('"+id+"')", 20);
	}
	else {
		fadeTimer = "";
	}	
}


function fadeOutObject(id, img) {	
	var obj = document.getElementById(id);
	var current = parseInt(obj.style.opacity*100);

	if (current > 0) {
		var step = 10;
		if (current - step < 0) {
			current = 0;	
		}
		else {
			current -= step;
		}
		obj.style.opacity = current/100;
		obj.style.filter = "alpha(opacity="+current+")";
		
		fadeTimer = setTimeout("fadeOutObject('"+id+"', '"+img+"')", 20);
	}
	else {
		
		var div = document.createElement("img");
		div.style.cssFloat = "left";
		div.style.styleFloat = "left";
		div.style.margin = "5px";
		div.id = "big_img";
		div.src = path+"resize/news_default.php?img="+img;
		
		document.getElementById("big_img_cont").innerHTML = "";
		document.getElementById("big_img_cont").appendChild(div);
		div.onload = function () {
			resizeToFit();
			fadeInObject("big_img_cont");
		}
		
	}	
}


