﻿/* pirobox */

jQuery(document).ready(function() {
    jQuery().piroBox({
        my_speed: 400, //animation speed
        bg_alpha: 0.3, //background opacity
        slideShow: true, // true == slideshow on, false == slideshow off
        slideSpeed: 4, //slideshow duration in seconds(3 to 6 Recommended)
        close_all: '.piro_close,.piro_overlay'// add class .piro_overlay(with comma)if you want overlay click close piroBox

    });
});

/* tiskanje strani */
function printPartOfPage(elementId) {
    var printContent = document.getElementById(elementId);
    var windowUrl = 'about:blank';
    var windowName = 'Print' + new Date().getTime();
    var printWindow = window.open(windowUrl, windowName, 'left=0,top=0,width=0,height=0');

    printWindow.document.write(printContent.innerHTML);
    printWindow.document.close();
    printWindow.focus();
    printWindow.print();
    printWindow.close();
}

/* povečava pisave */
function mydefaultsize() {
    jQuery('h1, h2, p').not(function() {

        var x = sessvars.h1;
        var y = x * 0.777777777777777777;
        var z = y * 0.857142;

        jQuery('h1').css('font-size', x);
        jQuery('h2').css('font-size', y);
        jQuery('p').css('font-size', z);

    });


}

function povecaj(h1, h2, p) {
    jQuery('h1, h2, p').not(function() {

        jQuery('h1').css('font-size', h1);
        jQuery('h2').css('font-size', h2);
        jQuery('p').css('font-size', p);

    });

    sessvars.h1 = h1;
    sessvars.h2 = h2;
    sessvars.p = p;
}

/*jSLIDE*/
jQuery(function() {

    jQuery('div#example').slide({
        loop: [1, 6000],
        speed: [500, 6000],
        direction: "top",
        caption: 'caption2',
        preloadImg: false

    });

    jQuery('#stoploop').click(function() {
        jQuery('div#example').slide().toggleLoop();
        return false;
    });


});

/* lightbox */
jQuery(function() {
    jQuery('#gallery a').lightBox();
});

/*modal*/

function nastavi() {

    sessvars.kmet= 666;
}

function autostart() {
    /*alert(sessvars.kmet);
    alert(sessvars.flag);*/
    /*sessvars.$.debug();*/
    if (sessvars.flag == 3 && sessvars.kmet == null) {
        modalZazeni(); //zaženi oken on load
        /*sessvars.flag = 1;*/
    }
}

function modalZazeni() {
    //Put in the DIV id you want to display
    launchWindow('#dialog1');

    //if close button is clicked
    jQuery('.window #close').click(function() {
        jQuery('#mask').hide();
        jQuery('.window').hide();
    });

    //if mask is clicked
    jQuery('#mask').click(function() {
        jQuery(this).fadeOut("slow");
        jQuery('.window').fadeOut("slow");
    });
    //if mask is clicked
    jQuery('#zapri_gumb').click(function() {
    jQuery('#zapri_gumb').fadeOut("slow");
    jQuery('#mask').fadeOut("slow");
        jQuery('.window').fadeOut("slow");
    });

}

function launchWindow(id) {

    //Get the screen height and width
    var maskHeight = jQuery(document).height();
    var maskWidth = jQuery(window).width();

    //Set heigth and width to mask to fill up the whole screen
    jQuery('#mask').css({ 'width': maskWidth, 'height': maskHeight });

    //transition effect
    jQuery('#mask').fadeIn(1000);
    jQuery('#mask').fadeTo("slow", 0.8);

    //Get the window height and width
    var winH = jQuery(window).height();
    var winW = jQuery(window).width();

    //Set the popup window to center
    jQuery(id).css('top', winH / 2 - (jQuery(id).height() - jQuery(id).height()/2));
    jQuery(id).css('left', winW / 2 - jQuery(id).width() / 2);

    //transition effect
    jQuery(id).fadeIn(2000);


}

function prikaziKontaktOknoDestrnik()
{
    jQuery('#kontaktOknoDestrnik').css({ 'visibility': visible });
    jQuery('#kontaktOknoDestrnik').fadeIn(1000);


}
