
/**************************************************************\
 *  htmldom.js v.1.0                                     *
 *  HTML DOM traversal example.                               * 
 **************************************************************
 

{__     {__{___ {______{__       {__{__      
{__     {__     {__    {_ {__   {___{__      
{__     {__     {__    {__ {__ { {__{__      
{______ {__     {__    {__  {__  {__{__      
{__     {__     {__    {__   {_  {__{__      
{__     {__     {__    {__       {__{__      
{__     {__     {__    {__       {__{________ 

{_____        {____     {__       {__
{__   {__   {__    {__  {_ {__   {___
{__    {__{__        {__{__ {__ { {__
{__    {__{__        {__{__  {__  {__
{__    {__{__        {__{__   {_  {__
{__   {__   {__     {__ {__       {__
{_____        {____     {__       {__


 *************************************************************
 *                                                            *                                 *
 *  Copyright (c) 2008 Teral Software. All rights reserved.   *
 *  Created 2-Feb-2008 by Alexandru Tertisco                  *
 *  Last modified: 2-Feb-2008                                 *
 *                                                            *
 \*************************************************************/

 /**
 * removeChildren function removes all cildren elements of the node element 
 * passed as argument.
 * */
 function removeChildren(aNode)
{
  var aChild = aNode.firstChild;         // get first node to remove child
	while(aChild != null){                 // if the child exists
		 removeChildren(aChild);             // remove its children.
		 var aSibling = aChild.nextSibling;  // get its next sibling
		 aNode.removeChild(aChild);          // remove the child.
		 aChild = aSibling;                  // remove the next sibling.
	}
	return; // Done.
}

/**
 * removeNode function removes the node element passed as argument.
 * */
function removeNode(aNode)
{
   removeChildren(aNode);// Remove all node's children first.
	 aNode.parentNode.removeChild(aNode); // Now remove the node itself.
}

/**
 * initPage function removes the first CENTER node element of the document.
 * */
function initPage()
{
 	var centerElements = 
	    document.getElementsByTagName("center"); // Get the CENTER elements list
	if(centerElements.length==0){
	  return; // The  list is empty. Give up
	}
	// The  list is not empty.
	removeNode(centerElements[0]); // remove the first CENTER element.
}