function ilDisplay(sTitle, sMessage, iW, iH, iT, iL, bFade)
{
	if (!iW) {
		iW = 300;
	}
	if (!iH) {
		iH = 200;
	}

	$('#ilInline, #ilInlineBG').remove();
	if (!$('#ilInline').length)
	{
		$('body').prepend('<div id="ilInline"><div class="ilTitle"><div class="ilClose"></div><div class="ilTitleText">'+sTitle+'</div></div><div class="ilContent">'+sMessage+'</div></div>');
		$('#ilInline .ilTitle .ilClose').click(function(){
			$('#ilInlineBG').fadeOut();
			$('#ilInline').slideUp();
			return false;
		});
	}
	if (!$('#ilInlineBG').length)
	{
		$('body').prepend('<div id="ilInlineBG"></div>');
		$('#ilInlineBG').css('margin-top', '-'+$('body').css('margin-top')).css('margin-left', '-'+$('body').css('margin-left'));
	}

	$('#ilInline').width(iW + (parseInt($('#ilInline .ilContent').css('padding').replace(/px$/, '')) * 2)).height(iH + (parseInt($('#ilInline .ilContent').css('padding').replace(/px$/, '')) * 2) + (parseInt($('#ilInline .ilTitle').css('height').replace(/px$/, ''))));
	$('#ilInline .ilContent').width(parseInt(iW)).height(parseInt(iH));
	if (!iT) {
		iT = ($(window).height() / 2) - (iH / 2) - ($('#ilInline .ilTitle').height() / 2);
	}
	if (!iL)
	{
		iL = ($(window).width() / 2) - (iW / 2);
	}
	iT = Math.round(iT);
	iL = Math.round(iL);
	if (bFade)
	{
		if ($.browser.msie) {
			$('#ilInlineBG').fadeIn(function() {
				$(this).css('filter','alpha(opacity='+$(this).css('alpha')+')');
			});
		}
		else {
			$('#ilInlineBG').fadeIn();
		}
	}
	$('#ilInline').css({
		'top':iT+'px',
		'left':iL+'px'
	}).slideDown();
	return false;
}

function _hookPopUps()
{
	$('*[popup]').unbind('click').click(function(){
		link = this;
		eval("popup = {"+$(link).attr('popup')+"};");
		if (!popup.image)
		{
			alert('No image specified for the popup.');
		}
		else
		{
			$('body').prepend('<div id="ilImage" style="position: absolute; width: 0px; height: 0px; over-flow: hidden; margin-top: -5px;"><img src="'+popup.image+'"/></div>');
			$('#ilImage img').load(function() {
				popup.width = $(this).width();
				popup.height = $(this).height();
				$('#ilImage').remove();
				ilDisplay(popup.title, '<img src="'+popup.image+'" width="'+(popup.width)+'" height="'+(popup.height)+'"/>', popup.width, popup.height, popup.top, popup.left, popup.fade);
			});
		}
		return false;
	});
}


$(document).ready(function(){
	_hookPopUps();
})
