function getElementsByClass(searchClass,node,tag) {	var classElements = new Array();	if ( node == null )		node = document;	if ( tag == null )		tag = '*';	var els = node.getElementsByTagName(tag);	var elsLen = els.length;	var pattern = new RegExp("(^|\\\\s)"+searchClass+"(\\\\s|$)");	for (i = 0, j = 0; i < elsLen; i++) {		if ( pattern.test(els[i].className) ) {			classElements[j] = els[i];			j++;		}	}	// alert ("the number of elements in the class is " + classElements.length) ; 	return classElements;}function childrenOfNodeWithTagName(node, tagName){	return node.getElementsByTagName(tagName); }function childrenOfElementWithIDHavingTagName(id, tagName){	return document.getElementById(id).getElementsByTagName(tagName); }function firstChildrenOfNodeArrayWithTagName(nodeArray, tag) {	var itemCount = nodeArray.length;	var children = new Array();	for(var i=0;i<itemCount;i++)	{					subNodes = childrenOfNodeWithTagName(nodeArray[i], tag) ;			children[i] = subNodes[0] ;  // only get first child			//alert("added " + children[i] + " of type " + typeof children[i]) ;	}		return children; }function attributesFromNodeArrayWithName(nodeArray, attrName) {	var itemCount = nodeArray.length;	var children = new Array();	for(var i=0;i<itemCount;i++)	{					children[i] = nodeArray[i].getAttribute(attrName);			//alert("added " + children[i]) ;	}		return children; }function hideElementWithID(id) {	document.getElementById(id).style.visibility = 'hidden';}function unhideElementWithID(id) {		document.getElementById(id).style.visibility = 'visible';	}/* ------------------------------------ *//* Following are not working */function dontDisplayElementWithID(id) {	document.getElementById(id).display = 'none';}function displayElementWithID(id) {		document.getElementById(id).display = 'block';	}function toggleDisplayOfElementWithID(id) {	alert("getting display attr of id " + (id)) ;	item = document.getElementById(id); 	alert("item is "+ item) ;	alert("item visibility is "+ document.getElementById(id).style.visibility) ;	d = style.getAttribute("display");	alert("d is " + d);	if ( d == 'block') {		document.getElementById(id).style.display = 'none';		}	else {		document.getElementById(id).style.display = 'block';		}	// handle undefined	if ( d == undefined) {		alert("got here") ;		document.getElementById(id).display = 'block';		}	}function toggle() {	alert("about to toggle") ;	// toggleDisplayOfElementWithID("test");	id = "tester";	f = document.getElementById(id).color;	item = document.getElementById(id) ; 	myStyle = item.style;	alert("color is "+  myStyle.color ) ;	alert("color2 is "+  item.color ) ;}function setTextOfElement(elem, newText) {	alert("called setTextOfElement") ;	elem.firstChild.nodeValue = newText; }
