$(function() {

    /**
        ZVYRAZNENI OBRAZKU, ZATIMCO OSTATNI ZASEDNOUT
    */
    
    obrazky = new Array("oNas", "servisPc", "projekty", "sluzby", "klienti", "kontakt");
    count = obrazky.length;
    
    $("div.mainLink span").hover(function() {
                
        for (var i = 0; i < count; i++) {
            if (obrazky[i] != $(this).attr("id")) {
                $("span#"+obrazky[i]).stop().animate({opacity: 0.3}, 400);    
            } else {
                $("span#"+obrazky[i]).stop().animate({opacity: 1.0}, 400);
            }
        }
    } , function() { 
        for (var i = 0; i < count; i++) {
            $("span#"+obrazky[i]).stop().animate({opacity: 0.8}, 400);    
        }
    });
    
    /**
        POSTUPNE OBARVENI ODKAZU DO SYTOSTI
    */
    
    $("div#links img").hover(function() {
        img = $(this).attr("name");
        img = img.replace(/double/g, "../");
        img = img.replace("slash", "/");
        $(this).attr("src", img+"-a.png");
        $(this).css({opacity: 0.3});
        $(this).stop().animate({opacity: 1}, 400);            
    } , function () {
        if ($(this).attr("class") != "active") {
            $(this).attr("src", img+".png");
        }
    });
    
    /**
        ZESVETLENI DIVU REFERENCE
    */
    /*
    $("div.reference").hover(function() {
        $(this).stop().animate({opacity: 1}, 300);        
    }, function() {
        $(this).stop().animate({opacity: 0.7}, 300);    
    });
    */
    $("li#konzultace").hover(function() {
        name = $(this).attr("id");
        $("ul#sub"+name).slideDown(400);
    }, function() {
        $("ul#sub"+name).slideUp(400);
    });
    
    $("li#www").hover(function() {
        name = $(this).attr("id");
        $("ul#sub"+name).slideDown(400);
    }, function() {
        $("ul#sub"+name).slideUp(400);
    });
    
    $("li#marketing").hover(function() {
        name = $(this).attr("id");
        $("ul#sub"+name).slideDown(400);
    }, function() {
        $("ul#sub"+name).slideUp(400);
    });
    
    $("#show").click(function() {
        var co = $(this).attr("name");
        $("#show").hide();
        $("#hide").show();
        $(co).slideDown('slow');    
    });
    
    $("#hide").click(function() {
        var co = $(this).attr("name");
        $("#show").show();
        $("#hide").hide();
        $(co).slideUp('slow');
    })
    
});