(function($){
	$.fn.popup = function() {
		var arrPoints = $.makeArray(this);
	
		return this.each(function() {
			$(this).children("div.popup").children("a.zoom").click(function(){
				$(this).zoomin({location: $(this).parent().parent().attr('id')});  
			});
			$(this).click(function(){
				if($(this).children("div.popup").hasClass("closed")){	   
					$.each(arrPoints, function(){
						popUpDiv = $(this).children("div.popup");
						if(!popUpDiv.hasClass("closed")){
							$(this).children("div.popup").fadeOut(300, function(){
								$(this).addClass("closed");
							});
						}
					});
					$(this).children("div.popup").fadeIn(300, function(){
						$(this).removeClass("closed");
					});
				}
			});
		});
	};
})(jQuery);

(function($){
	$.fn.zoomin = function(options) {
	
		var defaults = {
			location: ""
		};	
		
		var options = $.extend(defaults, options); 
		
		return this.each(function() {
			$("#zoom_"+options.location).fadeIn();
		});
	};
})(jQuery);


