// dysplays on/off if a checkbox is checked/unchecked 
// the id of the <tr>(or other things) has to have the same name as checbox name+"_td"
function display_tr(check)
{
	if (check.checked){
		document.getElementById(check.name+'_td').style.display='';
	}else document.getElementById(check.name+'_td').style.display='none';
}

// dysplays on/off if a radio is checked/unchecked 
// the id of the <tr>(or other things) has to have the same name as checbox name+"_td"
function display_tr_radio(checkName,check)
{
	for (i=0;i<check.length;i++){
		
		if (check[i].checked==true){
			document.getElementById(checkName.name+'_'+i+'_td').style.display='';
		}else{ 
			document.getElementById(checkName.name+'_'+i+'_td').style.display='none';
		}
	}
}

//to check all checkboxes in a form
//parameters are the checked checkbox(or true/false) and form name (the form MUST HAVE AN ID BESIDES NAME)
function checkedAll (checked,form_name) {
	var el = document.getElementById(form_name);
		
	
	for (var i = 0; i < el.elements.length; i++) {
	  	el.elements[i].checked = checked;
	}
}
//email format checking
function emailCheck(who){
	var email=/^[A-Za-z0-9][\w-.]*[A-Za-z0-9]*@[A-Za-z0-9]*([\w-.]*[A-Za-z0-9]\.)+([A-Za-z]){2,4}$/i;
	return(email.test(who));
}

function copy_fields(){
	el_1 = document.form1;
	el_2 = document.form2;
	
	for (var i = 0; i < el_2.elements.length; i++){
	
		document.form2.elements[i].value = document.form1.elements[i].value;
			
//		document.write(document.form2.elements[i].name+"||"+document.form2.elements[i].value+"<br>");
//
//		document.write(document.form1.elements[i].name+"||"+document.form1.elements[i].value+"<br>");
//		document.write("<hr>");	
	}
}






