$(document).ready(function(){

    // !!! SEE THIS PLEASE !!!
    // delete this line to make the modal box load only ONCE
    // if you let it set to 'false' it will show every time .. set it to 'true' and it will never show
    //$.cookie("modal", 'false')

    /**
      *  MODAL BOX
      */
    // if the requested cookie does not have the value I am looking for show the modal box
    if($.cookie("modal") != 'true')
    {
        var _message_to_show = '<h2>Milé zákaznice,</h2><p>moc se Vám omlouvám odjiždím pracovně mimo republiku, budu Vám s radostí k dispozici v červenci 2012. <br />S přáním všeho dobrého Gabriela</p> <br /><br /><a href="#" id="modal_close">Vstoupit</a> <!--<a href="http://www.kosmetika-payot.cz" id="modal_exit">EXIT</a>--><br />';

        // on page load show the modal box
        // more info about the options you can find on the fancybox site
        $.fancybox(
            _message_to_show,
            {
                'width'             : 350,
                'height'            : 300,
                'transitionIn'      : 'none',
                'transitionOut'     : 'elastic',
                'centerOnScroll'    : 'true',
                'overlayOpacity'    : 0.9,
                'overlayColor'      : '#000',
                'modal'             : 'true'
            }
        );

        // in the message is a link with the id "modal_close"
        // when you click on that link the modal will close and the cookie is set to "true"
        // path "/" means it's active for the entire root site.. if you set it to "/admin" will be active on the "admin" folder
        // expires in 7 days
        // "modal" is the name i gave the cookie.. you can name it anything you want
        $('#modal_close').live('click', function(e) {
            e.preventDefault();
            $.cookie("modal", "true", { path: '/', expires: 7 });

            $.fancybox.close()
        });
    }

});
