//******************************************************************************************************************************
//* Build Lodge Links
//******************************************************************************************************************************
function BldLodgeLinks(thead, tbody) 
{
	var th, tr, td;
	
	DrawTableHeader(thead);	
	dataSw = "Y";
	
	for (var i = 0; i < 430; i++) 
	{
		if (lodge[i][9] != "NA")
		{
			DrawTableData(tbody, i);
		}
	}
}	

//******************************************************************************************************************************
//* Draw table header
//******************************************************************************************************************************
function DrawTableHeader(thead)
{
	thead = document.getElementById(thead);
	ClearTable(thead);
	tr = thead.insertRow(thead.rows.length);
	
	td = tr.insertCell(tr.cells.length);
	td.setAttribute("class", "ctr");
	td.innerHTML = "";
}

//******************************************************************************************************************************
//* Delete rows
//******************************************************************************************************************************
function ClearTable(table)
{
	while (table.rows.length > 0)
	{
		table.deleteRow(0);
	}
}

//******************************************************************************************************************************
//* Draw table data
//******************************************************************************************************************************
function DrawTableData(tbody, i)
{
	tbody = document.getElementById(tbody);
	if (dataSw == "Y")
	{
		ClearTable(tbody);		
		dataSw = "N";
	}
	tr = tbody.insertRow(tbody.rows.length);

	td = tr.insertCell(tr.cells.length);
	td.setAttribute("class", "ctr");
	td.innerHTML = '<a href="'+lodge[i][9]+'" target="_blank">Lodge No.'+lodge[i][0]+', '+lodge[i][1]+', '+lodge[i][4]+'</a>';
//	td.innerHTML = '<a href="'+website[i]+'">Lodge No.'+number[i]+', '+lodge[i]+', '+city[i]'</a>';
//	 
}

