hv.sectioner = function(){
	$('h2, h3').each(function(){
		var head = $(this);
		head.wrapInner('<span class="title"></span>');
		var next = head.next();
		if(next.size() && next.hasClass('h2Sub')){
			subHead = next;
			next = next.next();
			subHead.appendTo(head);
		}
		if(next.size()){
			var name = $('.title',head).text().toLowerCase().replace(/<[^>]+>/).replace(/[^-a-z0-9]/g,'');
			var container = $('<div class="container2 '+name+'C"'+(this.id?' id="'+this.id+'C"':'')+'></div>').insertBefore(head);
			var content = next.addClass('c2').appendTo(container);
			if(this.tagName == 'H2'){
				content.append('<br class="clr"/>');
			}
			container.prepend(head);
		}
	});
}
hv.collapse = function(ele){
	var content = $(ele).parent().next();
	if(content.hasClass('collapsed')){
		$(ele).attr('src','/imgs/hide').mouseover(function(){$(this).attr('src',"/imgs/hide_hover")}).mouseout(function(){$(this).attr('src',"/imgs/hide")});
		content.removeClass('collapsed');
	}else{
		$(ele).attr('src','/imgs/show').mouseover(function(){$(this).attr('src',"/imgs/show_hover")}).mouseout(function(){$(this).attr('src',"/imgs/show")});;
		content.addClass('collapsed');
	}
}

hv.makeCollapsable = function(){
	$('.collapsable').each(function(){
		var header = $(this).parent().children(':first-child');
		if($(this).hasClass('collapsed')){
			header.html('<img onclick="hv.collapse(this)" src="/imgs/show"/> '+header.html())
			header.children(':first-child').mouseover(function(){$(this).attr('src',"/imgs/show_hover")}).mouseout(function(){$(this).attr('src',"/imgs/show")});
		}else{
			header.html('<img onclick="hv.collapse(this)" src="/imgs/hide"/> '+header.html())
			header.children(':first-child').mouseover(function(){$(this).attr('src',"/imgs/hide_hover")}).mouseout(function(){$(this).attr('src',"/imgs/hide")});
		}
	});
}