

function toggleVisibilityByName( tagName ) {
                                                                                                                
        // get a list of elements in this document with this name
        nodeArray = new Array();
        nodeArray = document.getElementsByName( tagName );
                                                                                                                
        // for each tab with this name, set the CSS style values
        var length = nodeArray.length;
        for (var a=0; a<nodeArray.length; a++) {
                                                                                                                
                // get the node we are currently working on
                var currentNode = nodeArray[a];
                                                                                                                
                // create variables to hold different CSS style values
                var css_visibility;
                var css_overflow;
                var css_width;
                var css_height;
                var css_display;
                                                                                                                
                // should i hide?  should I display?
                var cur = currentNode.style.visibility;
		//// if we don't have one set, get it from the class.
		if (!cur) {
			var ourClass = currentNode.className;
			//// get all the rules...
			var theRules = new Array();
			if (document.styleSheets[0].cssRules) {
				theRules = document.styleSheets[0].cssRules;
			} else if (document.styleSheets[0].rules) {
				theRules = document.styleSheets[0].rules;
			} else {
				return;
			}
    			for (i=0;i<theRules.length;i++) {
        			if (theRules[i].selectorText != null &&
					(theRules[i].selectorText.indexOf(ourClass) > -1)) {
    					cur = theRules[i].style.visibility;
				}
			}
		}
                if (cur != "hidden") {
                        css_visibility="hidden";
                        css_overflow="hidden";
                        css_width="0px";
                        css_height="0px";
                        css_display="none";
                } else {
                        css_visibility="visible";
                        css_overflow="auto";
                        css_width="auto";
                        css_height="auto";
                        css_display="";
                }

                // change the elements on the current page
                currentNode.style.visibility    = css_visibility;
                currentNode.style.overflow      = css_overflow;
                currentNode.style.width         = css_width;
                currentNode.style.height        = css_height;
                currentNode.style.display       = css_display;
        }
                                                                                                                
}



function toggleVisibilityByID (idName) {
        var target = document.getElementById(idName);
        var current = target.style.visibility;
        if (current == 'hidden') {
                target.style.visibility = 'visible';
                target.style.overflow = 'visible';
                target.style.width = '100%';
                target.style.height = 'auto';
                target.style.display= '';
        } else {
                target.style.visibility = 'hidden';
                target.style.overflow = 'hidden';
                target.style.width = '0';
                target.style.height = '0';
                target.style.display= 'none';
        }
                                                                                                                
}


function toggleVisibilityByClass( className ) {
	if (!document.styleSheets) return;

	//// get all the rules...
	var theRules = new Array();
	if (document.styleSheets[0].cssRules) {
		theRules = document.styleSheets[0].cssRules;
	} else if (document.styleSheets[0].rules) {
		theRules = document.styleSheets[0].rules;
	} else {
		return;
	}
	/// for each rule...
    	for (i=0;i<theRules.length;i++) {
        	if (theRules[i].selectorText != null &&
			(theRules[i].selectorText.indexOf(className) > -1))
		{
    			var current = theRules[i].style.visibility;
			if (current == 'hidden') {
    				theRules[i].style.visibility = 'visible';
    				theRules[i].style.overflow = 'visible';
    				theRules[i].style.width = '100%';
    				theRules[i].style.height = 'auto';
    				theRules[i].style.display= 'auto';
			} else {
    				theRules[i].style.visibility = 'hidden';
    				theRules[i].style.overflow = 'hidden';
    				theRules[i].style.width = '0';
    				theRules[i].style.height = '0';
    				theRules[i].style.display= 'none';
			}
		}
	}
}



function showTeachingNotes () {
	if (!document.styleSheets) return;

	//// get all the rules...
	var theRules = new Array();
	if (document.styleSheets[0].cssRules) {
		theRules = document.styleSheets[0].cssRules;
	} else if (document.styleSheets[0].rules) {
		theRules = document.styleSheets[0].rules;
	} else {
		return;
	}
	/// for each rule...
    	for (i=0;i<theRules.length;i++) {
        	if (theRules[i].selectorText != null &&
			(theRules[i].selectorText.indexOf('teachingNotes') > -1 ||
			theRules[i].selectorText.indexOf('teachingDiv') > -1)
			)
		{
    			var current = theRules[i].style.visibility;
			if (current == 'hidden') {
    				theRules[i].style.visibility = 'visible';
    				theRules[i].style.overflow = 'visible';
    				theRules[i].style.width = '100%';
    				theRules[i].style.height = 'auto';
    				theRules[i].style.display= '';
			} else {
    				theRules[i].style.visibility = 'hidden';
    				theRules[i].style.overflow = 'hidden';
    				theRules[i].style.width = '0';
    				theRules[i].style.height = '0';
    				theRules[i].style.display= 'none';
			}
		}
	}
}


function showClassNotes () {
	if (!document.styleSheets) return;

	//// get all the rules...
	var theRules = new Array();
	if (document.styleSheets[0].cssRules) {
		theRules = document.styleSheets[0].cssRules;
	} else if (document.styleSheets[0].rules) {
		theRules = document.styleSheets[0].rules;
	} else {
		return;
	}
	/// for each rule...
    	for (i=0;i<theRules.length;i++) {
        	if (theRules[i].selectorText != null &&
			(theRules[i].selectorText.indexOf('classNotes') > -1 ||
			theRules[i].selectorText.indexOf('classDiv') > -1)
			)
		{
    			var current = theRules[i].style.visibility;
			if (current == 'hidden') {
    				theRules[i].style.visibility = 'visible';
    				theRules[i].style.overflow = 'visible';
    				theRules[i].style.width = '100%';
    				theRules[i].style.height = 'auto';
    				theRules[i].style.display= '';
			} else {
    				theRules[i].style.visibility = 'hidden';
    				theRules[i].style.overflow = 'hidden';
    				theRules[i].style.width = '0';
    				theRules[i].style.height = '0';
    				theRules[i].style.display= 'none';
			}
		}
	}
}


function showAllNotes () {
	if (!document.styleSheets) return;

	//// get all the rules...
	var theRules = new Array();
	if (document.styleSheets[0].cssRules) {
		theRules = document.styleSheets[0].cssRules;
	} else if (document.styleSheets[0].rules) {
		theRules = document.styleSheets[0].rules;
	} else {
		return;
	}
	/// for each rule...
    	for (i=0;i<theRules.length;i++) {
        	if (theRules[i].selectorText != null &&
			(theRules[i].selectorText.indexOf('teachingNotes') > -1 ||
			theRules[i].selectorText.indexOf('classNotes') > -1 ||
			theRules[i].selectorText.indexOf('classDiv') > -1 ||
			theRules[i].selectorText.indexOf('teachingDiv') > -1)
			)
		{
    			var current = theRules[i].style.visibility;
			if (current == 'hidden') {
    				theRules[i].style.visibility = 'visible';
    				theRules[i].style.overflow = 'visible';
    				theRules[i].style.width = '100%';
    				theRules[i].style.height = 'auto';
    				theRules[i].style.display= '';
			} else {
    				theRules[i].style.visibility = 'hidden';
    				theRules[i].style.overflow = 'hidden';
    				theRules[i].style.width = '0';
    				theRules[i].style.height = '0';
    				theRules[i].style.display= 'none';
			}
		}
	}
}

