// JavaScript Document
function pop_window(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function popUp(URL ) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=650,height=500,left = 326,top = 257');");
}
function doClearField($theForm,$theField) {
	 document.forms[$theForm].elements[$theField].value = "" 
}
function formConfirm(i) {
	if ( i=='delRecord')
		var answer = confirm('LAST CHANCE: Are you sure you wish Delete this record ?');
	else 
		var answer = confirm('LAST CHANCE: Are you sure  ?');
	if (answer){
			return true;
	}
	else {
			return false;
	}
}
function getElementsByTagName(node, tagName) {
  tagName=tagName.toUpperCase();
  var els = [];
  if (node.elements) {
	node = node.elements;
  }
  for (i in node) {
	if (node[i] && tagName == node[i].tagName) {
	  els.push(node[i]);
	  if (node[i].id) {
		els[node[i].id] = node[i];
	  }
	  /* Could also record nodes by name in els, but it's probably not worth the
		 computation
	  */
	}
	/*should probably recurse; if so, test whether sub-nodes have already
	  been added to els.
	  */

  }
  return els;
}

function setCheckedState (form, state) {
  if (!form) {
	form = document;
  }
  if (!form.getElementsByTagName) {
	form.getElementsByTagName = function(tagName) {
	  return getElementsByTagName(this, tagName);
	}
  }

  var inputs = form.getElementsByTagName('input');
  for (i=0; i<inputs.length; ++i) {
	if ('checkbox' == inputs[i].type.toLowerCase()) {
	  inputs[i].checked=state;
	}
  }
}

function checkAll(form) {
  setCheckedState(form, true);
}

function uncheckAll(form) {
  setCheckedState(form, false);
}