    $(document).ready(function() {
        /*
         * AJAX set-up
         */
        $.ajaxSetup ({
                cache: false,
                dataType: "html"
            });
        /*
         * Ajax functionality
         *
         * When you click on the link to a child page the requested page is
         * loaded into the #main-content div of the current page
         */
        //This is on page-load
        if(ajax_load==true){
            var first_li = $('#child-nav li.first');
            var first_a = $('#child-nav li.first a');
            var first_link =   first_a.attr("href")+"?remote=1 #target-content ";
            //1. empty current content
            $('#main-content').empty();
            //2. load remote content
            $('#main-content').load(first_link);
            //3. alter classes
            first_li.removeClass('first');
            first_a.addClass('current');
        }
        $('#child-nav li a').livequery('click',function(){
            //ajax link is stored in the id of the clicked link
            var link =   $(this).attr("href")+"?remote=1 #target-content ";
            
            //1. empty current content
            $('#main-content').empty();
            //2. load remote content
            $('#main-content').load(link);
            //3. remove current class from other links
            $('#child-nav li a').removeClass('current');
            //4. add current class to link
            $(this).addClass('current');
            //5. return false to prevent link behavior
            return false;
        });

        $(".main_tube #m_i_1").livequery(function(){
            $(this).children().show();
        });
        $(".main_tube #m_i_1 a").livequery(function(){
            $(this).show();
        });
        $(".main_tube #m_i_1").livequery(function(){
            $(this).show('slow');
        });

        function jp_show(id){
            $(".main_tube #m_"+id).children().show();
            $(".main_tube #m_"+id+" a").show();
            $(".main_tube #m_"+id).fadeIn('slow');
        }
        /*
         *
         */
        $('.media_thumb').livequery('click',function(){
            var id = $(this).attr("id");
            //hide all media items
            $(".main_tube").children().hide();
            //show selected
            jp_show(id);
            //apply class to current thumbnail
            $('.med_current').removeClass('med_current');
            $(this).addClass("med_current");
        });
    });
