function show_gallerylist(){
    str='';
    for(i=0;i<list.length;i++)
        str+=list[i];
    document.getElementById('gallerylist').innerHTML=str;
}
function show_galleries(page){
    show_gallerylist();
    //str='';
    //max_galleries_page=1;
    //if (max_galeries_page<=list.length) max=max_galeries_page;
    //else max=list.length;
    //for(i=page-1;i<max*page;i++)
    //    str+=list[i];
    //document.getElementById('gallerylist').innerHTML=str;
}

var startphoto;
var endphoto;
function show_photoes(page){
    max_photoes_page=15;
    if (max_photoes_page<=photoes.length) max=max_photoes_page;
    else max=photoes.length;
    str='';
    startphoto=max*(page-1);
    endphoto=max*page;
    for(i=startphoto;i<endphoto;i++){
        if (!isNaN(photoes[i])){
            j=i;
            str+='<div id="'+i+'" class="photo_1" onclick="showPhoto(this)" photo_id="'+photoes[i]["big"]+'"><img src="'+photoes[i]["small"]+'"></div>';
        }
    }
    endphoto=j+1;
    document.getElementById("photos_container").innerHTML=str;
    pages=Math.ceil(photoes.length/max_photoes_page);
    if (pages>1)
        show_pages(max_photoes_page,photoes.length,page);
    showPhoto(document.getElementById(startphoto));
}
function show_photoes_invite(page){
    max_photoes_page=15;
    if (max_photoes_page<=photoes.length) max=max_photoes_page;
    else max=photoes.length;
    str='';
    startphoto=max*(page-1);
    endphoto=max*page;
    for(i=page-1;i<max*page;i++)
        str+='<div id="'+i+'" class="photo_1" onclick="showPhotoInvite(this)" photo_id="'+photoes[i]["big"]+'" id="'+i+'"><img src="'+photoes[i]["small"]+'"></div>';
    document.getElementById("photos_container").innerHTML=str;
    pages=Math.ceil(photoes.length/max_photoes_page);
    if (pages>1)
        show_pages(max_photoes_page,photoes.length,page);
    showPhotoInvite(document.getElementById(startphoto));
}
function show_pages(photoes_page,photoes,curr_page){
    pages=Math.ceil(photoes/photoes_page);
    str='<table width="7%" cellpadding="0" cellspacing="0" class="paging_1"><tr>';
    for(i=0;i<pages;i++){
        curr=i+1;
        if (curr==curr_page)
            str+='<td><div class="active">'+curr+'</div></td>';    
        else
            str+='<td><div><a href="javascript:show_photoes('+curr+')" class="small_2">'+curr+'</a></div></td>';
    }
    str+='</tr></table>';
    document.getElementById("photoes_pages").innerHTML=str;
}

