$(window).load(function() {
	var h = $("#content-inner").height() - 693;
	if($("#content-inner").height() > 693) {
		$("#content").height(h);
	} else {
		$("#content").css("background", "none");
	}
});
function mailTo(url) {
	window.location.href = "mailto:?body=" + escape(url);
}
if (jQuery) (function($) {
    $.extend($.fn, {
        treeview: function(options, callback) {
            // Defaults
            if (!options) var options = {};
 
            // initialise tree
            var tree = $(this);
            //collapse folder initially
            tree.find('ul.Treeview li.directory').addClass('collapsed')
            //add click handler
			tree.click(function(e) { handleClick(e) });
 
            function handleClick(e) {
                //is the click on me or a child
                var node = $(e.target);
                //check the link is a directory
                if (node.is("li.directory")) { //Is it a directory listitem that fired the click?
                    //do collapse/expand
                    if (node.hasClass('collapsed')) {
                        node.find('>ul').toggle(); //need the > selector else all child nodes open
                        node.removeClass('collapsed').addClass('expanded');
                    }
                    else if (node.hasClass('expanded')) {
                        node.find('>ul').toggle();
                        node.removeClass('expanded').addClass('collapsed');
                    }
                    //its one of our directory nodes so stop propigation
                    e.stopPropagation()
                } else if (node.attr('href') == '#' | node.hasClass('file')) {
                    //its a file node with a href of # so execute the call back
                    // if the item that fired the click is not either a folder or a file it cascades as normal
                    // so that contained links behave like normal
                    callback(e);
                }
 
            }
        }
    });
})(jQuery);
