// ---------------------------------------------------------------
// Class SectionMarker
//
// Version: 1.0
// Date: 2005-09-06
// Author: Andreas Doelling (doelling@publicform.de)
//
// Class for marking a section in a page by assigning a CSS class
// to it. The section is found by the given ID.
// ---------------------------------------------------------------

function SectionMarker() {
	// -----------------------------------------------------
	// Properties
	// -----------------------------------------------------
	this.markedItemCssClass = 'marked';
	
	// -----------------------------------------------------
	// Method setCssClass
	// Sets the CSS class that will be assigned to the 
	// marked section.
	// -----------------------------------------------------
	this.setCssClass = function(cssClassName) {
		this.markedItemCssClass = cssClassName;
	}
	
	// -----------------------------------------------------
	// Method markSection
	// Finds the section with the given ID and assigns CSS 
	// class to it.
	// -----------------------------------------------------
	this.markSection = function(sectionId) {
		try {
			var sectionObj = document.getElementById(sectionId);
			sectionObj.className = this.markedItemCssClass;
			/*
			if(sectionObj.tagName == 'H2' || sectionObj.tagName == 'H3') {
				//var followingObj = sectionObj.parentNode.nextSibling;
				var followingObj = sectionObj.nextSibling;
				while(typeof followingObj == 'object') {
					if(followingObj.nodeType == 1) {
						followingObj.className = this.markedItemCssClass;
						break;
					}
					followingObj = followingObj.nextSibling;
				}
			}
			*/
		}
		catch(err) { }
	}
	
}
