var sColor = new Array(new Array("black","000000"),new Array("white","ffffff"),new Array("green","99CC00"),new Array("red","6e1347"));
function parseNode(aNode)
{
  for(var i=0;i<aNode.childNodes.length;i++)
  {
    if(aNode.childNodes[i].nodeType==1)
    {
      // Element Node (not text)
      if(aNode.childNodes[i].childNodes.length>0)parseNode(aNode.childNodes[i]);
      if(aNode.childNodes[i].className!='')
      {
        if(aNode.childNodes[i].className.substring(0,4).toUpperCase()=="FONT")
        {
          for(var j=0;j<sColor.length;j++)
            aNode.childNodes[i].className=aNode.childNodes[i].className.replace(new RegExp(sColor[j][0],"i"),sColor[j][1]);

          var aFont = aNode.childNodes[i].className.substring(4,7).toUpperCase();
          var flFontMatched = false;
          if(aFont=="ARR")
          {
            aNode.childNodes[i].style.fontFamily="Arial";
            flFontMatched = true;
          }
          if(aFont=="TNR")
          {
            aNode.childNodes[i].style.fontFamily="Times New Roman";
            flFontMatched = true;
          }
          if(aFont=="VER")
          {
            aNode.childNodes[i].style.fontFamily="Verdana";
            flFontMatched = true;
          }

          if(flFontMatched == true)
          {
            if(!isNaN(parseFloat(aNode.childNodes[i].className.substring(7,9))))
            {
              aNode.childNodes[i].style.fontSize = aNode.childNodes[i].className.substring(7,9) + "px";
            }
            if(aNode.childNodes[i].className.substring(9,15).length==6)
            {
              aNode.childNodes[i].style.color = "#" + aNode.childNodes[i].className.substring(9,15);
            }
            var aStyles = aNode.childNodes[i].className.substring(15,18);
            var aWeight="normal";
            var aStyle="normal";
            var aDecoration="none";
            if(/b/i.test(aStyles))
            {
              aWeight = "bold";
            }
            if(/i/i.test(aStyles))
            {
              aStyle = "italic";
            }
            if(/u/i.test(aStyles))
            {
              aDecoration = "underline";
            }
            aNode.childNodes[i].style.fontWeight = aWeight;
            aNode.childNodes[i].style.fontStyle = aStyle;
            aNode.childNodes[i].style.textDecoration = aDecoration;
          }
        }

        if(aNode.childNodes[i].className.substring(0,5).toUpperCase()=="INPUT")
        {
            if(!isNaN(parseFloat(aNode.childNodes[i].className.substring(5,8))))
            {
              aNode.childNodes[i].style.width = parseFloat(aNode.childNodes[i].className.substring(5,8)) + "px";
            }
            if(!isNaN(parseFloat(aNode.childNodes[i].className.substring(9,12))))
            {
              aNode.childNodes[i].style.height = parseFloat(aNode.childNodes[i].className.substring(9,12)) + "px";
            }
            aNode.childNodes[i].style.border = "1px solid #7F9DB9";
        }

      }
    }

  }
}

