function equalHeight(group) {
    tallest = 0;
    group.each(function() {
        thisHeight = $(this).height();
        if(thisHeight > tallest) {
            tallest = thisHeight;
        }
    });
    group.height(tallest);
}

$.preloadImages = function(){
    for(var i = 0; i<arguments.length; i++){
        $("<img>").attr("src", arguments[i]);
    }
 };


$(document).ready(function(){
    $("[cms]").each(function(indx, element){
        var name = $(element).attr("cms");
        var vars = $(element).attr("vars");
        var content = $(element).html();
        $.getJSON("http://stbur.ru/cms?callback=?", {"name":name, "vars":vars, "content":content}, function(data){
            $(element).html(data.result);
        });
    });            
    
    
    $("#menu li").mouseover(function(){
        $("#menu li ul").hide();
        $(this).find('ul').show();
    });
    $("#menu li ul").mouseout(function(){
        $(this).hide();
    });
        
    equalHeight($("div.column"));
    
    $('.corner').corner();
   
    $(".widget").find("li:odd").addClass('odd');
    $(".widget").find("li:even").addClass('even');
    
    $(".zebra:odd").addClass('odd');
    $(".zebra:even").addClass('even');
    
    $.preloadImages("/images/1.png", "/images/2.png", "/images/3.png", "/images/4.png");
    
    $('#featured').orbit({
         animation: 'fade',
         animationSpeed: 800,
         timer: true,
         advanceSpeed: 4000,
         pauseOnHover: false,
         startClockOnMouseOut: false,
         startClockOnMouseOutAfter: 1000,
         directionalNav: true,
         captions: true,
         captionAnimation: 'fade',
         captionAnimationSpeed: 800,
         bullets: false,
         bulletThumbs: false,
         bulletThumbLocation: '',
         afterSlideChange: function(){}
    });
});

