$(document).ready(function(){
		//Create our overlay object
			var overlay = $('<div id="overlay"></div>');
			
			var popupWindow = $('<div id="popupWindow"></div>');
			
			$('a.target').bind('click',function(evt) {
			if (typeof document.body.style.maxHeight === "undefined") { //for IE 6
						$("body","html").css({height: "100%", width: "100%"});
						$("html").css("overflow","hidden");
					}
			$("body").append(overlay.click(function() { overlayHide(); }))	
				
			overlay.css({"opacity": 0.8, display: 'block'});
			evt.preventDefault();
			
			//Load the image
			var img = new Image();
			$(img).load(function() {
			var imageWidth = img.width/2 ;
			var imageHeight = img.height/2;
			popupWindow.css({"marginLeft": -imageWidth,"marginTop": -imageHeight});	
			popupWindow.append(img);
			//$(this).addClass("modal-image");
			$("body").append(popupWindow);
			popupWindow.fadeIn(1000);
			}).attr({ src: this.href }).click(function() { overlayHide();});
			
			}); //end click
			
			function overlayHide() {
				var remove = function() { $(this).remove(); };
				overlay.fadeOut(remove);
				popupWindow.fadeOut(remove).empty();
			} // end Hide
  }); //end ready
