﻿function validCheckList(checkList){
	var checked=new Array();
	var checks=checkList.getElementsByTagName("INPUT");
	var valid=false;
	var other=false;
	for(var i=0; i<checks.length; i++){
		if(checks[i].checked){
			valid=true;
			if(checks[i].parentNode.className=="Other"){other=true; break;}
		}
	}
	
	return {Valid:valid, Other:other};
}

function setupOtherChange(other, specify){
	other.specify=specify;
	other.Update=function(){
		this.specify.disabled=!this.checked;
	}
	other.onchange=function(){this.Update();}
	other.onclick=function(){this.Update();}
	other.Update();
}

function validEmail(email){
	var regex=new RegExp("^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$");
	return email.match(regex);
}
