function popupwin(thehref, win, xwidth, yheight, attrib )
        {
        //figure out the center position
        var scrW = screen.availWidth;
        var scrH = screen.availHeight;
        if (xwidth > scrW)
               {
               pW = scrW - 10;
               }
        else
               {
               pW = xwidth;
               }
        if (yheight > scrH)
               {
               pH = scrH - 40;
               }
        else
               {
               pH = yheight;
               }
        scrX = (scrW - pW - 10) * .5;
        scrY = (scrH - pH - 30) * .5; 
        
        var windowatts = "width=" + xwidth + ",height=" + yheight + ",left=" + scrX + ",top=" + scrY + ",screenX=" + scrX + ",screenY=" + scrY;
  windowatts += "," + attrib;
        window.open( thehref, win, windowatts);
        return false;
        }
        
$(document).ready(function()
        {
               
        $("a.popup").click( function()
               {
                       var address = this.href;
                       popupwin(address, '', 975, 600, 'statusbar=1,status=1,toolbar=1,scrollbars=1,resizable=1,location=1,address=1,directories=1,menubar=1' );
                       return false;
               });     
        });


