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 == 'firstname'){
	      strCheck(fieldName,1,'first name');
		}else if(theFieldName == "surname"){
	  	  strCheck(fieldName,1,'surname');
		}else if(theFieldName == 'myName'){
	  	  strCheck(fieldName,1,'name');
		//}else if(theFieldName == 'myEmail'){
	  	  //emailCheck(fieldName,1,'email');
		}else if(theFieldName == 'emailAddress'){
	  	  emailCheck(fieldName,'email');	
		}else if(theFieldName == 'ConfirmEmail'){
	  	  emailCheck(fieldName,'confirmation email address');	  	  
		}else if(theFieldName == "friendsName"){
	  	  strCheck(fieldName,1,'friend\'s name');
		}else if(theFieldName == "friendsEmail"){
	  	  emailCheck(fieldName,1,'friend\'s email');
		}else if(theFieldName == "address1"){
	  	  strCheck(fieldName,1,'address');
		}else if(theFieldName == "state"){
	  	  strCheck(fieldName,1,'state');	  
		}else if(theFieldName == "suburb"){
	  	  strCheck(fieldName,1,'suburb');	
		}else if(theFieldName == "postcode"){
	  	  numCheck(fieldName,4,'postcode');		  		  
		}else if(theFieldName == "dobYear"){
	  	  numCheck(fieldName,2,'date of birth - year');
		}else if(theFieldName =="ticketNumber"){
		  numCheck(fieldName,9,'Ticket Number');		  
		}else if(theFieldName =="CardNo"){
		   ccCheck(fieldName,'card number');
		}else if(theFieldName =="quantity"){
		  CheckQuantity(fieldName);		  
		}else if(theFieldName =="subtotal"){
		  totalCheck(fieldName);
	 	}else if(theFieldName =="phone"){
		  phoneCheck(fieldName,'Please enter your phone number'); 
		}else if(theFieldName =="phone1"){
		  MandatoryCheck(formName, fieldName,1); 
		}
		
		
		
	  break;

	  case 'select-one':
	    if(theFieldName == 'state'){
	      selectCheck(fieldName,'state');
	  	}else if(theFieldName == 'title'){
	  	  selectCheck(fieldName,'title');
		}else if(theFieldName == 'storeState'){
	  	  selectCheck(fieldName,'state');
		}else if(theFieldName == 'CardExpYear'){
	  	  selectCheck(fieldName,"Credit Card expiry year"); 
		}else if(theFieldName == 'cardtype'){
	  	  selectCheck(fieldName,"Credit Card type"); 
		}else if(theFieldName == 'model'){
	  	  selectCheck(fieldName,"model"); 
		}else if(theFieldName == 'yourVehicleModel'){
	  	  selectCheck2(fieldName,"model"); 
		}
		
		
		
	  break;
	  
	  case 'textarea':
	    if(theFieldName == "comment"){
	      strCheck(fieldName,1,'feedback');
		}
	  break;
	  
	  case 'password':
	    if(theFieldName == "memPassword"){
	      strCheck(fieldName,1,'password');
		}
	  break;
	  	  
	  case 'radio':
	    if(theFieldName == "gender"){
	      genderCheck(fieldName);
		}else if(theFieldName == "taste"){
	      tasteCheck(fieldName);
		}else if(theFieldName == "receivedinfobyZCard"){
	      isChecked(fieldName, 'YES if you have received information from VW before by Z card.');
		}else if(theFieldName == "receivedinfobyPostcard"){
	      isChecked(fieldName, 'YES if you have received information from VW before by postcard.'); 
		}
		
	  break;
	  case 'checkbox':
		if(theFieldName == "subscribe"){
			selectFieldName = formName.elements[formName.typeOfSubscription.name];
			checkboxDropdownCheck(fieldName,selectFieldName,"Please select a way of subscribing");
		} else if(theFieldName == "AdminSuper"){
			validChecked = isCheckBoxChecked(formName, count);
		} else if(theFieldName == "IsShippingSameAsContact"){
			ShippingCheck(formName);
		} else if(theFieldName == "UnsureDealer"){
			UnsureDealerCheck(formName);
		}else if(theFieldName == "PrivacyPolicy"){
			checkboxCheck(fieldName);		
		}
	  break;
	}
	if(ValidOk == false){
	  break;
	}
	count++;
  }
  if (ValidOk == true){
    formName.submit();
  }
}