<!--
function Validate()
{
	 // Declaring required variables
	var digits = "0123456789";
	// non-digit characters which are allowed in phone numbers
	var phoneNumberDelimiters = "()- ";
	// characters which are allowed in international phone numbers
	// (a leading + is OK)
	var validWorldPhoneChars = phoneNumberDelimiters + "+";
	// Minimum no of digits in an international phone no.
	var minDigitsInIPhoneNumber = 10;
	
	function isInteger(s)
	{
		var i;
		for (i = 0; i < s.length; i++)
		{   
			// Check that current character is number.
			var c = s.charAt(i);
			if (((c < "0") || (c > "9"))) return false;
		}
		// All characters are numbers.
		return true;
	}
	
	function stripCharsInBag(s, bag)
	{
		var i;
		var returnString = "";
		// Search through string's characters one by one.
		// If character is not in bag, append to returnString.
		for (i = 0; i < s.length; i++){   
			var c = s.charAt(i);
			if (bag.indexOf(c) == -1) returnString += c;
		}
		return returnString;
	}
	
	function checkInternationalPhone(strPhone)
	{
		s=stripCharsInBag(strPhone,validWorldPhoneChars);
		return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
	}	
	
	//------------------- Sender firstname -------------------
	if ( document.Enquiryform.firstname.value == ""  )
	   {if (!(PrintMesg(document.Enquiryform.firstname,"Please enter First Name.")))
	   {return false;}}
	 else  { 
	   if (!SpaceChk(document.Enquiryform.firstname))
		{if (!(PrintMesg(document.Enquiryform.firstname,"Please enter First Name other than space")))
		{return false;}}
	}
	//------------------- Sender lastname -------------------
	if ( document.Enquiryform.lastname.value == ""  )
	   {if (!(PrintMesg(document.Enquiryform.lastname,"Please enter Last Name.")))
	   {return false;}}
	 else  { 
	   if (!SpaceChk(document.Enquiryform.lastname))
		{if (!(PrintMesg(document.Enquiryform.lastname,"Please enter the Last Name other than space")))
		{return false;}}
	}


	//-------------------- phone1----------
	phone1 = document.Enquiryform.phone1.value
 	if (phone1  == "")
    {if (!(PrintMesg(document.Enquiryform.phone1,"Please enter The Phone No (business hour)")))
	{return false;}}
		
	if (checkInternationalPhone(phone1)==false)
	{
		alert("Please Enter a Valid Phone Number including area code (business hour). Eg. 0242223333");
		phone1="";
		document.Enquiryform.phone1.focus();
		return false;
	}
	
	//-------------------- phone2----------
	/*phone2 = document.Enquiryform.phone2.value
 	if (phone2  == "")
    {if (!(PrintMesg(document.frmEmail.phone2,"Please enter The Phone No (after hour)")))
	{return false;}}
		
	if (checkInternationalPhone(phone2)==false)
	{
		alert("Please Enter a Valid Phone Number (after hour)");
		phone2="";
		document.Enquiryform.phone2.focus();
		return false;
	}
	*/
	//-------------------- email----------
	mail = document.Enquiryform.email.value
	if (mail  == "")
	{
		if (!(PrintMesg(document.Enquiryform.email,"Please enter From Email address")))
		{	return false;	}
	}
	else { 
		n = mail.indexOf("@")
	   	if (n >= 0)
	   	{ 
			newstr = mail.substring(n)
		 	n= newstr.indexOf(".")
		 	if (n<0)
			{
				if (!(PrintMesg(document.Enquiryform.email,"Enter a valid E-mail Address")))
				{	return false;	}
			}
	   	} 
	   	else
		{
			if (!(PrintMesg(document.Enquiryform.email,"Enter a valid E-mail Address")))
			{	return false;	}
		}
	}
	
	//---------Address
	/*if ( document.Enquiryform.address.value == ""  )
	   {if (!(PrintMesg(document.frmEmail.address,"Please enter Address.")))
	   {return false;}}
	 else  { 
	   if (!SpaceChk(document.Enquiryform.address))
		{if (!(PrintMesg(document.frmEmail.address,"Please enter the Address other than space")))
		{return false;}}
	}*/

	//------------------Message -------------------
	if ( document.Enquiryform.message.value == ""  )
	   {if (!(PrintMesg(document.Enquiryform.message,"Please enter  Message.")))
	   {return false;}}
	 else  { 
	   if (!SpaceChk(document.Enquiryform.message))
		{if (!(PrintMesg(document.Enquiryform.message,"Please enter the  Message other than space")))
		{return false;}}
	}

	//--------------------------------------
	return true;
}

