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 == "Firstname"){
					strCheck(fieldName,1,'your first name');
				}
				else if(theFieldName == "Lastname"){
					strCheck(fieldName,1,'your last name');
				}
				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 == 'senderName'){
					strCheck(fieldName,1,'your full name');
				}else if(theFieldName == 'senderEmail'){
					emailCheck(fieldName, 'your valid email address');
				}else if(theFieldName == 'friendsName1'){
					strCheck(fieldName,1,'your friends name');
				}else if(theFieldName == 'friendsEmail1'){
					emailCheck(fieldName, 'your friends valid email address');		
				}								
				break;
 	  
			case 'select-one':
				/*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');
					}
				}
				break;
	  
			case 'checkbox':
				/*
				if(theFieldName == 'default_radio123'){
					isChecked(fieldName, 'default_radio');
				}
				*/		
			break;

		}
		if(ValidOk == false){
	  		break;
		}
		count++;
	}
	
	if (ValidOk == true){
		formName.submit();
	}
}
