$(document).ready(function (){



        $('div#flash').each(function(el){
          $(this).children().each(function(el){
           $(this).append('<br /> <span class="close"><a href="#" class="closeFlash">Zavřít</a></span>');
        });
        });
        $('a.closeFlash').live('click',function(el){
            $(this).parent().parent().hide('slow');
            return false;
        });


    


    $('ul.dum3d li').click(function() {
        window.location =$(this).find('a').attr('href');
    });




    jQuery('#mycarousel').jcarousel();


    $(".ajaxSnippets").click(function (){

        $.getJSON($(this).attr("href"), function(payload) {
                           
            for(var id in payload.snippets) {
                $('#' + id).html(payload.snippets[id]);
            }
        });

        return false;
    });

    $('a.gallery').lightBox(
    {
        overlayBgColor: '#FFF',
        overlayOpacity: 0.6,
        imageLoading: '/images/lightbox-ico-loading.gif',
        imageBtnClose: '/images/lightbox-btn-close.gif',
        imageBtnPrev: '/images/lightbox-btn-prev.gif',
        imageBtnNext: '/images/lightbox-btn-next.gif',
        containerResizeSpeed: 350
	
	
    }
    );

    // Search Box
    $("#search").click(
        function() {

            if ($('#search').attr('value')=='Hledej ...')
            {
                $('#search').attr('value','');

            }
        }
        );


    $("#search").change(
        function() {

            if ($('#search').attr('value')=="")
            {
                $('#search').attr('value','Hledej ...');
                                 
            }
        });


    jQuery("#search").suggest('/dum3d/searchdibi/',
    {
        onSelect: function(){

            $("#searchForm").submit();
        },
        "itemsPerPage":10,
        "noControl":false
    });


    $(".deleteAjax").live('click',function(){
        if (confirm($(this).attr('rel')) != true)
        {
            return false;
        }
    });

    var supffix;
    var atSign = "&#64;"
    supffix = atSign + "lanos" + "." + "cz";

    $("span.mailer").each( function(key, value) {
        $(this).html("<a href='mailto:" + $(this).attr('title') + supffix + "'>" + $(this).attr('title') + supffix + "</a>")
        $(this).attr('title',$(this).prev().prev().text());
    });

       $('ul.sf').superfish({
        //   hoverClass:    'active'
        //   pathClass:     'active'
        });
            $('.dum3d').kwicks({
        max : 700,
        spacing : 5
    });

    });
