
/**
 * je potreba pripojit jQuery knihovnu
 */                          

//document.write('<link rel="stylesheet" type="text/css" href="/css/shop/main.css" />
$(document).ready(function(){
    // funkce pri nacteni dokumentu
    flashMessage.ini();
});

// flashMessage object
var flashMessage = {
    msgDiv : {},
    vars : {
        'hideTime' : 10000,
        'end' : 0
    },
    ini : function(settings){
        if (settings){
            for(var key in settings){
                this.vars[key] = settings[key];
            }
        }
        this.msgDiv = $('.jquery_message');
        this.msgDiv.click(this.hide);
        $(document).click(this.hide);
        if (this.msgDiv.hasClass('jquery_message_error')){
            this.setAsErrorFlash();
        }
        else if (this.msgDiv.hasClass('jquery_message_warning')){
            this.setAsWarningFlash();
        }
        else {
            this.setFlash();
        }
    },
    setFlash : function(){
        //alert($('.jquery_message').height());
        $('.jquery_message .jquery_message_shadow_box').height($('.jquery_message').outerHeight());
        $('.jquery_message').slideDown('slow');
        $('.jquery_message .jquery_message_shadow_box').slideDown('slow');
        setTimeout("flashMessage.hide();", this.vars['hideTime']);
    },
    setAsErrorFlash : function(){
        $('.jquery_message').fadeIn('slow');
        this.center();
    },
    setAsWarningFlash : function(){
        $('.jquery_message_text').html(
            $('.jquery_message_text').html()+
            '<br /><br /><div align="right" ><input type="button" value="OK" class="image_button hide_shadow_box" ></div>'
        );
        $('.hide_shadow_box').click(this.hide);
        $('.jquery_message').fadeIn('slow');
        this.center();
    },
    center : function(){
        $('.jquery_message_text').css('top', ((this.msgDiv.height()-$('.jquery_message_text').height())/2)).css('left', ((this.msgDiv.width()-$('.jquery_message_text').width())/2));
    },
    hide : function(){
        $('.jquery_message').fadeOut('slow');
    },
    end : 0
    
};


var process = {

    /**
     * set_processing(process_text);
     * Author: Josef Traxler
     * Date: 2011-12-09
     * Description:
     *      Nastaveni shadowboxu procesu
     * Params:
     *      process_text (string) - text ktery se ma zobrazit u procesu     
     */
    set : function(process_text){
        if (!process_text) process_text = '&nbsp;';
        $('#obsah').html($('#obsah').html()+                          
            '<div class="processing_shadowbox" >&nbsp;</div>'+
            '<div class="processing" ><div class="processsing_in" >'+
                '<img src="/images/icons/loading.gif" alt="Nacitani..." /><br /><br />'+
                '<div class="processing_text" >'+process_text+'</div>'+
            '</div></div>'
        );
        $('.processing_shadowbox').css('position', 'fixed')
            .css('top', '0px')
            .css('left', '0px')
            .css('width', '100%')
            .css('height', '100%')
            .css('background', '#fff')
            .css('opacity', 0.8)
            .css('z-index', 10000);
        $('.processing').css('position', 'fixed')
            .css('font-size', '25pt')
            .css('top', (($(window).height() - $('.processing').height())/2))
            .css('left', (($(window).width() - $('.processing').width())/2))
            .css('text-align', 'center')
            .css('z-index', 10001);
        
    },
    
    end:0
}; 


