var Popup = function($){

	function btnClose(obj){
		obj.click(function(){
			$(this).parent().hide();
			return false;
		});
	};

	return {

		init : function(linkClassName, layerClassName, btnObj)
		{
			$('.' + layerClassName).hide();  //hide the floater
			//the image should show itself once it loads
			$('#imgviewer').load(function(){
				$('#imgloader').hide();
				$(this).show();
				return false;
			});

			$('.' + linkClassName).click(function(){
				var largeimg = $(this).children('input').val();
				$('.' + layerClassName).show();
				$('#imgviewer').hide();
				$('#imgloader').show();
				$('#imgviewer').attr('src', 'upload_pic/medium/'+largeimg);
				return false;
			});
			
			btnClose(btnObj); //bind close button event
		}
	};
}(jQuery);
