function formCheck(formName){
	ValidOk = true;
	var count = 0;
	
	while(count < formName.elements.length){
		var fieldType = formName.elements[count].type;
		var theFieldName = formName.elements[count].name;
		var fieldName = formName.elements[formName.elements[count].name];
	
		switch(fieldType){
			case 'text':
	    		if(theFieldName == "txtName"){
					customStrCheck(fieldName,1,'your name');
				}else if(theFieldName == "txtEmail"){
					emailCheck(fieldName);
				}
				else if(theFieldName == "tagNumber"){
					isNumCheck(fieldName,'your Tag Number')
				}
				else if(theFieldName == "AccNumber"){
					isNumCheck(fieldName,'your Account Number')
				}
				else if(theFieldName == "Firstname"){
					strCheck(fieldName,1,'your first name');
				}
				else if(theFieldName == "Lastname"){
					strCheck(fieldName,1,'your last name');
				}
				else if(theFieldName == "Name"){
					strCheck(fieldName,1,'your name');
				}
				else if(theFieldName == "myTime"){
					if (fieldName.value != "HH:MM"){
						timeCheck(fieldName)
					}
				}
				else if(theFieldName == "AccNum"){
					if (fieldName.value != ""){
						isNumCheck(fieldName, "valid Account Number")
					}
				}
				else if(theFieldName == "CardNum"){
					if (fieldName.value != ""){
						isNumCheck(fieldName, "valid Card Number")
					}
				}
				else if(theFieldName == "Address"){
					strCheck(fieldName,1,'your address');
				}
				else if(theFieldName == "Address1"){
					strCheck(fieldName,1,'your address');
				}
				else if(theFieldName == "Suburb"){
					strCheck(fieldName,1,'your suburb');
				}
				else if(theFieldName == "State"){
					strCheck(fieldName,1,'your state');
				}
				else if(theFieldName == "Postcode"){
					numCheck(fieldName,4,'your Postcode');
				}
				else if(theFieldName == "Email"){
					emailCheck(fieldName);
				}
				else if(theFieldName == "famName"){
					strCheck(fieldName,1,'your family name');
				}
				else if(theFieldName == "givenName"){
					strCheck(fieldName,1,'your given name');
				}
				
				//check the violations form
				else if(theFieldName == "AccNumViolations"){
					//if(formName.CardNumViolations.value.length < 1)
					//{
						customStrCheck2(fieldName, 6, 'Account Number');
					//}
				}
				else if(theFieldName == "CardNumViolations"){
					//if(formName.AccNumViolations.value.length < 1)
					//{
						customNumCheck(fieldName, 7, 12, 'Tag or Card Number');
					//}
				}
				else if(theFieldName == "NameViolations"){
					strCheck(fieldName,1,'your name');
				}else if(theFieldName == "myAddressViolations"){
					strCheck(fieldName,1,'your address');
				}else if(theFieldName == "mySuburbViolations"){
					strCheck(fieldName,1,'your suburb');
				}else if(theFieldName == "myPostcodeViolations"){
					numCheck(fieldName,4,'your postcode');
				}else if(theFieldName == "myYearViolations"){
					numCheck(fieldName,4,'a travel date');
				}else if(theFieldName == "myTimeViolations"){
					timeCheck(fieldName);
				}else if(theFieldName == "VehicleTypeViolations"){
					strCheck(fieldName,1,'the vehicle type');
				}else if(theFieldName == "RegNumViolations"){
					strCheck(fieldName,1,'your registration number');
				}else if(theFieldName == "TollAmtViolations"){
					isNumCheck(fieldName,'the toll amount')
				}else if(theFieldName == "phoneViolations"){
					numCheck(fieldName,10,'Phone');
				}else if(theFieldName == "EmailViolations"){
					emailCheck(fieldName);
				}else if(theFieldName == "BeepsHeardViolations"){
					isEmptyCheck(fieldName,1, 'reason or the number of beeps heard');
				}else if(theFieldName == "DirectionViolations"){
					isEmptyCheck(fieldName,1, 'direction of travel');
				}
				
				break;
 	  
			case 'select-one':
				if(theFieldName == "myState"){
					selectCheck(fieldName, "a State") 
				}else if(theFieldName == "title"){
					selectCheck(fieldName, "a title");
				}else if(theFieldName == "StateViolations"){
					selectCheck(fieldName, "a State");
				}else if(theFieldName == "myDayViolations"){
					selectCheck(fieldName, "a travel date");
				}else if(theFieldName == "myMonthViolations"){
					selectCheck(fieldName, "a travel date");
				}else if(theFieldName == "MotorwayViolations"){
					selectCheck(fieldName, 'the motorway');
				}else if(theFieldName == "TagIssuer"){
					selectCheck(fieldName, "a tag issuer") 
				}
				
				/*
				if(theFieldName == "Title"){
					selectCheck(fieldName,'your title');
				}else if(theFieldName == "State"){
					selectCheck(fieldName,'your State');
				}else if(theFieldName == "Area"){
					if (formName.elements["specificRestaurant"][0].checked)
					{ 
						selectCheck(fieldName,'area of concern');
					}
				} 
				*/ 
				break;
	  
			case 'textarea':
				if(theFieldName == 'commentArea'){
					strCheck(fieldName,1,'your comment');   
				}
				break;
	  
			case 'password':
				/*
				if(theFieldName == 'default_password123'){
					isChecked(fieldName, 'default_password');
				}
				*/
			break;
	  	  
			case 'radio':
				if(theFieldName == 'comment'){
					isChecked(fieldName, 'Please select one of the comment type');
					if (formName.elements["comment"][4].checked)
					{
						strCheck(formName.elements["comment_other"], 1, 'the other type comment');
					}
				}
				else if(theFieldName == 'country'){
					isChecked(fieldName, 'Please select your the country');
					if (formName.elements["country"][2].checked)
					{
						strCheck(formName.elements["country_other"], 1, 'the other country');
					}
				}
				else if(theFieldName == 'product'){
					if (formName.elements["product"][6].checked)
					{
						strCheck(formName.elements["product_other"], 1, 'the other product');
					}
				}
				else if(theFieldName == "vchRegListed"){
					isChecked(fieldName,'is this registration number listed on the account?');
				}
				else if(theFieldName == "TollAmtViolations"){
					isChecked(fieldName,'toll amount');
				}
				break;
				
			case 'checkbox':
				/*
				if(theFieldName == 'default_radio123'){
					isChecked(fieldName, 'default_radio');
				}
				*/
				if(theFieldName == 'acknowledgement'){
					singleCheckValidation(changeDetails.acknowledgement);
				}
			break;

		}
		if(ValidOk == false){
	  		break;
		}
		count++;
	}
	
	if (ValidOk == true){
		formName.submit();
	}
}
