// JavaScript Document
end_opacity = 50; //end opacity, 25 = 25%, 50 = 50%, 100 = 100%, etc.
increase_opacity_by = 10; //how much to increase by each time the timeout ends
timeout = 100; //timeout in miliseconds, 0 = instant fade-out

var wincontent;
var win;
var winbackground;

cur_opacity = 0;

var timer = null;

function showWindow(window_name,width,thewindow,thewindowback)
{
	
	wincontent = document.getElementById(window_name);
	win = document.getElementById(thewindow);
	winbackground = document.getElementById(thewindowback);

	yc=40;

	xc = Math.round((document.body.clientWidth/2)-(width/2));
	wincontent.style.left = xc + "px";
    wincontent.style.top  = yc + "px";
	
	winbackground.style.height = document.body.parentNode.scrollHeight + 'px';
	
	if(timeout > 0) {
		cur_opacity = 0;
	
		winbackground.style.opacity = cur_opacity / 100;
		winbackground.style.filter = "alpha(opacity=" + cur_opacity + ")";
		win.style.display = 'block';
		wincontent.style.display = 'none';
	
		timer = setTimeout("increase_opacity()",timeout);
	}
	else {
		winbackground.style.opacity = end_opacity / 100;
		winbackground.style.filter = "alpha(opacity=" + end_opacity + ")";
		win.style.display = 'block';
		wincontent.style.display = 'block';
	}
}

function increase_opacity() 
{
	
	
	
	cur_opacity += increase_opacity_by;

	winbackground.style.opacity = cur_opacity / 100;
	winbackground.style.filter = "alpha(opacity=" + cur_opacity + ")";
	
	if(cur_opacity < end_opacity) {
		timer = setTimeout('increase_opacity()',timeout);
	}
	else {
		wincontent.style.display = 'block';
	}
}

function hideWindow(thewindow)
{
	win = document.getElementById(thewindow);
	win.style.display = 'none';
}

