$(function(){
    setTimeout("$('.right div:eq(0)').slideDown(1000)", 500);
    $('li.d a img').mouseover(function(){
            $(this).fadeTo(250,1.0);
            }).mouseout(function(){
                $(this).fadeTo(250,0.0);
            });;
    $('.pager .d').live("mouseover",function(){
            $(this).animate({backgroundColor: "white"},300);
            }).live("mouseout",function(){
            $(this).animate({backgroundColor: "#CFDB36"},300);
            });;
    $('.pager .nav').live("click",function(){
        //pracujem();
        $.ajax({
            url:    'contentScript.php',
            type:   'GET',
            data:   'item=' + $(this).attr("title")+
                    '&cat=' + $('.sub').attr("id"),

            success: function(result){
/*                $('.loadingIcon').fadeOut(500, function(){
                    $('.loadingIcon').remove();
                });*/
                $('#content').empty();
                $('#content').append(result);
            }
        });
    });
    $('.thumb.d').live("click", function(){
        $('.thumb').attr("class","thumb d");
        $(this).attr("class","thumb a");
        $(this).css({opacity: 1.0});
        $('.thumb.d').css({opacity: 0.6});
        $.ajax({
            url:    'preview.php',
            type:   'GET',
            data:   'item=' + $(this).find('img:eq(0)').attr("src"),

            success: function(result){
                $('#content .left').css({backgroundImage: "url("+$('#content .left img').attr("src")+")"});
                $('#content .left').empty();
                $('#content .left').append(result);
                $('#content .left img').css({opacity: 0.0});
                $('#content .left img').animate({opacity: 1.0},500);
            }
        });
    });
    $.preload(['interiery','exteriery','nabytok','produkt-design','grafika','animacie'], {base:'files/',ext:'.jpg'});
    $.preload(['profil','impressum','kontakt'], {base:'images/',ext:'.jpg'});
});