//prints messages
function PrintMesg(ctrlvar,mesg)
{ alert(mesg); ctrlvar.focus(); return false }

// function to check spaces
function SpaceChk(ctrlvar)
{
   chkstr     = ctrlvar.value
   stlength   = chkstr.length
   spacecount = 0
   if (stlength >0)  {
    for(i=0;i<=stlength;i++)
     if ( chkstr.charAt(i)==" ") { spacecount=spacecount+1  }
    if (stlength == spacecount) { return false }
   return true }
}
//-->
function Validate_Step1()
{
	
	//------------------- from field -------------------
	if ( document.form1.f1name.value == ""  )
	   {if (!(PrintMesg(document.form1.f1name,"Please enter Name of person completing referral documentation.")))
	   {return false;}}
	//------------------- from field -------------------
	if ( document.form1.f1tel.value == ""  )
	   {if (!(PrintMesg(document.form1.f1tel,"Please enter Telephone number of person completing referral documentation.")))
	   {return false;}}
	   //------------------- from field -------------------
	if ( document.form1.f2name.value == ""  )
	   {if (!(PrintMesg(document.form1.f2name,"Please enter Name of the referring organisation.")))
	   {return false;}}
	    //------------------- from field -------------------
	if ( document.form1.f2tel.value == ""  )
	   {if (!(PrintMesg(document.form1.f2tel,"Please enter Telephone number of the referring organisation.")))
	   {return false;}}
	    //------------------- from field -------------------
	if ( document.form1.f2fax.value == ""  )
	   {if (!(PrintMesg(document.form1.f2fax,"Please enter Fax of the referring organisation.")))
	   {return false;}}
	    //------------------- from field -------------------
	if ( document.form1.f2type.value == ""  )
	   {if (!(PrintMesg(document.form1.f2type,"Please enter Type of service.")))
	   {return false;}}
	    //------------------- from field -------------------
	if ( document.form1.f3name.value == ""  )
	   {if (!(PrintMesg(document.form1.f3name,"Please enter Young person's name.")))
	   {return false;}}
	    //------------------- from field -------------------
	var f4;
	f4=0;
      for(i=0;i<document.form1.f4.length;i++)
       {
	   if ( document.form1.f4[i].checked)
	   {f4=1;}
	   }
	  if (f4==0)
	   {alert("Please select Gender of the Young person.")
	    return false;}
	    //------------------- from field -------------------
	if ( document.form1.f5.value == ""  )
	   {if (!(PrintMesg(document.form1.f5,"Please enter Young person's Country of birth.")))
	   {return false;}}
	    //------------------- from field -------------------
    var f6;
	f6=0;
      for(i=0;i<document.form1.f6.length;i++)
       {
	   if ( document.form1.f6[i].checked)
	   {f6=1;}
	   }
	  if (f6==0)
	   {alert("Is the young person from a culturally or linguistically diverse background? Please select.")
	    return false;}
	    //------------------- from field -------------------
	var f7;
	f7=0;
      for(i=0;i<document.form1.f7.length;i++)
       {
	   if ( document.form1.f7[i].checked)
	   {f7=1;}
	   }
	  if (f7==0)
	 
	   {alert("Is the young person of Aboriginal or Torres Strait Islander descent? Please select.")
	   return false;}
	


	//--------------------------------------
	return true;
}

