(function($){

    var defaults =
    {
      baseurl : 'index.php?tmpl=imgbig',
      width:  700,
      height: 500
    };

    function initPlugin(o,params)
    {
        params = $.extend({},defaults,params);
        o.css('cursor','pointer');
        o.click(function(e){
            e.stopPropagation();
           var newwindow = window.open(params.baseurl+'&img='+params.src+'&title='+params.title, 'imgPopup', 'scrollbars=yes,top=20,left=20,width='+params.width+',height='+params.height);
           if (window.focus) {newwindow.focus()}
           return false;
        });
    }
    
    $.fn.largeimg = function(){
        
        return this.each(function(){
           var _this = $(this);
           var p = {};
           p.src = _this.attr('src');
           if((typeof(p.src)=='string') && p.src.length>0)
           {
            p.title = _this.attr('title');            
            initPlugin(_this,p);
           }
        });
    }
    
})(jQuery);
