﻿
function MoveNext(currentId,totalId,pagerResultId)
{
    total = $('#'+totalId).val()*1;
    current = $('#'+currentId).val()*1;
    
    if (current+1<total)
    {
        newpos = current+1;            
        $('#TCPicture'+current).hide();
        $('#TCPicture'+newpos).show(); 
        $('#'+currentId).val(newpos);   
        $('#'+pagerResultId).html('Zdjęcie '+(newpos+1)+' z '+total);
        
        CopyGallery();
    }              
}

function MovePrev(currentId,totalId,pagerResultId)
{
    total = $('#'+totalId).val()*1;
    current = $('#'+currentId).val()*1;
    
    if (current>0)
    {
        newpos = current-1; 
        $('#TCPicture'+current).hide();
        $('#TCPicture'+newpos).show();        
        $('#'+currentId).val(newpos);
        $('#'+pagerResultId).html('Zdjęcie '+current+' z '+total);
        
        CopyGallery();
    }        
}

function CopyGallery()
{
    CopyHtml('divSource',new Array('divTarget1','divTarget2','divTarget3','divTarget4'));
}

// Kopiuje html obiektu źródłowego do obiektów docelowych
function CopyHtml(sourceId, targetIds)
{
    var galleryHtml = $('#'+sourceId).html();
    for(i=0;i<targetIds.length;i++)
    {        
        $('#'+targetIds[i]).html(galleryHtml);        
    }
}