function Validate_Step2()
{
	
	    //------------------- from field -------------------
	var f8;
	f8=0;
      for(i=0;i<document.form1.f8.length;i++)
       {
	   if ( document.form1.f8[i].checked)
	   {f8=1;}
	   }
	  if (f8==0)
	   {alert("Is the young person a permanent Australian resident?Please select.")
	    return false;}
	  
	    //------------------- from field -------------------
    var f9;
	f9=0;
      for(i=0;i<document.form1.f9.length;i++)
       {
	   if ( document.form1.f9[i].checked)
	   {f9=1;}
	   }
	  if (f9==0)
	   {alert("Is the young person aged at least 15 years old and less than 26 years old? Please select.")
	    return false;}
	    //------------------- from field -------------------
	var f10;
	f10=0;
      for(i=0;i<document.form1.f10.length;i++)
       {
	   if ( document.form1.f10[i].checked)
	   {f10=1;}
	   }
	  if (f10==0)
	 
	   {alert("Is the young person approaching or experiencing their transition to independent living? Please select.")
	   return false;}
	       //------------------- from field -------------------
	var f11;
	f11=0;
      for(i=0;i<document.form1.f11.length;i++)
       {
	   if ( document.form1.f11[i].checked)
	   {f11=1;}
	   }
	  if (f11==0)
	 
	   {alert("Is the young person at risk of an unsuccessful transition to independent living? Please select.")
	   return false;}
	       //------------------- from field -------------------
	var f12;
	f12=0;
      for(i=0;i<document.form1.f12.length;i++)
       {
	   if ( document.form1.f12[i].checked)
	   {f12=1;}
	   }
	  if (f12==0)
	 
	   {alert("Has the young person previously received TILA assistance? Please select.")
	   return false;}
	


	//--------------------------------------
	return true;
}
function Validate_Step3()
{
	
	
	       //------------------- from field -------------------
	var f13;
	f13=0;
      for(i=0;i<document.form1.f13.length;i++)
       {
	   if ( document.form1.f13[i].checked)
	   {f13=1;}
	   }
	  if (f13==0)
	 
	   {alert("Is the young person currently the subject of a care and protection order that places them in the care and custody of someone who is not their parent? Please select.")
	   return false;}
	


	//--------------------------------------
	return true;
}

