        //______________________________
        //Function for checking number fields for empty and nonnumeric values.
        //______________________________
        function isNum(str)	{
	        for(i=0; i <str.length ; i++)	{
		   if(str.charAt(i) > "9")	{
			return false;
	           }
		if (str.charAt(i) < "0")	{
			return false;
	        }

        	}
		return true;
	}

	function validEmail(email) {
		var invalidChars =" /:,;";

		if (email.length == "") {
			alert("Your email address shouldn't be empty!");
			document.NewShopperForm.email.focus();
			return false;
		}
   
                for (i=0; i<invalidChars.length; i++) {
			badChar = invalidChars.charAt(i);
			if (email.indexOf(badChar,0) > -1) { 	//it searches invalidChars string
				alert("Your email contains invalid characters!");
				document.NewShopperForm.email.focus();
				return false;
			}
		}

		var atPos = email.indexOf("@",1);
		if (atPos == -1) {				 //it checks if email contains any @ character.
			alert("Your email address doesn't contain @ character!");
			document.NewShopperForm.email.focus();
			return false;
		}

		if (email.indexOf("@",atPos+1) > -1) {		//it checks if email contains more than one @ character, if there is gives an error message.
			alert("Your email contains more than one @ character!");
			document.NewShopperForm.email.focus();
			return false;
		}

		var periodPos = email.indexOf(".",atPos);
		if (periodPos == -1) {				//it checks that there is a period after the @ sign, if not gives an error message.
			alert("Your email doesn't contain dot character after the @ character!");
			document.NewShopperForm.email.focus();
			return false;
		}

		if (periodPos+3 > email.length) {		//it checks if is there at least two characters after the dot character.
			alert("Your email should contain at least two characters after the dot character.");
			document.NewShopperForm.email.focus();
			return false;
		}
		return true;
	}
	

        function checkForm2() {
	   	    
		var Firstname = document.NewShopperForm.firstname.value;
		if(Firstname <= 0)	{
			alert("Please enter your firstname");
			document.NewShopperForm.firstname.focus();
			return false;
		}


		var Lastname = document.NewShopperForm.lastname.value;
		if(Lastname.length <= 0)	{
			alert("Please enter your lastname");
			document.NewShopperForm.lastname.focus();
			return false;
		}
                               
                var companyname = document.NewShopperForm.companyname.value;
		if(companyname.length <= 0)	{
			alert("Please enter your Company name");
			document.NewShopperForm.companyname.focus();
			return false;
		}

		var Street = document.NewShopperForm.street.value;
		if(Street.length <= 0)	{
			alert("Please enter your street address");
			document.NewShopperForm.street.focus();
			return false; 
		}

		var Suburb = document.NewShopperForm.suburb.value;
		if(Suburb.length <= 0)	{
			alert("Please enter your suburb");
			document.NewShopperForm.suburb.focus();
			return false;
		}	

		var city = document.NewShopperForm.city.value;
		if(city.length <= 0)	{
			alert("Please enter a city");
			document.NewShopperForm.city.focus();
			return false;
		}
                var State = document.NewShopperForm.state.value;
		if(State.length <= 0)	{
			alert("Please enter a State");
			document.NewShopperForm.state.focus();
			return false;
		}

		var SelectInd = document.NewShopperForm.country.selectedIndex;
		var SelCountry = document.NewShopperForm.country.options[SelectInd].text;
		//________________________________________________________________________________________________________________
		//If country is Australia, post code must be 4  digit numbers and not less not more, and a State must be selected.
        	//________________________________________________________________________________________________________________

		var PostCode = document.NewShopperForm.postcode.value;
		if(SelCountry == "Australia")	{
			if(PostCode.length != 4)	{
				alert("Postcode must be 4 digit numbers for Australia");
				document.NewShopperForm.postcode.focus();
				return false;
			}
			else {
				if(isNum(PostCode) == false)  {
					alert("Postcode is not valid for Australia");
					document.NewShopperForm.postcode.focus();
					return false;
				}
			}
		}


		var Phone = document.NewShopperForm.phone.value;
		if(Phone.length <= 6)	{
			alert("Phone must be at least 7 digits");
			document.NewShopperForm.phone.focus();
			return false;
		}
		else {
			if(isNum(Phone) == false)  {
				alert("Phone is not numeric");
				document.NewShopperForm.phone.focus();
				return false;
			}
      		}

         
        var Userid = document.NewShopperForm.userid.value;
		if(Userid.length <= 0)	{
			alert("Please enter your userid");
			document.NewShopperForm.userid.focus();
			return false;
		}

                                          
		var Password1 = document.NewShopperForm.password1.value;
		if(Password1.length <= 5)	{
			alert("Please enter minimum 6 characters.");
			document.NewShopperForm.password1.focus();
			return false;
		}


		var Password2 = document.NewShopperForm.password2.value;
		if(Password2.length <= 0)	{
			alert("Please confirm your password");
			document.NewShopperForm.password2.focus();
			return false;
		}

        if(Password1 == Password2)	{
		}
		else  {    
		    alert("Your Password doesn't match");
		    document.NewShopperForm.password2.focus();
			return false;
        }
         
		var Email = document.NewShopperForm.email.value;
		if (validEmail(Email) == false) {
			return false;
		}

    		return true;

	} 

         
	// End hiding script from old browsers -->
 