$(document).ready(
    function(){
        $("a.popup").click(function(){
               popup($(this));
               return false;
        });
    }
);

function popup(elm,params){
     var pop;
     
     var url = elm.attr("href");
     
     // if url is image, use the auto-resizing image popup pages
     if (/(gif)|(jpe?g)|(png)/.test(url)){
         url = "/scripts/imagepopup.html?img="+escape(url);
     } 
     
     if (( params==null )||( params=='' )) {
         params='width=640,height=520,resizable=yes,titlebar=yes';
     }
 
     if (navigator.appName.indexOf('Netscape') != -1) {
         pop = window.open(url,'popup',params);
     } else {
         pop = window.open("",'popup',params);
     }
     
     if (pop.location) { pop.location = url }; // IE workaround
     if (pop.opener == null) { pop.opener = self }; // ditto
     
     pop.focus();
}

