/*
See yak.php for information and license terms
*/

var className = ''

function getElement(id) {
    if (document.getElementById != null) {
        return document.getElementById(id)
    }
    else {
        return document.all[id]
    }
}

function toggleDisplay(cell) {
    row = cell.parentNode;
    nextRow = row.parentNode.rows[row.rowIndex+1];
    nextRow.className = className;
    if (className == '') {
        className = 'hidden';
    }
    else {
        className = '';
    }
}

function copyRow(tableName) {
	table = document.getElementById(tableName);
	cells = table.rows[table.rows.length-1].cells;
	var newrow = document.createElement('tr');
	for (var i = 0; i < cells.length; i++) {
		cell = document.createElement('td');
		cell.innerHTML = cells[i].innerHTML;
		newrow.appendChild(cell);
	}
	table.appendChild(newrow);
}

function findInput(cell) {
    row = cell.parentNode;
    for (var i = cell.cellIndex-1; i >= 0; i--) {
        var sibling = row.cells[i];
        if (sibling.firstChild.nodeName.toLowerCase() == 'input') {
            return sibling.firstChild;   
        }
    }
    return null;
}


