<!--



function clearvals(allname,cbname) { 
	// function: This function sets an "all" checkbox to false" if another box is ticked/checked
		var mwind = allname;
		var cbwind = cbname;
		var allcheck = allname.checked;
		var cbcheck = cbname.checked;
if ((allcheck == true) && (cbcheck == true))
 {
    allname.checked = false  
   } 
		
	}
	
function allvals(cboxname,allcb) { 
	// function: This function sets checkboxes to false if another the all box is ticked/checked
	// Alternatively if no boxes are checked All box set to checked 
		var imatch, i;
		var cbname, allval, ballok, allname;
		var cbrootname = cboxname;
		var allval = allcb.checked;
		allname = allcb;
			
	ballok = false;	
  // go through all the form elements and look fo entires belong to the checkbox group
   for (i=0;i<window.document.testform.length;i++){
        cbname = window.document.testform.elements[i].name ;
		imatch = cbname.indexOf(cbrootname);
	
		// if checheck box found and not the "all" box
		if ((imatch > -1) && (cbname != cbrootname + "_0"))
			{
			if (allval == true) // all checkbox is checked
				{
				window.document.testform.elements[i].checked = false
				ballok = true;	
				}
			else
				{
					if (window.document.testform.elements[i].checked == true)
						{
						//alert(cbname);
						ballok = true;
						}
				}		
			//alert(cbname)
			}   
   }
	//alert(name);
	if (ballok == false)
		{
			allname.checked = true;
		}	 
	}	
// -->

