    function setCurrentGallery( CurrId ) {
        var spans = document.getElementsByTagName("span");

        for (var i=0;i<spans.length;i++) {
            if( /row_[0-9]+/.test(spans[i].id) )
                document.getElementById(spans[i].id).style.fontWeight = 'normal';
        }

        if( document.getElementById('row_'+CurrId) )
        document.getElementById('row_'+CurrId).style.fontWeight = 'bold';

    }

    function showGalleryFotos( idGallery, page ) {
        setCurrentGallery( idGallery );
        document.getElementById('showGalleryFotosId').innerHTML = AjaxLoadingImg;
        ajaxObj.call('action=foto,showGalleryFotos&idGallery='+idGallery+'&page='+page, showResultsGalleryFotos);
    }

    function showResultsGalleryFotos(resp) {
        document.getElementById('showGalleryFotosId').innerHTML = toPL(switchDecode64(resp.content));
        Window.onDomReady(MOOdalBox.init.bind(MOOdalBox));
    }    function showFoto( idFoto ) {
        ajaxObj.format = "TEXT";
        document.getElementById('showFotoId').innerHTML = AjaxLoadingImg;
        ajaxObj.call('action=foto,showFoto&idFoto='+idFoto, showResultsFoto);
    }

    function showResultsFoto(resp) {
        //ajaxObj.format = "JSON";
        //document.getElementById('showFotoId').innerHTML = toPL(switchDecode64(resp));
        //document.getElementById('showFotoId').style.display = 'inline';
    }

    function CloseResultsFoto() {
        document.getElementById('showFotoId').style.display = 'none';
    }

    function FotoFormComment( id ) {
        var aFromVars = ajaxObj.getForm(id);
        ajaxObj.call('action=foto,addComment'+aFromVars, FotoFormCommentResult);
    }

    function FotoFormCommentResult(resp) {
        showFoto( resp.idFoto );
    }
