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':
				//Memebers Login
	    		if(theFieldName == "txtUsername"){
					strCheck(fieldName,1,'username');
				//Registration
				}else if(theFieldName == "vchFirstName"){
					strCheck(fieldName,1,'your first name');
				}else if(theFieldName == "vchLastName"){
					strCheck(fieldName,1,'your last name');
				}else if(theFieldName == "vchEmail"){
					emailCheck(fieldName);
				}else if(theFieldName == "vchContact"){
					isEmptyCheck(fieldName,1,'your telephone number');
				}else if(theFieldName == "vchSuburb"){
					strCheck(fieldName,1,'your suburb');
				}else if(theFieldName == "vchPostcode"){
					isEmptyCheck(fieldName,1,'your zip code');
				}else if(theFieldName == "vchUsername"){
					strCheck(fieldName,1,'a username');
				//Contact Us
				}else if(theFieldName == "vchName"){
					strCheck(fieldName,1,'your name');
				}else if(theFieldName == "vchNatureEnquiry"){
					strCheck(fieldName,1,'Nature of Enquiry');
				}else if(theFieldName == "vchState"){
					strCheck(fieldName,1,'your state');
				}else if(theFieldName == "vchUniqueCode"){
					isEmptyCheck(fieldName,1,'you unique code');
				}
				break;
 	  
			case 'select-one':
				//Registration
					if (theFieldName == "vchCountry"){
					selectCheck(fieldName,'your country');
					//Check for country in other country text box
					if (formName.vchCountry.value == 'Others'){
						if (formName.vchOtherCountry.value.length < 1){
					    	ValidOk = false;
					    	alert('Please enter your country.');
					    	formName.vchOtherCountry.focus();
					    	formName.vchOtherCountry.select();
						}
					}
				}else if (theFieldName == "vchMarket"){
					selectCheck(fieldName,'Market Selection')
				}
				break;

			case 'textarea':
				//Registration
				if(theFieldName == 'txtAddress'){
					strCheck(fieldName,1,'your address');
				//Contact Us
				}else if(theFieldName == 'txtEnquiry'){
				strCheck(fieldName,1,'enquiry');
				//vchComments
				}else if (theFieldName == 'vchComments'){
					strCheck(fieldName,1,'comments')
				}
					break;
	  
			case 'password':
			//Member Login
			if(theFieldName == 'txtPassword'){
				strPasswordCheck(fieldName, 'a valid password');
			}else if(theFieldName == 'vchOldPassword'){
				strPasswordCheck(fieldName, 'your old password');
			}else if(theFieldName == 'vchNewPassword'){
				strPasswordCheck(fieldName, 'your new password');
			}else if(theFieldName == 'vchConfirmPassword'){
				strPasswordCheck(fieldName, 'your confirm password');
			}
			break;
	  	  
			case 'radio':
			break;
	  
			case 'checkbox':
			//Check TOC have been read
			if(theFieldName == 'checkTOC'){
				isCheckedOne(fieldName, 'Please read and accept the terms and conditions');
			}//check subscription
			else if(theFieldName == 'chkBoxProduct'){
					isChecked(fieldName, 'Please select a subscription');
				}
			break;
			
		}
		
		if(ValidOk == false){
	  		break;
		}
		count++;
	}
	
	if (ValidOk == true){
		formName.submit();
	}
}


