jQuery.fn.PopUpWindow = function() {
	return this.each( function(index) {
		var setting, href, parameters, newwindow, a, b, c;
		a = this.href.split(",");
		href = this.href;
		settings = {
			height :600, // height of window
			width :800, // width of window
			toolbar :false, // should we show the toolbar {true,false}
			scrollbars :1	// should we show the scollbars {0,1}
		}; // end settings

			// overrides the settings with parameter passed in using the rel
			// tag.
			for ( var i = 0; i < a.length; i++) {
				b = a[i].split(":");
				if (typeof settings[b[0]] != "undefined" && b.length == 2) {
					settings[b[0]] = b[1];
				}
			} // end for

			parameters =  "resizable=1, height=" + settings.height + ",width="
					+ settings.width + ",toolbar=" + settings.toolbar
					+ ",scrollbars=" + settings.scrollbars;

			jQuery(this).bind("click", function() {
				var name = "PopUpWindow" + index;
				window.open(href, name, parameters).focus();
				return false;
			});
		});
};
