

/*
	CLASSES
	
	Functions to handle elements with multiple class names.
*/

function elementHasClassName(node,className) {
	if( node.className != '' ) {
		var classes = node.className.split(' ');
		for( k=0; k<classes.length; k++ ) {
			if( classes[k] == className ) return true;
		}
	}
	return false;
}

/*
	LISTS
	
	Functions to deal with lists.
*/

function continueLists() {
	/*
		Runs onload. 
		Looks for ordered lists with a "continue" attribute. 
		If this attribute is the ID of another (presumed prior) list in the page, 
		the numbering is continued from the end of the referenced list.
		Multiple continued lists may be strung together.
	*/
	
	var ols = document.getElementsByTagName('OL');
	for( i=0; i<ols.length; i++ ) {
		var nItems = 0;
		var newList = ols[i];
		while( prevListId = newList.getAttribute('continue') ) {
			if( prevList = document.getElementById(prevListId) ) {
				var lis = prevList.getElementsByTagName('LI');
				nItems += lis.length;
				newList = prevList;
			}
			else break;
		}
		ols[i].setAttribute('start',nItems + 1);
	}
}

