var lightbox = {
    swfupload : false,
    imagePath: sRemoteServer + 'images/',
    thumbPath: sRemoteServer + 'images/th/',
    lightboxPath: sRemoteServer + 'gfx/lightbox/',
    init : function() {
        var self = this;
        $('div.col1 a.lightbox').lightBox({
            imageLoading: self.lightboxPath+'loading.gif',
            imageBtnClose: self.lightboxPath+'close.gif',
            imageBtnPrev: self.lightboxPath+'prev.gif',
            imageBtnNext: self.lightboxPath+'next.gif'
        });
        $('a.lightbox').animate({
            "opacity": 0.8
        });
        $('a.lightbox').mouseover(function() {
            $(this).animate({
            "opacity": 1.5
            });
        });
        $('a.lightbox').mouseout(function() {
            $(this).animate({
            "opacity": 0.8
            });
        });
    }
}

var fc = {
    formId: 'contact-form',
    init: function() {
        var self = this;
        $('#fc-submit').click(function() { 
            if (FormValidation.string('fc-subject')) {
                if (FormValidation.email('fc-email')) {
                    if (FormValidation.string('fc-message')) {
                        Ui.layerBlock(self.formId, t('Wysyłanie wiadomości...'));
                        var json = Ui.collect(self.formId, 'name');
                        $.post(sRemoteServer, {
                            request: 'fc/send', json : json
                        }, function(output) {
                           if (obj = JSHelper.eval(output)) {
                               if (obj.result) {
                                   $('#fc-subject').val('');
                                   $('#fc-email').val('');
                                   $('#fc-message').val('');
                                   $('#fc-container').html('<p>'+obj.message+'</p>');
                               } else {
                                   alert(obj.message);
                               }
                           }
                           Ui.layerUnblock(self.formId);
                           return false;
                        });
                    } else alert(t('Wpisz treść wiadomości.'));
                } else alert(t('Podaj swój adres e-mail.'));
            } else alert(t('Temat wiadomości jest wymagany.'));
            return false;
        });
    }
}

$(document).ready(function() {

    lightbox.init();
    fc.init();
    
    $('.box-container-top').animate({
        opacity: 1,
        top: '+=110',
        height: 'toggle'
      }, {
        duration: 1500,
        easing: 'linear',
        complete: function() {}
    });

});

