<!-- 

/*===============================================
 Eastern Homelessness Network Intranet					
 ©2002 Artlandish. www.artlandish.com.au
 ===============================================
 All rights reserved. One copy licensed for use
 by Wesley Melbourne Mission and the
 Eastern Homelessness Network Intranet only.					
 No unauthorised duplication or distribution is	
 permitted. Artlandish copyright notices must	
 remain in the ASP sections of this code.		
 ===============================================

 -----------------------------------------------
  /SHARED/MODCHECKFORM.JS
 -----------------------------------------------*/
function checkFields(form) {
  fullAlphabet = "abcdefghijklmnopqrstuvwxyz"

  if (form.strUsername.value=="") {
    	alert("Please fill in all fields");
		return false ;
  }

  for (i=0 ; i<form.strUsername.value.length ; i++) {
	numeric=false ;
	alpha=false ;
	checkChar=form.strUsername.value.charAt(i) ;

	for (i=0 ; i<26 ; i++) {
		charAlpha=fullAlphabet.charAt(i) ;
		if (checkChar.toLowercase == charAlpha) {
			alpha=true ;
		}
	}

	for (i=0 ; i<10 ; i++) {
		if (checkChar == i) {
			numeric=true ;
		}
	}

  	if (numeric==false && alpha==false)
  	{
    	alert("Please check the fields:\n Only numbers and letters permitted");
		//formField.focus() ;
		return false ;
  	}
  }
  return true ;
}

/* generic check for number(ie 0-9) */
function checkNumber(numberField) {
  allNumeric=true ;
  if (numberField.value.length==0)
  {
    return true ;
  }

  for (i=0 ; i<numberField.value.length ; i++)
  {
    checkChar=numberField.value.charAt(i) ;
    if (checkChar<'0' || checkChar>'9')
	{
	  allNumeric=false ;
	}  
  }
  
  if (allNumeric==false)
  {
    alert("Please check the field:\n Only numbers permitted User");
	numberField.focus() ;
	return false ;
  }
  return true ;
}



/* Generic check email function*/
function checkEmail(emailAddy) {
  if (emailAddy.value.length==0)
  {
    return true ;
  }
  if (emailAddy.value.indexOf("@",0) < 1 || emailAddy.value.indexOf(".",0) < 1)
  {
    alert("Please check the field:\n The email address appears incorrectly formed") ;
    emailAddy.focus() ;
	return false ;
  }
  return true ;
}

/* Function to check if year is valid ie. Initial value of "Year" or otherwise it must be a 
   numeric. Don't worry if the person believes they are a few centuries old! */
function checkYear(numberField) {
  allNumeric=true ;
  if (numberField.value.length==0 || numberField.value=="Year")
  {
    return true ;
  }

  for (i=0 ; i<numberField.value.length ; i++)
  {
    checkChar=numberField.value.charAt(i) ;
    if (checkChar<'0' || checkChar>'9')
	{
	  allNumeric=false ;
	}  
  }
  
  if (allNumeric==false)
  {
    alert("Please check the field:\n Only numbers permitted");
	numberField.focus() ;
	return false ;
  }
  
  return true ;
}

/* generic check for number(ie 0-9) 
function checkNumber(numberField) {
  allNumeric=true ;
  if (numberField.value.length==0)
  {
    return true ;
  }

  for (i=0 ; i<numberField.value.length ; i++)
  {
    checkChar=numberField.value.charAt(i) ;
    if (checkChar<'0' || checkChar>'9')
	{
	  allNumeric=false ;
	}  
  }
  
  if (allNumeric==false)
  {
    alert("Please check the field:\n Only numbers permitted");
	numberField.focus() ;
	return false ;
  }
  return true ;
}
*/
/* generic phone number checker allowing brackets for prefix */
function checkPhone(phoneField) {
  allNumeric=true ;
  if (phoneField.value.length==0)
  {
    return true ;
  }
  
  for (i=0 ; i<phoneField.value.length ; i++)
  {
    checkChar=phoneField.value.charAt(i) ;
    if (checkChar!=' ' && checkChar!='\(' && checkChar!='\)'  && (checkChar<'0' || checkChar>'9') )
	{
	  allNumeric=false ;
	}  
  }
  
  if (allNumeric==false)
  {
    alert("Please check the field:\n Only numbers, spaces and \(\) permitted");
	phoneField.focus() ;
	return false ;
  }
  return true ;
}

