﻿//Project:      McGuinnessSite
//Page:         McGuinness.master
//Procedure:    init
//Description:  Forces the tigra menu to resize with the browser down to a point
//              nowrap is added to the cells which sets a minimum.
//Created By:   Russell Hart - 05/18/2006
//Last Updated: Russell Hart - 05/18/2006
function init(){
    var intWidth;
    var objTBody;
    var objRow;
    var objCell;
    var objOuterTable;
    var tdElement = document.getElementById("menuColumn");
    var objTables = tdElement.getElementsByTagName('table');
    
    //First set outer menu table width.
    objTables[0].width = "100%";
    objOuterTable = objTables[0];
	for (var i = 0; objOuterTable.childNodes[i].tagName != 'TBODY'; i++);
	objTBody = objOuterTable.childNodes[i]; //get TBODY element, which has the TR children
	objRow = objTBody.childNodes[0];
	//Set Outer Row Width.
	objRow.width = "100%";
	//Divide up space into individual cells.
	objRow.childNodes[0].width = "17%";
	objRow.childNodes[0].noWrap = true;
	objRow.childNodes[1].width = "17%";
	objRow.childNodes[1].noWrap = true;
	objRow.childNodes[2].width = "16%";
	objRow.childNodes[2].noWrap = true;
	objRow.childNodes[3].width = "16%";
	objRow.childNodes[3].noWrap = true;
	objRow.childNodes[4].width = "17%";
	objRow.childNodes[4].noWrap = true;
	objRow.childNodes[5].width = "17%";
	objRow.childNodes[5].noWrap = true;
	//Set all the menu item tables to fill in the space allowed for them.
    for(var j = 1; j < objTables.length; j++){
        objTables[j].width = "100%";
        //Finally set the sub-cell to block wrapping text.
        for (var i = 0; objTables[j].childNodes[i].tagName != 'TBODY'; i++);
	    objTBody = objTables[j].childNodes[i]; //get TBODY element, which has the TR children
        objCell = objTBody.childNodes[0].childNodes[0];
        objCell.noWrap = true;
    }
    return;
}
