
var SubNavColor_Default = '#B0AE9D';
var SubNavColor_Selected = '#D4D3C9';

var CurrentSubNav = '';

function getFlashMovieObject(movieName) {
	if (window.document[movieName]) {
		return window.document[movieName];
	}
	if (navigator.appName.indexOf("Microsoft Internet")==-1) {
		if (document.embeds && document.embeds[movieName])
			return document.embeds[movieName];
	} else {
		return document.getElementById(movieName);
	}
}

function getTableRowObject(rowName) {
	if (window.document[rowName]) {
		return window.document[rowName];
	} else {
		return document.getElementById(rowName);
	}
}

function viewSubNav(row, mov, nav) {

	// reset all nav backgrounds
	thisRow = getTableRowObject(row);
	for (var i=1; i<=99; i++) {
		var thatRow = getTableRowObject('row'+i);
		if (thatRow) {
			setRowColor(thatRow, SubNavColor_Default);
		} else { continue; }
	}
	setRowColor(thisRow, SubNavColor_Selected);
	
	// send main flash target movie
	getFlashMovieObject(mov).SetVariable("contentFilename", nav);
}

function setRowColor(theRow, theColor) {
	
    var theCells = null;

	// Get all cells
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    } else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    } else {
        return false;
    }

    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;

    if (typeof(window.opera) == 'undefined' && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    } else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    }

    // Set the new color
    if (theColor) {
        var c = null;
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', theColor, 0);
            } // end for
        } else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = theColor;
            }
        }
    }
    return true;
}

