/*
	These are the functions associated with the active controls (save the region
	selector) on the interface.  They utilize some functions found in a file called
	"firefoxSaves.js" that allow us to work with both Firefox's standards-compliant
	DOM model and other browsers' fuzzier (if more convenient) DOM models.  Due to
	inconsistent javascript and DOM support across browsers (especially older browsers),
	these functions are probably more susceptible to bugs than might be desirable.
	It is critical, therefore, that a static, pure-html (or pure php, of course) version
	of the interface be given to users who can't get the active version to work. 
*/

function openPopUp(url) {
	var pop = window.open(url,'_blank','location=0');
	pop.moveTo(screen.availWidth,100);
	pop.resizeTo(500,600);
}

function all_toggle(table_id, all_node, active_class, inactive_class) {
	var table = (document.getElementById(table_id));
	if (table.className == active_class) {
			table.className = inactive_class;
		}
	else {
			table.className = active_class;
		}	
	var tbody = first_child(table);
	var checked = all_node.checked;
	for (var i = 0; i < tbody.childNodes.length; i++) {
		row = tbody.childNodes[i];
		if (!(is_ignorable(row))) {
		for (var j = 0; j < row.childNodes.length; j++) {	
			if (!(is_ignorable(row.childNodes[j]))) {	
			first_child(row.childNodes[j]).disabled = checked;		
			}}
		}
		}
}		

function all_toggle_to_boolean(bool, table_id, all_node, active_class, inactive_class) {
	all_node.checked=!(bool);
	var table = (document.getElementById(table_id));
	if (bool) {
			table.className = active_class;	
		}
	else {
			table.className = inactive_class;
		}	
	var tbody = first_child(table);
	for (var i = 0; i < tbody.childNodes.length; i++) {
		row = tbody.childNodes[i];
		if (!(is_ignorable(row))) {
		for (var j = 0; j < row.childNodes.length; j++) {	
			if (!(is_ignorable(row.childNodes[j]))) {	
			first_child(row.childNodes[j]).disabled = !(bool);		
			}}
		}
		}
}		
