Fotodigitale = new Object();
Fotodigitale.baseUrl = null;

Fotodigitale.BoxTrimite = {
    afiseazaDiv : function ( div_apare, div_dispare )
    {
        $( div_dispare ).hide();
        $( div_apare ).show();
    },
    login : function ()
    {
        params = Form.serialize( 'formularBoxLogin' );
        new Ajax.Request( Fotodigitale.baseUrl + 'Clienti/login/',
                          {
                            asynchronous: false,
                            method: 'post',
                            parameters: params,
                            onSuccess: function(t) {
                                if ( t.responseText.indexOf( '<!-- success -->' ) == -1 ) {
                                    $('box_login').innerHTML = t.responseText;
                                }
                                else {
                                    document.location = Fotodigitale.baseUrl + 'Clienti/';
                                }
                           }
                          } );
    },
    trimiteParolaUitata : function ()
    {
        params = Form.serialize( 'formularRecuperareParola' );
        new Ajax.Updater( 'box_recuperare_parola',
                          Fotodigitale.baseUrl + 'Clienti/recupereazaParola/',
                          {
                            asynchronous: false,
                            method: 'post',
                            parameters: params
                           }
                         );
    }
};

Fotodigitale.PrimaPag = {
    afiseazaFaq : function ( div_faq )
    {
        $( div_faq ).show();
    },
    ascundeFaq : function ( div_faq )
    {
        $( div_faq ).hide();
    }
}

Fotodigitale.GalerieFoto = {
    afiseaza : function ( poza ) {
        $( 'galerie_poza_mare' ).src = Fotodigitale.baseUrl + 'img/' + poza;
        var windowSize = window.getSize();
        $( 'container_galerie_poza_mare' ).style.top = ( windowSize.vScroll + 50 ) + 'px';
        $( 'container_galerie_poza_mare' ).show();
    },
    ascunde : function () {
        $( 'galerie_poza_mare' ).src = Fotodigitale.baseUrl + 'img/site/ajax-loader.gif';
        $( 'container_galerie_poza_mare' ).hide();
        Fotodigitale.pozaCurenta = null;
    }
};

Fotodigitale.Servicii = {
    afiseazaDiv : function ( div_id )
    {
        $( 'fotografii' ).hide();
        $( 'developari' ).hide();
        $( 'scanari' ).hide();
        $( 'prelucrari_imagine' ).hide();
        $( 'transfer_video' ).hide();
        $( div_id ).show();
    }
}

Fotodigitale.Concurs = {
    voteaza : function ( pozaId, nota, currPage )
    {
        params = 'data%5BConcurs%5D%5BpozaId%5D=' + pozaId + '&data%5BConcurs%5D%5Bnota%5D=' + nota + '&data%5BConcurs%5D%5BcurrPage%5D=' + currPage;
        new Ajax.Updater( 'rating_' + pozaId,
                          Fotodigitale.baseUrl + 'Concurs/voteaza/',
                          { asynchronous: true,
                            method: 'post',
                            parameters: params
                          }
                        );
    },
    activeazaSteluta : function ( stelutaId, pozaId )
    {
        Fotodigitale.Concurs.coloreazaSteluta( stelutaId, pozaId, "url( '" + Fotodigitale.baseUrl + "img/site/concurs/steluta_hover.jpg' )" );
    },
    dezactiveazaSteluta : function ( stelutaId, pozaId )
    {
        Fotodigitale.Concurs.coloreazaSteluta( stelutaId, pozaId, "url( '" + Fotodigitale.baseUrl + "img/site/concurs/steluta.jpg' )" );
    },
    coloreazaSteluta : function ( stelutaId, pozaId, adresaImagine )
    {
        var a = Array();
        a[0] = 'stea_' + pozaId + '_1';
        a[1] = 'stea_' + pozaId + '_2';
        a[2] = 'stea_' + pozaId + '_3';
        a[3] = 'stea_' + pozaId + '_4';
        a[4] = 'stea_' + pozaId + '_5';

        for ( i = 0; i < 5; i++ )
        {
            $( a[i] ).style.backgroundImage = adresaImagine;
            if ( a[i] == stelutaId )
            {
                break;
            }
        }
    },
    afiseazaArhivaPoze: function( div_id )
    {
        if ( $( div_id ).style.display == 'none' )
        {
            $( div_id ).style.display = 'block';
            //new Effect.ScrollTo( div_id );
            new Element.scrollTo( div_id );
        }
        else
        {
            $( div_id ).style.display = 'none';
        }
    }
}

noSpam = function( user, domain ) {
    document.location = 'mailto:' + user + '@' + domain;
}
