function showPopUp(clicker)
{
	var href = clicker.attr('href');

	if(!href || href == '')
		return;

	var id = clicker.attr('id');
	var widthSplit = id.split('width-');

	if(widthSplit.length != 2)
		return;

	if(typeof document.body.style.maxHeight === "undefined")
	{
		//if IE 6
		$('body','html').css( { height: '100%', width: '100%' } );
		$('html').css('overflow', 'hidden');
	}

	$('body').append('<div id="popup-overlay"></div><div id="popup-window"><div id="popup-window-close">Close</div></div>');

	$('#popup-overlay').click(function () { hidePopUpBox(href) } );
	$('#popup-window-close').click(function () { hidePopUpBox(href) } );

	$('#popup-overlay').addClass('popup-overlay-bg');

	var html = '<div class="popup-top"><div class="popup-top-middle"></div><div class="popup-top-left"></div><div class="popup-top-right"></div></div><div class="popup-left"><div class="popup-right">';
	html += '<div class="popup-inner"></div>';
	html += '</div></div>';

	html += '<div class="popup-bottom"><div class="popup-bottom-middle"></div><div class="popup-bottom-left"></div><div class="popup-bottom-right"></div></div>';

	$('#popup-window').append(html);

	// Now position according to height
	$('#popup-window').css( { marginLeft: '-' + parseInt((widthSplit[1] / 2), 10) + 'px', width: widthSplit[1] + 'px' } );

	document.onkeydown = function(e){ 	

		if(e == null)
		{
			// ie
			keycode = event.keyCode;
		}
		else
		{
			// mozilla
			keycode = e.which;
		}

		if(keycode == 27)
		{
			// close
			hideConfirmationBox(href);
		}
	};

	loadContent(href);
}

function loadContent(href)
{
	$.ajax(
			{
				url: href,
				context: document.body,
				success: function(data) 
				{
					$('.popup-inner').html(data);
					$('#popup-window').css( { display:'block' } ); //for safari using css instead of show
				}
			}
		);	
}

function hidePopUpBox(href)
{
	$("#popup-window-close").unbind("click");

	$("#popup-window").fadeOut("fast", function() { $('#popup-window, #popup-overlay').trigger("unload").unbind().remove(); } );

	if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
		$("body","html").css({height: "auto", width: "auto"});
		$("html").css("overflow","");
	}

	document.onkeydown = "";
	document.onkeyup = "";

	return false;
}
