

function onSubmit(){

	var objForm = document.mainform;
	var action = objForm.aFormAction.value;
	var sendIt = true;

	for (var iCounter=0; iCounter<objForm.length; iCounter++){
	var formEl=objForm.elements[iCounter];
	
	
	/*
	Todo: create generic validation
	if(formEl.type == "checkbox"){
	
	alert(objForm.elements[iCounter].checked);
	
		if(formEl.name.checked == false){
		alert(formEl.name.checked);
		}			
	}
	*/

	// show validate message
	if(document.getElementById("required"+formEl.id)){
			if(formEl.value == ""){
			
				document.getElementById("requiredText"+formEl.id).style.display = "inline";
				sendIt = false
			}
			
		}
    }
    
  
	if(sendIt==true){
		document.mainform.method="post";
		document.mainform.action=action;
		document.mainform.__VIEWSTATE.name ="NOVIEWSTATE";
		document.mainform.submit();
	}

}


