
var ff='';

function logowanie_test() {

    var login=$('#login').val();
    var password=$('#password').val();

    if (login.replace(/\s/g,"")=='' || password.replace(/\s/g,"")=='' ) {

        if (login.replace(/\s/g,"")=='') $('#login').focus();
        else $('#password').focus();
        alert('Podaj login i hasło aby się zalogować');
        return false;
    }
    return true;
}

$(function() {

    $( '#target' ).fold({
        side: 'right',
        directory: 'turn'
    });

    $('.vot_bt').click(function(){

        $('#message_vote').html('');
        var kod_sms=$('#kod_sms').val();
        

        if (kod_sms.replace(/\s/g,"")=="") {

            alert('Podaj kod SMS');
            $('#kod_sms').focus();
            return false;
        }

        $.post(folder_ajax+"vote.php", 'kod_sms='+kod_sms+'&nota=0&vote_algorytm='+vote_algorytm+'&foto_id='+ff[1],function(data){
            $('#simplemodal-container').css('height','auto');
            $('#message_vote').html(data);
        });

    });

    $('.vote_button').click(function() {

        ff=$(this).attr("id").split('_');
        var smal_f=$('#g_'+ff[1]).attr('src');
        smal_f=smal_f.replace('width=191','width=265');
        smal_f=smal_f.replace('height=126','height=265');
        smal_f=smal_f.replace('&cropratio=3:2','');
        $('.numer_foto').text(ff[1]);
        $('#vote_img').attr('src',smal_f);

        $("#sample").modal({
            minHeight:470,
            minWidth: 500,
            overlayClose:true,
            onClose: function (dialog) {
                dialog.data.fadeOut('slow', function () {
                    dialog.container.hide('slow', function () {
                        dialog.overlay.slideUp('slow', function () {
                            $.modal.close();
                        });
                    });
                });
            }
        });

    });

});