/* 
 * Create by Webaps.eu
 * 
 */

function FaqExecShow(id,title)
{
    $("#faqQ"+id).html('<a onclick="FaqExecHide(\''+id+'\',\''+title+'\');" class="faqQuestion">'+title+'</a>');
    $("#faqA"+id).show('slow');

}

function FaqExecHide(id,title)
{
    $("#faqQ"+id).html('<a onclick="FaqExecShow(\''+id+'\',\''+title+'\');" class="faqQuestion">'+title+'</a>');
    $("#faqA"+id).hide('slow');

}

function AddNewsletter()
{
    var email = $('#newsletter_email').val();

    $.ajax({
        type    : 'POST',
        url     : './addnewsletter',
        data    : {
            email:email
        },
        success : function( response )
        {
            $("#errInfoNewsletter").html(response);
        }

    });
}

function VoteAnkieta(ankieta_id)
{
    var ankieta_odp = $("input[name='"+ankieta_id+"']:checked").val();

   // var ankieta_odp = $('#'+ankieta_id).val();

    $.ajax({
        type    : 'POST',
        url     : './addvote',
        data    : {
            ankieta_odp:ankieta_odp
        },
        success : function( response )
        {
            $("#ankieta"+ankieta_id).html(response);
        }

    });
}

(function($) {
    $.extend($, {
        cacheImage : function(src, options) {
            if (typeof src === 'object') {
                $.each(src, function() {
                    $.cacheImage(String(this), options);
                });

                return;
            }

            var image = new Image();

            options = options || {};

            $.each( [ 'load', 'error', 'abort' ], function() { // Callbacks
                var e = String(this);
                if (typeof options[e] === 'function') {
                    $(image).bind(e, options[e]);
                }

                if (typeof options.complete === 'function') {
                    $(image).bind(e, options.complete);
                }
            });

            image.src = src;

            return image;
        }
    });

    $.extend($.fn, {
        cacheImage : function(options) {
            return this.each(function() {
                $.cacheImage(this.src, options);
            });
        }
    });
})(jQuery);






