function showLB(imageUrl,width,height) {
	if (isInt(imageUrl)) {
		pid = imageUrl;
		if (!width) width = 600;
		if (!height) height = 500;
		imageUrl = "showPhoto.php?pid=" + imageUrl + "&width="+width+"&height="+height;
	}
	imageUrl += "&random=" + Math.round(100*Math.random());
	
	$("#lightbox").show();
	$("#lightbox").html("<div id=loading><img src=miscpics/icons/loadingtrans.gif></div>");
	
	half = Math.floor(($("body").width() - $("#lightbox").width()) / 2);
	
	$("#lightbox").css({"left" : half});
	$("#lightbox").css({"top" : (document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + 100});
	$("#blackoverlay").show();
	$("#blackoverlay").height($("body").height());
	
	newPhoto = new Image();
	newPhoto.src = imageUrl;	
	newPhoto.onload = function() {
		half = Math.floor(($("body").width() - this.width) / 2);
		newTop = (document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + 100;
		$("#lightbox").css({"left" : half});
		$("#lightbox").css({"top" : newTop});
		$("#lightbox").width(this.width);
		$("#lightbox").html("");
		$("#lightbox").append(this);
		$("#lightbox").append("<div id=\"closeButton\"></div>");
		loadLbData(pid);
	}
}

function loadLbData(pid) {
	$("#closeButton").load("includes/getLbData.php", {pid: pid});
}

function hideLB() {
	$("#lightbox").hide();
	$("#blackoverlay").hide();
}

