function valid() 
{
	if(document.contact.childsurname.value=="")
        {
                alert("Please enter your Child's Surname");
                document.contact.childsurname.focus();
                return false;
        }
	
	if(document.contact.childfirstname.value=="")
        {
                alert("Please enter your Child's First Name");
                document.contact.childfirstname.focus();
                return false;
        }

	if((document.getElementById("gender1").checked==false) && (document.getElementById("gender2").checked==false))
        {
                alert("Please enter your Child's Gender");
                return false;
        }

	if(document.contact.childdob_day.value=="")
        {
                alert("Please enter your Child's Date of Birth (Day)");
                document.contact.childdob_day.focus();
                return false;
        }

	if(document.contact.childdob_month.value=="")
        {
                alert("Please enter your Child's Date of Birth (Month)");
                document.contact.childdob_month.focus();
                return false;
        }

	if(document.contact.childdob_year.value=="")
        {
                alert("Please enter your Child's Date of Birth (Year)");
                document.contact.childdob_year.focus();
                return false;
        }
	
	if(document.contact.street.value=="")
        {
                alert("Please enter your Street");
                document.contact.street.focus();
                return false;
        }
	if(document.contact.suburb.value=="")
        {
                alert("Please enter your Suburb");
                document.contact.suburb.focus();
                return false;
        }	
         
	if(document.contact.postcode.value=="")
        {
                alert("Please enter your Postcode");
                document.contact.postcode.focus();
                return false;
        }	

        CheckNum = parseInt(document.contact.postcode.value);
        if(isNaN(CheckNum) || document.contact.postcode.value.length!=4) 
	{
                alert("Please enter a numerical value for your Postcode (4 digits only)");
                document.contact.postcode.select();
                document.contact.postcode.focus();
                return false;
        }	

	if(document.contact.mothersurname.value=="")
        {
                alert("Please enter the Mother's Surname");
                document.contact.mothersurname.focus();
                return false;
	}

	if(document.contact.motherfirstname.value=="")
        {
                alert("Please enter the Mother's First Name");
                document.contact.motherfirstname.focus();
                return false;
	}

	if(document.contact.homephone.value=="")
        {
                alert("Please enter your Home Phone Number");
                document.contact.homephone.focus();
                return false;
	}

        CheckNum = parseInt(document.contact.homephone.value);
        if(isNaN(CheckNum)) 
	{
                alert("Please enter a numerical value for your Home Phone Number");
                document.contact.homephone.select();
                document.contact.homephone.focus();
                return false;
        }	

	if(document.contact.mobile.value=="")
        {
                alert("Please enter your Mobile Number");
                document.contact.mobile.focus();
                return false;
        }

        CheckNum = parseInt(document.contact.mobile.value);
        if(isNaN(CheckNum) || document.contact.mobile.value.length!=10) 
	{
                alert("Please enter a numerical value for your Mobile Number (10 digits only)");
                document.contact.mobile.select();
                document.contact.mobile.focus();
                return false;
        }	
	
	if(document.contact.emailid.value=="")
        {
                alert("Please enter your Email Address");
                document.contact.emailid.focus();
                return false;
        }

//        RegExp=/\w+(@{1})+[0-9a-zA-Z]+[.-]+[^+*=$@%][a-zA-Z.]/g;
//        ntest=RegExp.test(document.contact.emailid.value);
//        if (!ntest)
        if ((window.RegExp && !document.contact.emailid.value.match(new RegExp("^([a-zA-Z0-9_]|\\-|\\.)+@(([a-zA-Z0-9_]|\\-)+\\.)+[a-zA-Z]{2,4}$"))) || document.contact.emailid.value.length < 5)
        {
                alert("Please enter a valid Email Address!")
                document.contact.emailid.focus();
                return false;
        }

	if(document.contact.medicarenumber.value=="")
        {
                alert("Please enter your Medicare Number");
                document.contact.medicarenumber.focus();
                return false;
        }	

        CheckNum = parseInt(document.contact.medicarenumber.value);
        if(isNaN(CheckNum) || document.contact.medicarenumber.value.length!=10) 
	{
                alert("Please enter a numerical value for your Medicare Number (10 digits only)");
                document.contact.medicarenumber.select();
                document.contact.medicarenumber.focus();
                return false;
        }		

	if(document.contact.patientnumber.value=="")
        {
                alert("Please enter the Medicare Card Patient Number");
                document.contact.patientnumber.focus();
                return false;
        }

	if(document.contact.card_expire_month.value=="")
        {
                alert("Please enter the Medicare Card Expiry Date (Month)");
                document.contact.card_expire_month.focus();
                return false;
        }

	if(document.contact.card_expire_year.value=="")
        {
                alert("Please enter the Medicare Card Expiry Date (Year)");
                document.contact.card_expire_year.focus();
                return false;
        }

	if(document.contact.parentname.value=="")
        {
                alert("Please enter the Parent's Name on your Medicare Card");
                document.contact.parentname.focus();
                return false;
        }

        if(document.contact.parentnumber.value=="")
        {
                alert("Please enter the Parent's Number on your Medicare Card");
                document.contact.parentnumber.focus();
                return false;
        }

	if(document.contact.parentdob_day.value=="")
        {
                alert("Please enter the Parent's Date of Birth (Day)");
                document.contact.parentdob_day.focus();
                return false;
        }

	if(document.contact.parentdob_month.value=="")
        {
                alert("Please enter the Parent's Date of Birth (Month)");
                document.contact.parentdob_month.focus();
                return false;
        }	

	if(document.contact.parentdob_year.value=="")
        {
                alert("Please enter the Parent's Date of Birth (Year)");
                document.contact.parentdob_year.focus();
                return false;
        }	

 	if(document.contact.referringdoctor.value=="")
        {
                alert("Please enter the Referring Doctor's Name");
                document.contact.referringdoctor.focus();
                return false;
        }

 	if(document.contact.referraldate.value=="")
        {
                alert("Please enter the Date of Referral");
                document.contact.referraldate.focus();
                return false;
        }

 	if((document.getElementById("reportsno").checked==false) && (document.getElementById("reportsyes").checked==false))
        {
                alert("Please select the relevant response in regard to copies of your child's reports");
               	return false;
        }
			
}
