// Metanav
            //    $(document).ready(function () {
            //                tools_options = {   clickable: '#metanav_toggle',
            //                                    showable: '#page_head_meta ul',
            //                                    at_width: "590",
            //                                    closed_button: "/static/img/closed18.gif",
             //                                   open_button: "/static/img/open18.gif",
             //                                   body_class_toggle: "metanav_out"}
             //               bind_nav_toggle(tools_options);
             //               $(window).resize(function() {
             //                   bind_nav_toggle(tools_options);
             //               });
             //       });

function bind_nav_toggle(options) {
                                // default close and open icons
                                options.closed_button = typeof(options.closed_button) != 'undefined' ? options.closed_button : "/static/img/closed18.gif";
                                options.open_button = typeof(options.open_button) != 'undefined' ? options.open_button : "/static/img/open18.gif";
                                var w = window.innerWidth;  // jquery width() does not exclude scrollbars
                                if ( w <= options.at_width) {
                                    $(options.showable).hide();
                                    $(options.clickable).unbind('click');
                                    $(options.clickable).click(function() {
                                        if ($(options.showable).is(':visible')) {
                                            $(this).find(".button").attr('src',options.closed_button);
                                            $(options.showable).css('display','none');
                                            $('body').removeClass( options.body_class_toggle );
                                            return false;
                                        } else {
                                            $(this).find(".button").attr('src',options.open_button);
                                            $(options.showable).css('display','block');
                                            $('body').addClass( options.body_class_toggle );
                                            return false;
                                        }
                                    });

                                    }
                                else {
                                    $(options.clickable).unbind('click');
                                    $(options.clickable).find(".button").attr(options.closed_button);
                                    $(options.showable).show();
                                    $('body').removeClass( options.body_class_toggle );
                                }
}


