function Photo(_self, width, height, alt){
    this.self = _self;
    this.width = width;
    this.height = height;
    
    this.setHeight = function(height){
        this.height = height;
    };
    
    this.setWidth = function(width){
        this.width = width;
    };
    
    this.setSelf = function(self){
        this.self = self;
    };
    
    this.setHost = function(host){
        this.host = host;
    };
    
    this.setAlt = function(alt){
        this.alt = alt;
    };
    
    this.CL = function(){
        this.self.innerHTML = '';
    };
    
    this.SI = function(method, src, width, height, width_){
        var src1 = '', src2 = '';
        var jpg = /\.jpg/, JPG = /\.JPG/, gif = /\.GIF/, GIF = /\.GIF/;
        if(jpg.test(src)){
            src1 = src.replace(jpg, '');
            src2 = '.jpg';
        }
        if(JPG.test(src)){
            src1 = src.replace(JPG, '');
            src2 = '.JPG';
        }
        if(gif.test(src)){
            src1 = src.replace(gif, '');
            src2 = '.gif';
        }
        if(GIF.test(src)){
            src1 = src.replace(GIF, '');
            src2 = '.GIF';
        }
        width_sm = this.width;
        if(width_ != undefined)
            width_sm = width_;
        
        var imag = "<a href=\"javascript:PP('" + src1 + src2 + "'," + width + ", " + height + ");\"><img src=\"" + src1 + '_sm' + src2 + "\"" +
            " width=\"" + width_sm + "\" border=\"0\" alt='Увеличить' style='margin-bottom: 4px;'></a><br>\n";
        if(method == 'w'){
            this.self.write(imag);
        }
        else{
            var a = this.host.createElement("a");
                a.setAttribute("href", "javascript:PP('" + src1 + src2 + "'," + width + ", " + height + ");");
                a.innerHTML = "<img src=\"" + src1 + '_sm' + src2 + "\"" +
                              " width=\"" + width_sm + "\" border=\"0\" alt='Увеличить' style='margin-bottom: 4px;'>";
          
            this.self.appendChild(a);
        }
    };
};

var gallery = new Photo();