function T_User_Img_GoToPage(page, pages)
{
    page = parseInt(page);
    if (page > pages) page = pages;
    if (page < 1 || !page) page = 1;
    window.location = this.getUrl('', '') + '&pgnum=' + page;         
} 

function T_User_Img_LargePhoto(id, comment)
{
    if (!id) id = this.curId; 
    PopUp(this.getUrl(id, 'details') + (comment?'&comment=1':''), 580, 580, 0, 1);        
}

function T_User_Img_Slideshow(id)
{
    if (!id) id = this.curId; 
    window.open(this.getUrl(id, 'slideshow'),'','fullscreen=1,scrollbars=0,toolbar=0')         
}

function T_User_Img_AlbumDescr()
{
    PopUp(this.getUrl(this.curId, 'albumdescr'), 380, 380, 0, 1);
}

function T_User_Img_RunSlideShow()
{
    this.slideshow(this.firstImage);      
}

function T_User_Img_ToBasket()
{
    PopUp(this.getUrl(this.curId, 'tobasket'), 380, 380, 0, 1);
}

function T_User_Img_AlbumToBasket()
{
    PopUp(this.getUrl(this.firstImage, 'albumtobasket'), 380, 380, 0, 1); 
}

    
function T_User_Img_Download()
{
    PopUp(this.getUrl(this.curId, 'download'), 380, 380, 0, 1);
}

function T_User_Img_Links()
{
    PopUp(this.getUrl(this.curId, 'links'), 500, 380, 0, 0);
}

function T_User_Img_CurId(id)
{
    this.curId = id;
}

function T_User_Img_GetUrl(id, page)
{
    var str = '';
    
    
    str = this.url.replace('_id_', id);
    if (page)
        str = str.replace('_url_', page);
    else
        str = str.replace('/_url_', page);
    
    
    return str;        
}


function T_User_Img(firstimage, url)
{
    
    this.type       = 'photolist';
    this.firstImage = firstimage;
    this.url        = url.replace(/\|/g, "/");
    this.curId      = 0;
    this.setCurId   = T_User_Img_CurId;
    this.download   = T_User_Img_Download;
    this.tobasket   = T_User_Img_ToBasket;
    this.largephoto = T_User_Img_LargePhoto;
    this.slideshow  = T_User_Img_Slideshow;
    this.openpage   = T_User_Img_GoToPage;
    this.runslideshow = T_User_Img_RunSlideShow;
    this.albumtobasket= T_User_Img_AlbumToBasket;
    this.getUrl     = T_User_Img_GetUrl;
    this.links      = T_User_Img_Links;
    this.albumdescr = T_User_Img_AlbumDescr; 
} 