/* Special purpose routine to check the fields that are supposed to be filled have been filled
   or else return back to the form. */
function tblmembersForm(tblmembers) {
  allCorrect=true ;
  
  if (tblmembers.strMemberFirstName.value=="" || 
      tblmembers.strMemberLastName.value=="" ||
	  tblmembers.strGroupsID.value=="" ||
	  tblmembers.strMemberPhone.value=="" ||
	  tblmembers.strMemberEmail.value=="" ) {
    allCorrect=false ;
  }
  if (allCorrect==false)
  {
    alert("Please fill in all fields marked *") ;
	return false ;
  } 
    return true ;
}

function tblagencyForm(tblagency) {
  allCorrect=true ;
  
  if (tblagency.strAgencyName.value=="" || 
	  tblagency.strGroupsID.value=="" ) {
    allCorrect=false ;
  }
  if (allCorrect==false)
  {
    alert("Please fill in all fields marked *") ;
	return false ;
  } 
    return true ;
}

function tblnewsForm(tblnews) {
  allCorrect=true ;
  
  if (tblnews.strNewsTitle.value=="" || 
      tblnews.lngNewsCategoryID.value=="" ||
	  tblnews.strNewsDescription.value=="" ||
	  tblnews.dtmNewsDateArchive.value=="" ) {
    allCorrect=false ;
  }
  if (allCorrect==false)
  {
    alert("Please fill in all fields marked *") ;
	return false ;
  } 
    return true ;
}

function tbllinksForm(tbllinks) {
  allCorrect=true ;
  
  if (tbllinks.strLinksName.value=="" || 
      tbllinks.lngLinksCategoryID.value=="" ||
	  tbllinks.strLinksURL.value=="" ||
	  tbllinks.strLinksComments.value=="" ) {
    allCorrect=false ;
  }
  if (allCorrect==false)
  {
    alert("Please fill in all fields marked *") ;
	return false ;
  } 
    return true ;
}

function tbllibraryForm(tbllibrary) {
  allCorrect=true ;
  
  if (tbllibrary.strLibraryTitle.value=="" || 
      tbllibrary.lngLibraryCategoryID.value=="" ||
	  tbllibrary.strLibraryAuthor.value=="" ||
	  tbllibrary.dtmLibraryUpdate.value=="" ||
	  tbllibrary.strLibraryDescription.value=="") {
    allCorrect=false ;
  }
  if (allCorrect==false)
  {
    alert("Please fill in all fields marked *") ;
	return false ;
  } 
    return true ;
}
function tbllibrarycategoryForm(tblresources) {
  allCorrect=true ;
  
  if (tblresources.strLibraryCategoryName.value=="") {
    allCorrect=false ;
  }
  if (allCorrect==false)
  {
    alert("Please fill in all fields marked *") ;
	return false ;
  } 
    return true ;
}
function tblresourcesForm(tblresources) {
  allCorrect=true ;
  
  if (tblresources.strResourcesTitle.value=="" || 
      tblresources.lngResourcesCategoryID.value=="" ||
	  tblresources.strResourcesAuthor.value=="" ||
	  tblresources.dtmResourcesUpdate.value=="" ||
	  tblresources.strResourcesDescription.value=="") {
    allCorrect=false ;
  }
  if (allCorrect==false)
  {
    alert("Please fill in all fields marked *") ;
	return false ;
  } 
    return true ;
}
function tblresourcescategoryForm(tblresources) {
  allCorrect=true ;
  
  if (tblresources.strResourcesCategoryName.value=="") {
    allCorrect=false ;
  }
  if (allCorrect==false)
  {
    alert("Please fill in all fields marked *") ;
	return false ;
  } 
    return true ;
}

function emailnewsForm(emailnews) {
  allCorrect=true ;
  
  if (emailnews.strEmailName.value=="" ) {
    allCorrect=false ;
  }
  if (allCorrect==false)
  {
    alert("Please fill in your email address") ;
	return false ;
  } 
    return true ;
}

//-->

//remove yellow input field fill
//caused by Google Toolbar
function killAutofill(){
  is = document.getElementsByTagName("INPUT");
  for(i=0;i<is.length;i++)
    is[i].style.backgroundColor = "";
  ss = document.getElementsByTagName("SELECT");
  for(i=0;i<ss.length;i++)
    ss[i].style.backgroundColor = "";
}
window.onload=killAutofill;
