/**
 * Create checkmarks
 */
function createchecks() {

// Get table reference
	t = document.getElementById('table1');
	cells = t.rows[0].cells;

// If hidden, change display to hidden
	for (var j=0; j<cells.length; j++) {
		if (new RegExp("(^|\\s)"+"hidden"+"(\\s|$)").test(cells[j].className)) {
			hidecol(t, j, 1);
		}
	}

// Create a new paragraph to hold the checkboxes
	var checkbox_div = document.getElementById('checkbox_here');
	var newPara = document.createElement('p');
	checkbox_div.appendChild(newPara);

// Create a checkbox for each column
	for (var j=0; j<cells.length; j++) {
		if (cells[j].style.display=='') {
			checked = "checked";
		}
		else {
			checked = "";
		}
		onclick = "hidecol(t, " + j + ", !this.checked)";
		var text = cells[j].innerHTML;

// Determine if there are two lines in the title bar.  If so, only take first line.
// This doesn't work for msie now for some reason.
		last_index = text.indexOf("<br");
		if (last_index !=-1) {
			text = text.substring(0,last_index);
		}
		newPara.innerHTML += '<input type=checkbox ' + checked + ' onClick ="' + onclick + '">' + text + '<br>';
	}
//           newPara.innerHTML += '</p>';
};


/**
 * Hide or unhide a column.
 * t is the table object reference
 * col is the column number to hide/unhide (first column would be 0)
 * hide is boolean: 1 to hide, 0 to unhide
 */
function hidecol(t, col, hide) {
// Get table reference
	t = document.getElementById('table1');

// Determine if we're going to hide or unhide
	if (hide==1) {
		display = "none";
	}
	else {
		display = "";
	}

// Hide all id elements in this column
	for (var j=0; j<t.rows.length; j++) {
		t.rows[j].cells[col].style.display = display;
	}
};