function Validate_Step4()
{
	
	
	       //------------------- from field -------------------
	var f14;
	f14=0;
      for(i=0;i<document.form1.f14.length;i++)
       {
	   if ( document.form1.f14[i].checked)
	   {f14=1;}
	   }
	  if (f14==0)
	 
	   {alert("Was the young person previously the subject of a care and protection order that placed them in the care and custody of someone who was not their parent and has their order ceased/expired due to their age? Please select.")
	   return false;}
	


	//--------------------------------------
	return true;
}
function Validate_Step5()
{
	
	
	       //------------------- from field -------------------
	var f15;
	f15=0;
      for(i=0;i<document.form1.f15.length;i++)
       {
	   if ( document.form1.f15[i].checked)
	   {f15=1;}
	   }
	  if (f15==0)
	 
	   {alert("Is the young person currently in, or were they previously in informal care? Please select.")
	   return false;}
	


	//--------------------------------------
	return true;
}
function Validate_Step6()
{
	
	
	       //------------------- from field -------------------
	var f16;
	f16=0;
      for(i=0;i<document.form1.f16.length;i++)
       {
	   if ( document.form1.f16[i].checked)
	   {f16=1;}
	   }
	  if (f16==0)
	 
	   {alert("Is the young person currently in, or were they previously in Indigenous Kinship care? Please select.")
	   return false;}
	


	//--------------------------------------
	return true;
}
function Validate_Step7()
{
	
	
	       //------------------- from field -------------------
	var f17;
	f17=0;
      for(i=0;i<document.form1.f17.length;i++)
       {
	   if ( document.form1.f17[i].checked)
	   {f17=1;}
	   }
	  if (f17==0)
	 
	   {alert("Is the young person in receipt of, or eligible to receive one of the following Centrelink payments?1.Youth Allowance; 2. Abstudy; 3. Special Benefit; 4. Disability Support Pension; Please select.")
	   return false;}
	
	       //------------------- from field -------------------
	var f18;
	f18=0;
      for(i=0;i<document.form1.f18.length;i++)
       {
	   if ( document.form1.f18[i].checked)
	   {f18=1;}
	   }
	  if (f18==0)
	 
	   {alert("Has the young person been assessed by Centrelink as having independent status for one of the following reasons? 1. Homelessness (unreasonable to live at home);2. in Supported State Care;3. in Unsupported State Care;4. Refugee without parents in Australia; Please select.")
	   return false;}
	

	//--------------------------------------
	return true;
}
function Validate_Step8()
{
	
	
	       //------------------- from field -------------------
	var f19;
	f19=0;
      for(i=0;i<document.form1.f19.length;i++)
       {
	   if ( document.form1.f19[i].checked)
	   {f19=1;}
	   }
	  if (f19==0)
	 
	   {alert("Can the young person receive the requested support from any other program, measure or scheme? Please select.")
	   return false;}
	
	       //------------------- from field -------------------
	var f20;
	f20=0;
      for(i=0;i<document.form1.f20.length;i++)
       {
	   if ( document.form1.f20[i].checked)
	   {f20=1;}
	   }
	  if (f20==0)
	 
	   {alert("Is the requested support going to provide necessary relief for the young person? Please select.")
	   return false;}
	

	//--------------------------------------
	return true;
}
function isNumeric(s){if(isNaN(parseFloat(s))) return false; else return true;}
function Validate_Step9()
{
	 // Declaring required variables
	var digits = "0123456789";
	// non-digit characters which are allowed in phone numbers
	var NumberDelimiters = ". ";
	// characters which are allowed in international phone numbers
	// (a leading + is OK)
//	var validWorldPhoneChars = phoneNumberDelimiters + "+";
	// Minimum no of digits in an international phone no.
	var minDigitsInIPhoneNumber = 8;
	

	
	       //------------------- form field -------------------
	var f24;
	f24=0;
      for(i=0;i<document.form1.f24.length;i++)
       {
	   if ( document.form1.f24[i].checked)
	   {f24=1;}
	   }
	  if (f24==0)
	 
	   {alert("Is the young person CURRENTLY accessing any Transition Support? Please select.")
	   return false;}
//-------------------- amount----------
	f25 = document.form1.f25.value
 	if (f25  == "")
    {alert("Please enter How much TILA support is being sought.");
	f25="";
	document.form1.f25.focus();
	{return false;}}
		
	if (isNumeric(f25)==false||f25<0||f25>1000)
	{
		alert("Please Enter a Valid amount between 0 and 1000. Eg. 450.75")
		f25="";
		document.form1.f25.focus();
		return false;
	}
	//--------------------------------------
	return true;
}

