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 == "childsName"){
	      strCheck(fieldName,1,'full name');
    	}else if(theFieldName == 'email'){
	  	  emailCheck(fieldName);
		}else if(theFieldName == "myEmail"){
	  	  emailCheck(fieldName);
		}else if(theFieldName == "friendsEmail"){
	  	  friendEmailCheck(fieldName);
		}else if(theFieldName == "myName"){
	  	  strCheck(fieldName,1,'name');
		}else if(theFieldName == "firstName"){
	  	  strCheck(fieldName,1,'first name');
		}else if(theFieldName == "lastName"){
	  	  strCheck(fieldName,1,'last name');
		}else if(theFieldName == "friendsName"){
	  	  strCheck(fieldName,1,'friend\'s name');
		}else if(theFieldName == "friendsEmail"){
	  	  emailCheck(fieldName,1,'friend\'s email');
		}else if(theFieldName == "address"){
	  	  strCheck(fieldName,1,'address');
		}else if(theFieldName == "suburb"){
	  	  strCheck(fieldName,1,'suburb');	
		}else if(theFieldName == "postcode"){
	  	  numCheck(fieldName,4,'postcode');
		}else if(theFieldName == "kidPhone"){
	  	  phoneCheck(fieldName);		  		  
		}else if(theFieldName == "dobYear"){
	  	  dob_yearCheck(fieldName,'date of birth - year');
		}else if(theFieldName == "senderName"){
	  	  strCheck(fieldName,1,'name');

		}else if(theFieldName == "senderEmail"){
	  	  emailCheck(fieldName,'valid email address');
		  
		}else if(theFieldName == "recipientName"){
	  	  strCheck(fieldName,1,'friend\'s name');
		  
		}else if(theFieldName == "recipientEmail"){
	  	  emailCheck(fieldName,'friend\'s valid email address');

		//For consulting
		}else if(theFieldName == "name"){
	  	  strCheck(fieldName,1,'name');
		}else if(theFieldName == "email"){
	  	  emailCheck(fieldName,1);
		}else if(theFieldName == "jobTitle"){
	  	  strCheck(fieldName,1,'job title');
		}else if(theFieldName == "company"){
	  	  strCheck(fieldName,1,'company');
  		}else if(theFieldName == "phone"){
	  	  strCheck(fieldName,1,'phone');
		}else if(theFieldName == "message"){
	  	  strCheck(fieldName,1,'message');

		//For Contact
		}else if(theFieldName == "contactName"){
	  	  isEmptyCheck(fieldName,1,'name');
		}else if(theFieldName == "contactEmail"){
	  	  emailCheck(fieldName,1);
		}else if(theFieldName == "contactCompany"){
	  	  isEmptyCheck(fieldName,1,'company');
		  
		//For subscribe
		}else if(theFieldName == "vchName"){
	  	  isEmptyCheck(fieldName,1,'name');
		}else if(theFieldName == "vchJobTitle"){
	  	  isEmptyCheck(fieldName,1,'job title');
		}else if(theFieldName == "vchCompany"){
	  	  isEmptyCheck(fieldName,1,'company');
		}else if(theFieldName == "vchAddress1"){
	  	  isEmptyCheck(fieldName,1,'address');
		}else if(theFieldName == "vchCountry"){
	  	  isEmptyCheck(fieldName,1,'country');
		}else if(theFieldName == "vchPhone"){
	  	  isEmptyCheck(fieldName,1,'phone');		  
		}else if(theFieldName == "vchEmail"){
	  	  emailCheck(fieldName,1);
		}
		
		
	  break;
 	  
	  case 'select-one':
	    if(theFieldName == "kidState"){
	      selectCheck(fieldName,'state');
		}else if(theFieldName == "dobDay"){
	  	  selectCheck(fieldName,'date of birth - day');
		}else if(theFieldName == "dobMonth"){
	  	  selectCheck(fieldName,'date of birth - month');
		}else if(theFieldName == "storeState"){
	  	  selectCheck(fieldName,'favourite store - state');
		}else if(theFieldName == "storeSuburb"){
	  	  selectCheck(fieldName,'favourite store - restaurant area');
		}else if(theFieldName == "storeStores"){
	  	  selectCheck(fieldName,'favourite store - address');
		}else if(theFieldName == "favDessert"){
	  	  selectCheck(fieldName,'favourite dessert');
		}
	  break;
	  
	  case 'textarea':
	    if(theFieldName == 'comment'){
	      strCheck(fieldName,1,'feedback');
		}else if(theFieldName == 'contactMessage'){
	      isEmptyCheck(fieldName,1,'message');
		}
	  break;
	  
	  case 'password':
	    if(theFieldName == 'memPassword'){
	      strCheck(fieldName,4,'valid password (min.4 chars). eg "hello"');
		}
	  break;
	  	  
	  case 'radio':
	    if(theFieldName == 'gender'){
	      genderCheck(fieldName);
		}else if(theFieldName == 'prize'){
		  prizeCheck(fieldName);
		}else if(theFieldName == 'subscribe'){
		  isChecked(fieldName,'Do you wish to subscribe?');
		}
	  break;
	  
	  
	  	  
	  
	  
	  
	   case 'checkbox':
	    if(theFieldName == 'parentAgree'){
	      parentCheck(formName,fieldName);
		}else if(theFieldName == 'disclaimer'){
		  discCheck(fieldName);
		  
  		//For subscribe
	
			
		//}else if(theFieldName == "vchPublication"){
	  	//  isChecked(fieldName, 'Please select publication');
		//}
		
		
		
			
		}else if (theFieldName == "vchPublication") {
	  	  isChecked(fieldName, 'Please select publication');
		}
		
		
		
		else if((theFieldName == "chk") && (theFieldName == "vchPublication")){
	  	  validate(fieldName, 'Publication Check');
		}
		
		
		
		
		   		  
	  
		
		
				
		
	  break;
	}
	if(ValidOk == false){
	  break;
	}
	count++;
  }
  if (ValidOk == true){
    formName.submit();
  }
}