function addTableAltRows()
{
	var booEven = false;
	var booNoClass = true;
	var strEvenColor = "";
	var strOddColor = "";
	var strTableClass = "";

	var arrTables = document.getElementsByTagName("table");
	for (var h = 0; h < arrTables.length; h++)
	{
		strTableClass = hasClass(arrTables[h]);
		switch(strTableClass)
		{
		case "table2col":
		case "table3col":
		case "table4col":
		case "table5col":
		case "table6col":
		case "table7col":
			strOddColor = "#F2F2F2";
			booEven = false;

			var arrTRs = arrTables[h].getElementsByTagName("tr");
			for (var i = 0; i < arrTRs.length; i++)
			{
				//Check if the tds have a class
				var arrTDs = arrTRs[i].getElementsByTagName("td");
				booNoClass = true;
				for (var j = 0; j < arrTDs.length; j++)
				{
					if (hasClass(arrTDs[j]) != "" && booNoClass)
					{
						booNoClass = false;
					}
				}

				if(! booEven)
				{
					if (booNoClass)
					{
						//Need to add background colour
						for (var j = 0; j < arrTDs.length; j++)
						{
							arrTDs[j].style.backgroundColor = strOddColor;
						}
					}
				} else {
					if( i < 1)
					{
						if (booNoClass)
						{
							//Need to add table heading
							for (var j = 0; j < arrTDs.length; j++)
							{
								arrTDs[j].style.borderTop = "1px #CCCCCC solid";
							}
						}
					}
				}
				booEven = ! booEven;
			}
			break;
		case "teasertable3col":
			strOddColor = "#F2F2F2";
			booEven = false;

			var arrTRs = arrTables[h].getElementsByTagName("tr");
			for (var i = 0; i < arrTRs.length; i++)
			{
				//Check if the tds have a class
				var arrTDs = arrTRs[i].getElementsByTagName("td");
				booNoClass = true;
				for (var j = 0; j < arrTDs.length; j++)
				{
					if (hasClass(arrTDs[j]) != "" && booNoClass)
					{
						booNoClass = false;
					}
				}

				if(! booEven)
				{
					if (booNoClass)
					{
						arrTRs[i].style.backgroundColor = strOddColor;
					}
				}
				booEven = ! booEven;
			}
			break;
		case "tableComparison":
			//With this type of table we need to set up the heading style and alt row colours
			strOddColor = "#F2F2F2";
			booEven = false;

			var arrTRs = arrTables[h].getElementsByTagName("tr");
			for (var i = 0; i < arrTRs.length; i++)
			{
				//Check if the tds have a class
				var arrTDs = arrTRs[i].getElementsByTagName("td");
				booNoClass = true;
				for (var j = 0; j < arrTDs.length; j++)
				{
					if (hasClass(arrTDs[j]) != "" && booNoClass)
					{
						booNoClass = false;
					}
				}

				//Check if the tr has a col span tag
				if(hasColspan(arrTDs[0]) > 1)
				{
					arrTDs[0].style.borderBottom = "1px #9E9E9E solid";
					arrTDs[0].style.fontSize = "80%";
				} else {
					if(i > 1 && i < (arrTRs.length - 1))
					{
						if (booNoClass)
						{
							for (var j = 0; j < arrTDs.length; j++)
							{
								switch(j)
								{
									case 2:
									case 4:
									case 6:
									case 8:
									case 10:
									case 12:
									case 14:
										arrTDs[j].style.backgroundColor = strOddColor;
									break;
								}
							}
						}
					} else {
						if (booNoClass)
						{
							//Need to add table heading
							for (var j = 0; j < arrTDs.length; j++)
							{
								switch(j)
								{
									case 0:
										arrTDs[j].className = "headingNo";
										if(i < 1)
										{
											arrTDs[j].style.borderBottom = "solid 1px #9E9E9E";
										} else {
											arrTDs[j].style.borderBottom = "solid 1px #FFFFFF";
										}
									break;
									case 1:
									case 3:
									case 5:
									case 7:
									case 9:
									case 11:
									case 13:
										arrTDs[j].className = "headingLow";
										if(i > 0)
										{
											arrTDs[j].style.borderTop = "solid 1px #F2F2F2";
										}
									break;
									case 2:
									case 4:
									case 6:
									case 8:
									case 10:
									case 12:
									case 14:
										arrTDs[j].className = "headingHi";
										if(i > 0)
										{
											arrTDs[j].style.borderTop = "solid 1px #EDEDED";
										}
									break;
								}
							}
						}
					}
				}
				booEven = ! booEven;
			}
			break;
		case "tableComparisonWithHeading":
			//With this type of table we need to set up the heading style and alt row colours
			strOddColor = "#F2F2F2";
			booEven = false;

			var arrTRs = arrTables[h].getElementsByTagName("tr");
			for (var i = 0; i < arrTRs.length; i++)
			{
				//Check if the tds have a class
				var arrTDs = arrTRs[i].getElementsByTagName("td");
				booNoClass = true;
				for (var j = 0; j < arrTDs.length; j++)
				{
					if (hasClass(arrTDs[j]) != "" && booNoClass)
					{
						booNoClass = false;
					}
				}

				//Check if the tr has a col span tag
				if(hasColspan(arrTDs[0]) > 1)
				{
					arrTDs[0].style.borderBottom = "1px #9E9E9E solid";
					arrTDs[0].style.fontSize = "80%";
				} else {
					if(i > 1 && i < (arrTRs.length - 1))
					{
						if (booNoClass)
						{
							for (var j = 0; j < arrTDs.length; j++)
							{
								switch(j)
								{
									case 2:
									case 4:
									case 6:
									case 8:
									case 10:
									case 12:
									case 14:
										arrTDs[j].style.backgroundColor = strOddColor;
									break;
								}
							}
						}
					} else {
						if (booNoClass)
						{
							//Need to add table heading
							for (var j = 0; j < arrTDs.length; j++)
							{
								switch(j)
								{
									case 0:
										if(i < 1|| i ==(arrTRs.length -1))
										{
											arrTDs[j].style.borderBottom = "solid 1px #FFFFFF";
											arrTDs[j].className = "headingNo";
										} else {
											arrTDs[j].style.borderBottom = "solid 1px #9E9E9E";
											arrTDs[j].className = "headingNo";
										}
									break;
									case 1:
									case 3:
									case 5:
									case 7:
									case 9:
									case 11:
									case 13:
										if(i < 1)
										{
											arrTDs[j].style.borderTop = "solid 1px #CCCCCC";
											arrTDs[j].style.borderBottom = "solid 0px #FFFFFF";
										} else if(i ==(arrTRs.length -1)) {
											arrTDs[j].className = "headingLow";
											arrTDs[j].style.borderTop = "solid 0px #FFFFFF";
										} else {
											arrTDs[j].className = "headingLow";
										}
									break;
									case 2:
									case 4:
									case 6:
									case 8:
									case 10:
									case 12:
									case 14:
										if(i < 1)
										{
											arrTDs[j].style.borderTop = "solid 1px #CCCCCC";
											arrTDs[j].style.borderBottom = "solid 0px #FFFFFF";
										} else if(i ==(arrTRs.length -1)) {
											arrTDs[j].className = "headingHi";
											arrTDs[j].style.borderTop = "solid 0px #FFFFFF";
										} else {
											arrTDs[j].className = "headingHi";
										}
									break;
								}
							}
						}
					}
				}
				booEven = ! booEven;
			}
			break;
		case "tableBankAccountRates":
			strOddColor = "#F2F2F2";
			//strOddColor = "#FF0000";
			booEven = false;

			var arrTRs = arrTables[h].getElementsByTagName("tr");
			for (var i = 0; i < arrTRs.length; i++)
			{
				if (i < 1)
				{
					//Set up top heading row
					var arrTDs = arrTRs[i].getElementsByTagName("td");
					for (var j = 0; j < arrTDs.length; j++)
					{
						arrTDs[j].style.borderTop = "3px #CCCCCC solid";
						arrTDs[j].style.borderBottom = "3px #585858 solid";
						arrTDs[j].style.height = "50px";
						arrTDs[j].style.paddingTop = "10px";
						arrTDs[j].style.fontWeight = "bold";
						if (j < 1)
						{
							arrTDs[j].style.paddingLeft = "10px";
							arrTDs[j].style.textAlign = "left";
							arrTDs[j].style.color = "#DC1736";
						} else {
							arrTDs[j].style.paddingRight = "20px";
							arrTDs[j].style.textAlign = "right";
							arrTDs[j].style.borderLeft = "1px #CCCCCC solid";
						}
					}				
				} else {
					//Check if the tds have a class
					var arrTDs = arrTRs[i].getElementsByTagName("td");
					booNoClass = true;
					for (var j = 0; j < arrTDs.length; j++)
					{
						if (hasClass(arrTDs[j]) != "" && booNoClass)
						{
							booNoClass = false;
						}
						arrTDs[j].style.height = "26px";
						arrTDs[j].style.lineHeight = "26px";
						arrTDs[j].style.borderBottom = "1px #ABABAB solid";						
						if (j < 1)
						{
							arrTDs[j].style.paddingLeft = "10px";
							arrTDs[j].style.textAlign = "left";
							arrTDs[j].style.fontWeight = "bold";
						} else {
							arrTDs[j].style.paddingRight = "20px";
							arrTDs[j].style.textAlign = "right";
							arrTDs[j].style.borderLeft = "1px #CCCCCC solid";
						}
					}
	
					if(! booEven)
					{
						if (booNoClass)
						{
							arrTRs[i].style.backgroundColor = strOddColor;
						}
					}
					booEven = ! booEven;
				}
			}
			break;
		}
	}
}

function hasClass(obj)
{
	var strResult = "";
	if (obj.getAttributeNode("class") != null) {
		strResult = obj.getAttributeNode("class").value;
	}
	return strResult;
}

function hasColspan(obj)
{
	var strResult = 0;
	if (obj.getAttributeNode("colspan") != null) {
		strResult = obj.getAttributeNode("colspan").value;
	}
	return strResult;
}