﻿function AlternativeColorTable(element, Color, AltColor, FirstRowIncluded)
{
	var trs = element.getElementsByTagName("tr");

	for (var i = 0; i < trs.length; i++)
	{
		if(i > 0)
		{
			if(i%2 == 0)
			{
				var mytr = trs[i];
				mytr.style.background = Color;
			}
			else
			{
				var mytr = trs[i];
				mytr.style.background = AltColor;
			}
		}
		else if(FirstRowIncluded)
		{
			if(i%2 == 0)
			{
				var mytr = trs[i];
				mytr.style.background = Color;
			}
			else
			{
				var mytr = trs[i];
				mytr.style.background = AltColor;
			}
		}
	}
}


function FixTablesAlternative(element, Color, AltColor, FirstRowIncluded, AlsoNestedTables)
{
    if(element.nodeName == "TABLE") element = element.parentNode;

    var elementList = element.childNodes;
    for(var i = 0;i < elementList.length;i++)
    {
        if(elementList[i].nodeName == "TABLE")
        {
            AlternativeColorTable(elementList[i], Color, AltColor, FirstRowIncluded);
            if(AlsoNestedTables)
            {
                //FixTablesAlternative(elementList[i], Color, AltColor, FirstRowIncluded, AlsoNestedTables);
            }
        }
    }
}