//<![CDATA[
// (c) 2005 Deep Web Technologies
// Author: Frank Caviggia (frank@deepwebtech.com)

function clearText(thefield)
{
  if (thefield.defaultValue==thefield.value){
	thefield.value = "";
  }
}

// Resets Form
function reset_form ()
{
	a = document.search.getElementsByTagName("input");
	for (i=0;i<a.length;i++) {
		if (a[i].type == 'checkbox') {
			a[i].checked = false;
		}
		if (a[i].type == 'text') {
			a[i].value = "";
		}
	}
}

 //All id's array
 var all = new Array;
 //each id needs to be unique
 all.push("aapg","acm","aiaa","ams","asme","asce","aip","slac","spie","acs");
 // check all flag
 var flag = false;

 // Checks if the check all should be checked
 function check_status (field)
 {
   var i = 0;
   var j = 0;
 
   if (flag == true) {
   field[field.length-1].checked = false;
   flag = false;
   } else {
	 for (i=0;i<field.length;i++) {
	  if (field[i].checked == true) {
		j++;
	  }
	}
  
	if (j == (field.length-1))
	{
	  document.getElementById('all').checked = true;
	  flag = true;
	}
  }
}

// Checks or unchecks all checkboxes
function check_all (field) 
{
  if (flag == false) {
	for (i = 0; i < field.length; i++) {
	  field[i].checked = true;
	}
	flag = true;
  } else {
	for (i = 0; i < field.length; i++) {
	  field[i].checked = false; 
	}
  flag = false;
 }
}

// Author: Frank Caviggia (frank@deepwebtech.com)
//]]>
