
/** Folds and unfolds node \p node */
rollup = function( node, parentnode ) {
	var parentnode = parentnode || false;
	if ( parentnode ){
		var nList = node.parentNode.childNodes;
		for (i in nList){
			var n = nList[i]
			var tag = String(n.tagName).toLowerCase();
			if ( tag == 'div' ) {
				n.style['display'] = 'none'; } } }

	if ( node.style['display'] == 'block')
		node.style['display'] = "none"
	else
		node.style['display'] = "block"
}


/** returns first HTML ELEMENT child of node \p node , or \b null if there isn't one */
firstElementChild = function( node ) {
	c = node.firstChild
	while ( true )
		if ( ! c )
			return null
		else if ( c.nodeType == 1 ) // element
			return c
		else
			c = c.nextSibling
}


elementChild = function( node, nr ) {

	l = Array()

	while ( true ) {
		if ( ! c )
			break
		else if ( c.nodeType == 1 ) // element
			l.push( c )
		c = c.nextSibling
	}
	return l[nr]
}

/** display object casted to string in alert */
b=function(v){alert(String(v))}

/** returns HTML Form element being parent of node \p node , or \b null if not found */
parentForm = function( node ) {
	while ( true ) {
		if ( ! node )
			return null
		if ( node.tagName.toLowerCase() == 'form')
			return node
		node = node.parentNode
	}
}

function rli(obcject, newSrc){
 	obcject.src = newSrc;
}

function rlb(obcject, color){
 	obcject.bgColor = color;
}
