var pathgfx = '/templates/default/images/';

/*
 * PNGfix init
 */
$(document).ready(function(){
    $(document).pngFix();
});

/*
 * jFav init
 */
$(document).ready(function(){
    $('.jFav').jFav();
});


/*
 * Colorbox
 */
$(function() {
    $('.cboxElement').colorbox({
        innerWidth: 480,
        innerHeight: 360,
        initialWidth: 50,
        initialHeight:50,
        iframe: true,
        close: 'x'
    });

    $('a.cboxVideo').colorbox({
        onOpen:function(){ 
            $(this).colorbox({
                innerWidth: $(this).attr("href").match(/width=(\d+)/i)[1] ? $(this).attr("href").match(/width=(\d+)/i)[1] : 320,
                innerHeight: $(this).attr("href").match(/height=(\d+)/i)[1] ? $(this).attr("href").match(/height=(\d+)/i)[1] : 215
            });
        },
        initialWidth: 50,
        initialHeight:50,
        iframe: true,
        close: 'x'
    });
});


/*
 * Lightbox
 */
$(function() {
    $('a.lightbox').lightBox();
    $('.gallery a').lightBox();
});


/*
 * DatePicker
 */
$(function() {
    $.datepicker.setDefaults( $.datepicker.regional[ "pl" ] );
    $( ".datepicker" ).datepicker({
        changeMonth: true,
        changeYear: true
    });


});


/*
 * Cycle
 */
$(document).ready(function() {
    if($('.ads.banner .container2').length) {
        $('.ads.banner .container2').cycle({
            fx: 'fade',
            timeout: 15000,
            speed: 1000
        });
    }
});


/*
 * acc show/hide
 */
$(document).ready(function() {
    $(".acctitle").click(function(e) {
        e.preventDefault();
        
        $('.acccon').hide();
        $(this).next(".acccon").slideToggle('fast');
    }).next(".acccon").hide();
});

/*
 * jTabs
 */
$(document).ready(function() {
    if($('.jTabs ul li').length) {
        $('.jTab').hide();
        $('.jTab.item1').show();
        
        $('.jTabs a').click(function(e){
            e.preventDefault();
            
            var aTab = $('.jTabs a.active').attr('href').replace(/[^\d]*/, '');
            var nTab = $(this).attr('href').replace(/[^\d]*/, '');
            
            $('.jTabs ul li a').removeClass('active');
            $(this).addClass('active');
            
            $('#jTab_'+aTab).slideUp('fast', function(){
                $('#jTab_'+nTab).slideDown('slow');
            });
        });
    }
});

