$(function() {  
    $(".navbar ul.subNav:not('.open_at_load')").hide();
    
    $(".navbar li.selectToggle span").each( function () {
        var TexteSpan = $(this).text();
        $(this).replaceWith('<a href="#" class="top select_m">' + TexteSpan + '<\/a>') ;
    });
    
    $(".navbar li.toggleSubMenu span").each( function () {
        var TexteSpan = $(this).text();
        $(this).replaceWith('<a href="#" class="top">' + TexteSpan + '<\/a>') ;
    });
    
    $(".navbar li.toggleSubMenu > a").click( function () {
        if ($(this).next("ul.subNav:visible").length != 0) {
            $(this).next("ul.subNav").slideUp("normal", function () { $(this).parent().removeClass("open") } );
        }
        else {
            $(".navbar ul.subNav").slideUp("normal", function () { $(this).parent().removeClass("open") });
            $(this).next("ul.subNav").slideDown("normal", function () { $(this).parent().addClass("open") } );
        }
        return false;
    });
    
    $('a.new-window').click(function(){
		window.open(this.href);
		return false;
	});
	
    // initialize scrollable 
    $("div.scrollable").scrollable({
        items: '.items',
        size: 3
    }); 
 
});