// JavaScript Document
// JavaScript Document
function checkEditpost(form){
                 theform=document.frmpost;
				  if (theform.posttitle.value==""){ 
                     alert("Post Title is required!")
                     theform.posttitle.focus()
                     return false;
                }			
			
				if ((!theform.choose[0].checked) && (!theform.choose[1].checked)){
						alert("Either Zipcode or Country is required!")
						return false;
				}
					if(theform.choose[0].checked){
							if (theform.zipcode.value==""){
							 alert("Zipcode is required!")
							 theform.zipcode.focus()
							 return false;
						}
						
						if (isNaN(theform.zipcode.value)){ 
							 alert("Zipcode must be number!")
							 theform.zipcode.focus()
							 return false;
						}			
						if ((theform.zipcode.value).length<5){ 
							 alert("Zipcode must be five digit number!")
							 theform.zipcode.focus()
							 return false;
						}
				}
				if(theform.choose[1].checked){
							if (theform.country.value==""){
							 alert("Country is required!")
							 theform.country.focus()
							 return false;
						}
							if (!isNaN(theform.country.value)){ 
							 alert("Country should not be number!")
							 theform.country.focus()
							 return false;
						}	
				}	
				 if (theform.location.value==""){ 
                     alert("City/Town is required!")
                     theform.location.focus()
                     return false;
                }
								  
                     if (theform.message_box.value==""){ 
                     alert(" Post details  is required!")
                     theform.message_box.focus()
                     return false;
                }
                     if (theform.notification.value==""){ 
                     alert("Choose notification level!")
                     theform.notification.focus()
                     return false;
                }
							 
				  if (theform.postcategory.value==""){ 
                     alert("Select Category is required!")
                     theform.postcategory.focus()
                     return false;
                }
				var chks = theform.elements['type[]'];		
				var hasChecked = false;
				for (var i=0;i<chks.length;i++){
				if (chks[i].checked){
				hasChecked = true;
				break;
				}
				}
				
				if (!hasChecked){
					alert("At least one type is required!");				
					return false;
				}

}
