
$(document).ready(function() {
    
    //build custom menu
    var menuNumber = new String();
    $(".menu > li").each(function(i) {
    i++;
    if(i <= 9){
      menuNumber = '0' + i;
    }
    else{
      menuNumber = i;
    }

    //rewrite menu name
    $(this).html(menuNumber.toString() + ': ' + $(this).html());

    //build menu title
    if($(this).hasClass('current-menu-item') || $(this).hasClass('current-menu-parent') || $(this).hasClass('current-page-ancestor')){
        $('.menu-title').text(menuNumber);

        if($('.current-menu-parent a').html() != null) {
            $('.current-menu-parent').css('color', $('.current-menu-item a').css('color')).removeClass('current-page-ancestor');
            
            $('.current-menu-parent a:first').css('color', $('.current-menu-item a').css('color'));
            $('.current-menu-parent .sub-menu').show();

            $('.current-post-parent a').css('color', '#AEAFB1');
        }
    }
    });

    //show sub-menu items on mouseover
    $('.menu-item').has('.sub-menu').mouseover(function() {
        $(this).children('a').removeAttr('href').css('cursor', 'pointer');
    });
    
    $('.menu-item a').click(function() {
        
        $(this).parent().find('.sub-menu').slideToggle(500);
        /*$(this).removeAttr('href').css('cursor', 'pointer');*/
        /*$(this).find('.sub-menu').slideToggle(500);*/
    });

    //style latest news
    $('h1.post-title').html($('h1.post-title').html().replace(/Latest News/ig, '<span class="orange">Latest</span> News'));

    //video carousel
    $("#videoslider").tinycarousel({ display: 2 });

    //those who know height
    $('#slider-stories').click(function() {
        //alert($("#slider-stories ul li").height());
    });
     

 });



