﻿
$(function() {
    /* NOVINKY */
    $('#newsIn').vScroll({ speed: 500, height: 165, upID: "#NewsPrev", downID: "#NewsNext", cycle: true });

    /* SLIDER */
    $("#number_slideshow").number_slideshow({
        slideshow_autoplay: 'enable', //enable disable
        slideshow_time_interval: '5500',
        slideshow_window_background_color: "#ccc",
        slideshow_window_padding: '0',
        slideshow_window_width: '617',
        slideshow_window_height: '233',
        slideshow_border_size: '1',
        slideshow_border_color: 'white',
        slideshow_show_button: 'enable', //enable disable
        slideshow_show_title: 'disable', //enable disable
        slideshow_button_text_color: '#CCC',
        slideshow_button_background_color: '#333',
        slideshow_button_current_background_color: '#666',
        slideshow_button_border_color: '#000',
        slideshow_button_border_size: '1'
    });

    /* ACCORDEON */
    $('.acc').accordion({
        autoheight: false,
        alwaysOpen: false,
        active: false
    });

    $('.modal').click(function (e) {
        $('#' + $(this).attr('title')).modal();
        return false;
    });

    /* TITLES */
    $('.tool').bt(); //Klasické
    $('.tool1').bt({ //Upravené žlté
        padding: 10,
        width: 200,
        spikeLength: 40,
        spikeGirth: 8,
        cornerRadius: 10,
        cornerRadius: 5,
        fill: 'rgba(253, 253, 101, .9)',
        strokeWidth: 1,
        strokeStyle: '#000',
        cssStyles: { color: '#000' }
    });
    $('.tool2').bt({ //Sivé minimalistické
        fill: '#F7F7F7',
        strokeStyle: '#B7B7B7',
        spikeLength: 10,
        spikeGirth: 10,
        padding: 8,
        cornerRadius: 0,
        cssStyles: {
            fontFamily: '"lucida grande",tahoma,verdana,arial,sans-serif',
            fontSize: '11px'
        }
    });
    $('.tool3').bt({ //Pre textboxi pri focuse, žlté    
        trigger: ['focus', 'blur'],
        fill: '#F7F7F7',
        strokeStyle: '#B7B7B7',
        spikeLength: 10,
        spikeGirth: 10,
        padding: 8,
        cornerRadius: 0,
        cssStyles: {
            fontFamily: '"lucida grande",tahoma,verdana,arial,sans-serif',
            fontSize: '11px'
        }
    });
    $('.tool4').bt({ //Jednoduchá animácia
        showTip: function (box) {
            $(box).fadeIn(500);
        },
        hideTip: function (box, callback) {
            $(box).animate({ opacity: 0 }, 500, callback);
        },
        shrinkToFit: true,
        hoverIntentOpts: {
            interval: 0,
            timeout: 0
        }
    });
    $('.tool5').bt({ //Zložitejšia animácia
        fill: '#ffffff',
        width: 250,
        positions: 'top',
        showTip: function (box) {
            var $content = $('.bt-content', box).hide(); /* hide the content until after the animation */
            var $canvas = $('canvas', box).hide(); /* hide the canvas for a moment */
            var origWidth = $canvas[0].width; /* jQuery's .width() doesn't work on canvas element */
            var origHeight = $canvas[0].height;
            $(box).show(); /* show the wrapper, however elements inside (canvas, content) are now hidden */
            $canvas
      .css({ width: origWidth * .5, height: origHeight * .5, left: origWidth * .25, top: origHeight * .25, opacity: .1 })
      .show()
      .animate({ width: origWidth, height: origHeight, left: 0, top: 0, opacity: 1 }, 400, 'easeOutBounce',
        function () { $content.show() } /* show the content when animation is done */
        );
        },
        /* when using hideTip, do NOT forget 'callback' at end of animation */
        hideTip: function (box, callback) {
            var $content = $('.bt-content', box).hide();
            var $canvas = $('canvas', box);
            var origWidth = $canvas[0].width;
            var origHeight = $canvas[0].height;
            $canvas
      .animate({ width: origWidth * .5, height: origHeight * .5, left: origWidth * .25, top: origHeight * .25, opacity: 0 }, 600, 'swing', callback); /* callback */
        },

        /* other options */
        shrinkToFit: true,
        hoverIntentOpts: {
            interval: 0,
            timeout: 0
        }
    });    
    $('.tool6').bt({ //Pre náhľady
        contentSelector: "'<img src=\"web/img/referencie/' + $(this).attr('title') + '\" alt=\"\" />'",
        fill: '#F7F7F7',
            width: 400,
            strokeStyle: '#B7B7B7',
            spikeLength: 10,
            spikeGirth: 10,
            padding: 5,
            cornerRadius: 0,
            showTip: function (box) {
                $(box).fadeIn(500);
            },
            hideTip: function (box, callback) {
                $(box).animate({ opacity: 0 }, 500, callback);
            },
            shrinkToFit: true,
            hoverIntentOpts: {
                interval: 0,
                timeout: 0
            }
        });
    });

    /* REFERENCIE - kocky */
    function mycarousel_initCallback(carousel) {
        carousel.buttonNext.bind('click', function() {
            carousel.startAuto(0);
        });
        carousel.buttonPrev.bind('click', function() {
            carousel.startAuto(0);
        });
        carousel.clip.hover(function() {
            carousel.stopAuto();
        }, function() {
            carousel.startAuto();
        });
    };
    jQuery(document).ready(function() {
        jQuery('#mycarousel').jcarousel({
            auto: 2,
            wrap: 'last',
            initCallback: mycarousel_initCallback
        });
    });
