$.fn.PopUpWindow = function(config){
        return this.each(function(){
                // configuration
                this.myConfig =
                {
                    // valid address you want to open
                        address: config && config.address ? config.address : null,
                        // name for the new window. Used when refering to the new windows later
                        name: config && config.name ? config.name : "PopUpWindow",
                        // width of the window
                        width: config && config.width ? Number(config.width) : 100,
                        // height of the window
                        height: config && config.height ? Number(config.height) : 100,
                        // additional parameters for the window configuration like showing the toolbar or scrollbars
                        params: config && config.params ? config.params : null
                }
                // for "A" tags. if they didn't provide an address for us, then we will
                // try to grab the link for the tag and use that
                if(this.nodeName.toLowerCase() == "a")
                {
                  // see if they gave us an address
                  if(!this.myConfig.address)
                  {
                    // try to grab the href link and use that
            this.myConfig.address = $(this).href();
                  }
                  // disable the hrefs on a tag
                    $(this).href("#");
                }
                // add the popup code to the tag's click event
                $(this).click(function()
                {
                        // build parameters
                        var params = "width=" + this.myConfig.width + ",height=" + this.myConfig.height;
                        if(this.myConfig.params != null)
                        {
                                params += "," + this.myConfig.params;
                        }
                        window.open(this.myConfig.address, this.myConfig.name, params).focus();;
                });
        });
}
