		$(document).ready (function () {
			var formTesting = $('#registration').attr('name');
			if (formTesting == 'registration') {
				document.forms[0].firstname.focus();
			}
			
		});		
		

		function Validate(whatform) 
		{
			
			$('#scerrors').html('');			
			$('#scerrors').hide();
			
			with (whatform)
			{
				if (!ValidateField(firstname, true, 2, 40, FirstLastName)) { $('#jserrors').html('Please enter a firstname between 2 and 40 characters'); firstname.focus(); $('#jserrors').show(); return false; }
				if (!ValidateField(lastname, true, 2, 40, FirstLastName)) { $('#jserrors').html('Please enter a lastname between 2 and 40 characters'); lastname.focus(); $('#jserrors').show(); return false; }		
				if (phonenumber.value.length != 12) { $('#jserrors').html('Please choose a valid phone number (e.g. 555-666-4444)'); phonenumber.focus(); $('#jserrors').show(); return false; }		
				if (!ValidateField(emailid, true, 2, 100, EmailID)) { $('#jserrors').html('Please enter a valid email'); emailid.focus(); $('#jserrors').show(); return false; }
				if (!ValidateField(confirmemailid, true, 2, 100, EmailID)) { $('#jserrors').html('Please confirm your email'); confirmemailid.focus(); $('#jserrors').show(); return false; }
				if (!ValidateField(username, true, 6, 20)) { $('#jserrors').html('Username should be between 6 and 20 alphabets/numbers'); username.focus(); $('#jserrors').show(); return false; }
				if (!ValidateField(password, true, 6, 20)) { $('#jserrors').html('Password should be between 6 and 20 characters'); password.focus(); $('#jserrors').show(); return false; }
				if (password.value != confirmpassword.value) { $('#jserrors').html('Please confirm your password'); confirmpassword.focus(); $('#jserrors').show(); return false; }
				if (!ValidateField(company, false, 2, 100)) { $('#jserrors').html('Company should be between 2 and 100 alphabets/numbers/spaces'); company.focus(); $('#jserrors').show(); return false; }
				if (!ValidateField(address, true, 2, 200)) { $('#jserrors').html('Please enter an address of 2 to 200 characters'); address.focus(); $('#jserrors').show(); return false; }
				if (!ValidateField(city, true, 2, 40)) { $('#jserrors').html('Please enter a city of 2 to 40 characters'); city.focus(); $('#jserrors').show(); return false; }
				if (!AtLeastOneDigit(province.options[province.selectedIndex].value)) { $('#jserrors').html('Please select a valid province'); province.focus();$('#jserrors').show();  return false; }
				if (!ValidateField(postalcode, true, 2, 20)) { $('#jserrors').html('Please enter a postal code of 2 to 20 characters'); postalcode.focus(); $('#jserrors').show(); return false; }
				if (!AtLeastOneDigit(country.options[country.selectedIndex].value)) { $('#jserrors').html('Please select a valid country'); country.focus();$('#jserrors').show();  return false; 
				if (!ValidateField(captcha, true, 5, 5)) { $('#jserrors').html('Please type the characters from the image'); captcha.focus(); $('#jserrors').show(); return false; }}
			}
			
			$('#jserrors').html('');			
			$('#jserrors').hide();
			
			return true;
		}