
function formatTitle(title, currentArray, currentIndex, currentOpts) {
    if (title) return '<div id="tip7-title">' + (title && title.length ? '<b>' + title + '</b>' : '' ) + '</div>';
    else return '';
}



function newsletter(akcja) {

    var adres=$('#newsletter').val();

    if (adres.replace(/\s/g,"")=="")
    {
        $.prompt("Podaj adres e-mail",{
            focus:1,
            top: 180,
            buttons:{
                'OK':true
            },
            callback: function(v,m,f){

                $("#newsletter").focus();
            }

        }
        );
    }

    else if (!adres.match(/^[0-9a-z_.-]+@([0-9a-z-]+\.)+[a-z]{2,6}$/) ) {
        $.prompt("Podaj poprawny adres e-mail.",{
            focus:1,
            top: 180,
            buttons:{
                'OK':true
            },
            callback: function(v,m,f){

                $("#newsletter").focus();

            }
        }
        );

    } else {

        $('.newsletter_info').html('proszę czekać ...');

        var skrypt_ajax="newsletter.php";
       
        $.post(folder_ajax+skrypt_ajax, 'kod='+t+'&email='+adres+'&akcja='+akcja,function(data){

           $('.newsletter_info').html(data);
            $('#newsletter_add').blur();
            $('#newsletter_usun').blur();
        });

    }
}






$(function() {


    $('.news_list_faq_header').click(function(){
        var id_f=$(this).attr('id').split('_');
        var disp=$('#click2_'+id_f[1]).css('display');
        $('.news_list_faq_zajawka').css('display','none');
        $('.news_list_faq_header').css('color','#3e3e3e');
        if (disp=='block') {
            $('#click2_'+id_f[1]).css('display','none');
        } else {
            $('#click2_'+id_f[1]).css('display','block');
            $(this).css('color','#0250bc');
        }
    });
    $("a.fancy").fancybox({
        'titleShow'		: true,
        'transitionIn'	: 'elastic',
        'transitionOut'	: 'elastic',
        'titlePosition' : 'inside',
        'titleFormat'	: formatTitle
    });
    $("a[rel=fancy]").fancybox({
        'transitionIn'		: 'none',
        'transitionOut'		: 'none',
        'titlePosition' 	: 'over',
        'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
            return '<span id="fancybox-title-over">'  + (title.length ? ' &nbsp; ' + title : '') + '</span>';
        }
    });
    $("a[rel=fancygal]").fancybox({
        'transitionIn'		: 'none',
        'transitionOut'		: 'none'
    });

});





