/**
 * DOM manipulation utilities
 */
Lifetype.Dom = function() 
{
	// nothing yet
}

Lifetype.Dom.$ = function( f )
{
	return( document.getElementById( f ));
}

Lifetype.Dom.$F = function( f )
{
	return( document.getElementById( f ).value );
}

/**
 * Hides an element from the DOM, only if exists
 *
 * @param elemId
 */
Lifetype.Dom.hide = function( elemId )
{
	elem = document.getElementById( elemId );
	if( elem )
		elem.style.display = 'none';
}

/**
 * Shows an existing element in the DOM, only if exists
 *
 * @param elemId
 */
Lifetype.Dom.show = function( elemId )
{
	elem = document.getElementById( elemId );
	if( elem )
		elem.style.display = 'block';
}

/**
 * sets the innerHTML property of the given element
 *
 * @param elemId
 * @param content
 */
Lifetype.Dom.setContent = function( elemId, content )
{
	elem = document.getElementById( elemId );
	if( elem ) 
		elem.innerHTML = content;
}

/**
 * Returns a list of elements by tag name. For performance
 * reasons, it is advisable to pass a root element as the second
 * parameter or else a full search starting with the 'document'
 * object will be performed.
 *
 * @param tagName
 * @param rootElem
 * @return An array of objects
 */
Lifetype.Dom.getElementsByTagName = function( tagName, rootElem )
{
	return( YAHOO.util.Dom.getElementsBy( function( elem ) { return( true ); }, tagName, rootElem ));
}
