function gotoForum() {
elm=document.theForm.theSelect.value;
for (i=0;i<4;i++){if (document.theForm.theRadio[i].checked==true) {foo=i}}
var fooArray=new Array(4)
fooArray[0]="Forum"; 
fooArray[1]="Meeting Points"; 
fooArray[2]="Notice of Events"; 
fooArray[3]="Sporting Links"; 
foo=fooArray[foo];
window.open ("gotoForum.asp?forumID="+elm+"&topicTITLE="+foo); 
}

function showBMIHelp() {
message="For adults, a body mass index:\n\n";
message=message+"- over 30 is considered obese.\n";
message=message+"- between 25 and 29.9 is considered overweight.\n";
message=message+"- between 18.5 and 24.9 is considered a healthy BMI.\n";
message=message+"- under 18.5 is consider underweight.\n";
window.alert(message);
}

function showHeartRateHelp() {
message="This method of calculating your target training zone is based on your maximal heartrate and resting pulse.";
window.alert(message);
}

function checkCalculateBMI() {
error=false;
if (document.BMIForm.height.value=='') {error=true;window.alert('Please enter your height.');}
if (error==false&&document.BMIForm.weight.value=='') {error=true;window.alert('Please enter your weight.');}
if (error==false) {
	document.BMIForm.bmi.value=document.BMIForm.weight.value/((document.BMIForm.height.value)*(document.BMIForm.height.value));
	document.BMIForm.bmi.value=document.BMIForm.bmi.value*10000;
	document.BMIForm.bmi.value=Math.round(document.BMIForm.bmi.value*100)/100;
	}
}

function checkCalculateHeartRate() {
error=false;
if (document.heartRateForm.age.value=='') {error=true;window.alert('Please enter your age.');}
//if (error==false&&document.heartRateForm.bpm.value=='') {error=true;window.alert('Please enter your heart rate.');}
if (error==false) {
	document.heartRateForm.max.value=220-document.heartRateForm.age.value;
	hrr=220-document.heartRateForm.age.value;
	document.heartRateForm.lower.value=Math.round(hrr*.6);
	document.heartRateForm.upper.value=Math.round(hrr*.8);
	}
}

function checkSubscribe() {
error=false;
if (document.subscribeForm.name.value=='') {error=true;window.alert('Please enter your name.');}
if (error==false&&document.subscribeForm.email.value=='') {error=true;window.alert('Please enter your email address.');}
if (error==false) {document.subscribeForm.submit();}
}

function checkSubmitContactUs() {
error=false;
if (document.theForm.name.value=='') {error=true;window.alert('Please enter your name.');}
if (error==false&&document.theForm.email.value=='') {error=true;window.alert('Please enter an email address.');}
if (error==false&&document.theForm.notes.value=='') {error=true;window.alert('Please enter some notes.');}
if (error==false) {document.theForm.submit();}
}

/*
function goto(a,b) {
elm=a
if (b=='State') {elm="index.asp?page=Meeting Points&theState="+elm;}
else {elm="index.asp?page=Meeting Points&theCategory="+elm;}
location.href=elm;
}
*/

function goto(a,b) {
foo=document.theForm.categorySelect.value;
elm=document.theForm.stateSelect.value;
kip=document.theForm.postCodeSelect.value;
elm="index.asp?page=Meeting Points&theCategory="+foo+"&theState="+elm+"&thePostCode="+kip;
location.href=elm;
}

function checkMeetingPoint() {
error=false;
if (document.theForm.category.value=='') {error=true;window.alert('Please select a category.');}
if (error==false&&document.theForm.state.value=='') {error=true;window.alert('Please select a state.');}
if (error==false&&document.theForm.location.value=='') {error=true;window.alert('Please enter a location for your Meeting Point.');}
if (error==false&&document.theForm.times.value=='') {error=true;window.alert('Please enter a time, or set of times, for your Meeting Point.');}
if (error==false&&document.theForm.description.value=='') {error=true;window.alert('Please enter a description of your Meeting Point.');}
if (error==false&&document.theForm.contactName.value=='') {error=true;window.alert('Please enter a contact name.');}
if (error==false&&document.theForm.contactEmailAddress.value=='') {error=true;window.alert('Please enter an email address.');}
if (error==false&&document.theForm.contactPhoneNumber.value=='') {error=true;window.alert('Please enter a phone number.');}
if (error==false&&document.theForm.contactPhoneNumber.value=='') {error=true;window.alert('Please enter a phone number.');}
if (error==false) {document.theForm.submit();}
}

function CheckMaxLength(Object, MaxLen) {
if(Object.value.length > MaxLen) {Object.value = Object.value.substring(0, MaxLen);}
}
