﻿$(document).ready(function(){
    setTimeout("do_that()", 500);
});


function do_that(){
    
    // CRAZY HACKZ
    var the_menu = $('#ctl00_RadMenu2').html();
    $('#ctl00_RadMenu2 ul').remove();
    $('#ctl00_RadMenu2').html(the_menu);
    // -----------
    
    
    if( $('.rmRootGroup').length > 0 ){
        //sets the <li> as active instead of the <span>
        $(this).find('.active')
            .removeClass('active')
            .parent().addClass('active');
            
        //decides if a parent should be active
        if( $(this).find('.active').parent().parent().attr('class') == 'rmSlide' ){     //we've got a child, here!
            $(this).find('.active').parent().parent().addClass('active_sub');
            $(this).find('.active').parent().parent().parent().addClass('active');
        }
        
        //does all of the hovering action
        var curr_active = $('.rmRootGroup div.active_sub');
        
        $('.rmRootGroup li a:not(.rmSlide li a)').hover(function(){
            $('.rmSlide').hide();
            $('.rmRootGroup li.show').removeClass('show');
            $(this).parent().addClass('show');
            $('.rmRootGroup div.active_sub').hide();
            $(this).parent().find('.rmSlide').show();
        });
        
        $('.rmRootGroup').hover(function(){},function(){
            $('.rmSlide').hide();
            $(curr_active).show();
        });
    }
}
