$(document).ready(
	function() {
		var f = $("#fadebox").hide();
		var fh = $("#fadebox .holder").hide();
		var vis = false;
		$("*[rel^=poptoggle]").each(
			function() {
				var id = $(this).attr("rel");
				var reg = /poptoggle\[(.+)\]/i;
				id = id.replace(reg, "$1");
				this.disp = $(id);
				$(this).click(
					function(e) {
						if(!vis) {
							$(".content", f).each(
								function() {
									$(this).hide();
								}
							);
							this.disp.show();
							f.slideDown("slow", 
								function() {
									fh.fadeIn("slow", 
										function() {
											vis = true;
										}
									);
								}
							);
						}
						else {
							fh.fadeOut("slow", 
								function() {
									f.slideUp("slow", 
										function(){
											vis = false;
										}
									);
								}
							);
						}
						return false;
					}
				);
			}
		);
	}
);
