////////////////////////////
// http://adipalaz.awardspace.com/
///////////////////////////
(function($) {
$.fn.orphans = function(){
var txt = [];
this.each(function(){$.each(this.childNodes, function() {
  if (this.nodeType == 3 && $.trim(this.nodeValue)) txt.push(this)})}); return $(txt);};
$.fn.wrapper = function(){
  return this.each(function() {
    if ($(this).parent('li').find('ul').attr("id")) {
      var $destination = $(this).parent('li').find('ul').attr("id"),
        $title = 'expand/collapse&nbsp;'+ $destination;
    } else {var $destination = $title = 'expand/collapse';};
    $(this).wrap('<a class="trig" style="display:block" href=#' + $destination + ' title=' + $title + ' />');
});};})(jQuery);
$(function(){
$('#main li:has(ul)').css('padding-left','1.7em').orphans().wrapper();
$('#main li:has(ul) > a.trig').css({position: 'relative', 'width':'100%', 'margin-left':'-1.8em', 'padding-left': '1.8em', 'border': '0 none'})
.click(function(event){
if (this == event.target) {
if ($(this).parent().find('ul').is(':hidden')) {
  $(this).removeClass('plus').addClass('minus').parent().find('ul').show();
} else { $(this).removeClass('minus').addClass('plus').parent().find('ul').hide();};
};return false;}).click();});