function Validate_Step10()
{
	
	
	       //------------------- form field -------------------
	var f28;
	f28=0;
      for(i=0;i<document.form1.f28.length;i++)
       {
	   if ( document.form1.f28[i].checked)
	   {f28=1;}
	   }
	  if (f28==0)
	 
	   {alert("Has the young person's exit from care been planned? Please select.")
	   return false;}
	   
	       //------------------- form field -------------------
	var f29;
	f29=0;
      for(i=0;i<document.form1.f29.length;i++)
       {
	   if ( document.form1.f29[i].checked)
	   {f29=1;}
	   }
	  if (f29==0)
	 
	   {alert("Is a Transition Plan in place? Please select.")
	   return false;}
	//------------------- form field -------------------
	if ( document.form1.f30.value == ""  )
	   {if (!(PrintMesg(document.form1.f30,"Please enter Name of the organisation responsible for the Transition/Exit Plan.")))
	   {return false;}}
	   //------------------- form field -------------------
	if ( document.form1.f31name.value == ""  )
	   {if (!(PrintMesg(document.form1.f31name,"Please enter Name of Details of the Officer responsible for the Transition/Exit Plan. ")))
	   {return false;}}
	   //------------------- form field -------------------
	if ( document.form1.f31position.value == ""  )
	   {if (!(PrintMesg(document.form1.f31position,"Please enter Position in the organisation.")))
	   {return false;}}
	   //------------------- form field -------------------
	if ( document.form1.f31tel.value == ""  )
	   {if (!(PrintMesg(document.form1.f31tel,"Please enter Telephone number.")))
	   {return false;}}
	   //------------------- form field -------------------
	if ( document.form1.f31fax.value == ""  )
	   {if (!(PrintMesg(document.form1.f31fax,"Please enter Fax number.")))
	   {return false;}}
	    //------------------- form field -------------------
	if ( document.form1.f32a.value == ""  )
	   {if (!(PrintMesg(document.form1.f32a,"Please enter Short-term goals and steps.")))
	   {return false;}}
	    //------------------- form field -------------------
	if ( document.form1.f32b.value == ""  )
	   {if (!(PrintMesg(document.form1.f32b,"Please enter Medium-term goals and steps.")))
	   {return false;}}
	    //------------------- form field -------------------
	if ( document.form1.f32c.value == ""  )
	   {if (!(PrintMesg(document.form1.f32c,"Please enter Long-term goals and steps.")))
	   {return false;}}
	       

	//--------------------------------------
	return true;
}
function   IsAlpha(cCheck){               
    return   ((('a'<=cCheck)   &&   (cCheck<='z'))   ||   (('A'<=cCheck)   &&   (cCheck<='Z')))               
  }                                                               
    
function   IsValid(strCheck){   
    for(i=0;i<strCheck.length;i++){   
      cCheck=strCheck.charAt(i);   
      if   (!IsAlpha(cCheck))   return   false;   
    }   
    return   true;   
  }   

function Validate_Step11()
{
	
	//------------------- form field -------------------
	if ( document.form1.f33firstname.value == ""  )
	   {if (!(PrintMesg(document.form1.f33firstname,"Please enter First name.")))
	   {return false;}}
	   //------------------- form field -------------------
	if ( document.form1.f33secondname.value == ""  )
	   {if (!(PrintMesg(document.form1.f33secondname,"Please enter Second name. ")))
	   {return false;}}
	   //------------------- form field -------------------
	if ( document.form1.f34.value == ""  )
	   {if (!(PrintMesg(document.form1.f34,"Please enter Centrelink Customer Reference Number.")))
	   {return false;}}
	else 
	   f34= document.form1.f34.value
	   n_f34=f34.substring(0,8)
	    a_f34=""
	   a_f34=f34.substring(9)
	   if  (isNumeric(n_f34)==false||IsValid(a_f34)==false||a_f34=="")
	   {if (!(PrintMesg(document.form1.f34,"Please enter valid Centrelink Customer Reference Number. eg. 123456789A")))
	   {return false;}}
	   //------------------- form field -------------------
	if ( document.form1.f35address.value == ""  )
	   {if (!(PrintMesg(document.form1.f35address,"Please enter Address.")))
	   {return false;}}
	   //------------------- form field -------------------
	if ( document.form1.f35postcode.value == ""  )
	   {if (!(PrintMesg(document.form1.f35postcode,"Please enter Postcode.")))
	   {return false;}}
	    
	 //------------------- form field -------------------
	var f36;
	f36=0;
      for(i=0;i<document.form1.f36.length;i++)
       {
	   if ( document.form1.f36[i].checked)
	   {f36=1;}
	   }
	  if (f36==0)
	 
	   {alert("Have you received TILA support in the past? Please select.")
	   return false;}

	//--------------------------------------
	return true;
}