jQuery.fn.popupwindow = function(p) { var profiles = p || {}; return this.each(function(index){ var settings, parameters, mysettings, b, a; mysettings = (jQuery(this).attr("rel") || "").split(","); settings = { height:400, width:600, toolbar:1, scrollbars:1, status:1, resizable:1, left:0, top:0, center:1, createnew:0, location:1, menubar:1 }; if(mysettings.length == 1 && mysettings[0].split(":").length == 1) { a = mysettings[0]; if(typeof profiles[a] != "undefined") { settings = jQuery.extend(settings, profiles[a]); } } else { for(var i=0; i < mysettings.length; i++) { b = mysettings[i].split(":"); if(typeof settings[b[0]] != "undefined" && b.length == 2) { settings[b[0]] = b[1]; } } } if (settings.center == 1) { settings.top = (screen.height-(settings.height + 110))/2; settings.left = (screen.width-settings.width)/2; } parameters = "location=" + settings.location + ",menubar=" + settings.menubar + ",height=" + settings.height + ",width=" + settings.width + ",toolbar=" + settings.toolbar + ",scrollbars=" + settings.scrollbars + ",status=" + settings.status + ",resizable=" + settings.resizable + ",left=" + settings.left + ",screenX=" + settings.left + ",top=" + settings.top + ",screenY=" + settings.top; jQuery(this).bind("click", function(){ var name = settings.createnew ? "PopUpWindow" + index : "PopUpWindow"; window.open(this.href, name, parameters).focus(); return false; }); }); };
var profiles = { basic: { }, terms: { toolbar: 0, status: 0, location: 0, menubar: 0 } }; 

