/* Made by Ben, www.ai-development.com, 2007 */

var time;
var image;

var bloom;

function charge()
{
	if(image.complete)
	{
		window.clearInterval(time);
		displayPic();
	}
}

function bloom(src)
{

	image = new Image();
	image.src = src;	
	
	document.getElementById('big').style.display = 'block';
	
	if(document.all)
	{
		document.getElementById('loading').style.left = (document.documentElement.offsetWidth/2) - (48/2)+document.documentElement.scrollLeft+'px';
		document.getElementById('loading').style.top = (document.documentElement.offsetHeight/2) - (48/2)+document.documentElement.scrollTop+'px';
		document.getElementById('bg').style.top = document.documentElement.scrollTop+'px';
	}
	else
	{
		document.getElementById('loading').style.left = (window.innerWidth - 48)*0.5+'px';
		document.getElementById('loading').style.top = ((window.innerHeight - 48)/2+window.pageYOffset)+'px';
		document.getElementById('bg').style.top = window.pageYOffset+'px';
	}
	
	time = window.setInterval("charge()",500);
}
function displayPic()
{
	document.getElementById('big').innerHTML = '<div id="bloom"><a href="#" id="img" onclick="fetch(\'big\');return false;">click to close</a><br /><img  src="'+image.src+'" alt="Click to close" onclick="fetch(\'big\')" /></div><div id="bg"></div>';
	
	document.getElementById('bloom').style.position = 'absolute';
	
	if(document.all)
	{
		document.getElementById('bloom').style.left = (document.documentElement.offsetWidth/2) - (image.width/2)+document.documentElement.scrollLeft+'px';
		document.getElementById('bloom').style.top = (document.documentElement.offsetHeight/2) - (image.height/2)+document.documentElement.scrollTop+'px';
		document.getElementById('bg').style.top = document.documentElement.scrollTop+'px';
	}
	else
	{
		document.getElementById('bloom').style.left = (window.innerWidth - image.width)*0.5+'px';
		document.getElementById('bloom').style.top = ((window.innerHeight - image.height)/2+window.pageYOffset)+'px';
		document.getElementById('bg').style.top = window.pageYOffset+'px';
	}
	document.getElementById('bloom').style.width = image.width+'px';

	upOpacity('bloom', 1);
	
	/*bloom = new opacity();
	bloom.upOpacity('bloom', 1);*/
	
}
/*
var timeOp;

function opacity()
{
	var o = 0;

	this.upOpacity = function(id, end)
	{
			timeOp = setInterval(id+'.increaseOp(\''+id +'\', '+end+')', 20);
	}
	
	this.increaseOp = function(id, end)
	{
		if(o > end)
		{
			window.clearInterval(timeOp);
			if(document.all){document.getElementById(id).filters.alpha.opacity=o*100;}
			else {document.getElementById(id).style.opacity = o;}
			o = 0;
		}
		else
		{
			o = o+0.04;
			if(document.all){document.getElementById(id).filters.alpha.opacity=o*100;}
			else {document.getElementById(id).style.opacity = o;}
		}
	}
}
*/

var o = 0;
var timeOp;

function upOpacity(id, end)
{
	timeOp = setInterval('increaseOp(\''+id+'\', '+end+')', 20);
}

function increaseOp(id, end)
{
	if(o > end)
	{
		window.clearInterval(timeOp);
		if(document.all){document.getElementById(id).filters.alpha.opacity=o*100;}
		else {document.getElementById(id).style.opacity = o;}
		o = 0;
		return true;
	}
	else
	{
		o = o+0.04;
		if(document.all){document.getElementById(id).filters.alpha.opacity=o*100;}
		else {document.getElementById(id).style.opacity = o;}
	}
}



function fetch(id)
{
	window.clearInterval(timeOp);
	document.getElementById(id).style.display = 'none';
	document.getElementById(id).style.top = '0px';
	document.getElementById(id).style.left = '0px';
	if(document.all){document.getElementById('bloom').filters.alpha.opacity=0;}
	else {document.getElementById('bloom').style.opacity = 0;}
	document.getElementById('big').innerHTML = '<img src="images/loading.gif" alt="Click to close" id="loading"/><div id="bloom"></div><div id="bg"></div>';
}















/* Made by Ben, www.ai-development.com, 2007 */

