/* ======================================================================
FUNCTION:	GetRadioValue 
 
INPUT: 		radioObject (object) : a radio button object from an HTML form

RETURNS:		the value of the selected radio button;
				null, if no button selected or invalid radioObject passed
 
DESC:			This function returns the value of the selected radio button in
				a group of radio buttons represented by radioObject. 

PLATFORMS:	Netscape Navigator 2.00 and higher,
			  	Microsoft Internet Explorer 3.02 and higher
====================================================================== */
function GetRadioValue( radioObject ) { 
	var value = null;

	// Validate parameter value
	if (radioObject+"" == "undefined" || radioObject == null)
		return null;

	for (var i=0; i < radioObject.length; i++) { 
		if (radioObject[i].checked) { 
			value = radioObject[i].value;
			break;
		} 
	} // end for loop 
	
	return value;
}

/* ======================================================================
FUNCTION:	GetSelectValue 
 
INPUT: 		selectObject (object) : a select list object from an HTML form

RETURNS:		the value of the selected item in the list;
				null, if no item selected or invalid selectObject passed
 
DESC:			This function returns the value of the value of a selected item in
				an HTML select list represented by selectObject. 

PLATFORMS:	Netscape Navigator 2.01 and higher,
			  	Microsoft Internet Explorer 3.02 and higher
====================================================================== */
function GetSelectValue( selectObject ) {
	// Validate parameter value
	if (selectObject == null)
		return null;
	
	if (selectObject.selectedIndex+"" == "undefined" || 
				selectObject.selectedIndex == null ||
				selectObject.selectedIndex < 0)
		return null;

	return selectObject.options[selectObject.selectedIndex].value;
} 


/******************************************************************
   IsNotEmpty()
   
   tests if passed string is empty, returns true if i
        t contains something and false if not
   
   Author: 
   Date Created: 25/11/99
*******************************************************************/
function IsEmpty( theField ) {
   if ( theField.value == "" ) {
   return true;
	}
	else {
		return false;
	}
}

function invalidExpDate(mm,yy) {
if (( mm == "" ) || (yy == "")){
   return true;
}
else {
 return false;  
}

}


/******************************************************************
   isRequired()
   
        churn thru for required fields
   
   Author: 
   Date Created: 25/11/99
*******************************************************************/
function isRequired(thisForm) {

   var Empty = false;

	if (GetRadioValue(thisForm.choice1) == null) {
		alert("The PollMaster says that  you need to make \n at least a first choice to enter the poll");
		return false;
	}
   else	{

		return true;
	}
}
/******************************************************************
   checkFieldsClubmail()
   
        part of SubmitOnce to prevent loads of submissions of forms
	submitcount =0 is set on the first pass thru on reloading, but it
	pays to reset fields on reload (else they're all there ready for another go)
   
   Author: 
   Date Created: 25/11/99
*******************************************************************/


<!-- Submit Once function -->
var submitcount=0;
function resetRM() {
	document.emailform.name.value="";
	document.emailform.email.value="";
	for (var i=0; i < document.emailform.member.length; i++) { 
		document.emailform.member[i].checked=false;
	} 
	document.emailform.message.value="";
}


function resetClubmail() {
	document.emailform.subject.value="";
	document.emailform.name.value="";
	document.emailform.country.value="";
	document.emailform.email.value="";
	document.emailform.message.value="";
}


function checkFields(ThisForm) {
var alertext="";
if (ThisForm.name.value=="")  {
	alertext = "name "
}
if (ThisForm.email.value=="") {
        alertext = alertext + "email ";
}

if ( (GetSelectValue(ThisForm.country) == "") ||
     (GetSelectValue(ThisForm.country) == null)) {
	alertext = alertext + "country "
     }
if (ThisForm.message.value=="") {
	alertext = alertext + "message " 
}
if (alertext !="") {
   alert(alertext +"missing - please correct and re-submit this form.");
   return false;
   }
else
   {
   if (submitcount == 0)
      {
      submitcount++;
      return true;
      }
   else
      {
      alert("This form has already been submitted.  Thanks!");
      return false;
      }
   }
}

function checkSubmit(ThisForm) {

if (submitcount == 0)
      {
      submitcount++;
      return true;
      }
   else
      {
      alert("This form has already been submitted.  Thanks!");
      return false;
      }

}
