function jqm_validate(form_id) {
    
		var flag = true;
		var flag_atleast;
		var err_list = "";
		var val;
		var captInvalid;
		if($("#jqm_validation_alert_dialog").size()==0){
			$("body").append("<div class='jqmWindow' id='jqm_validation_alert_dialog'></div>");
			$("#jqm_validation_alert_dialog").jqm();
		}
		var elements = $(".validate_me");

		$.post('validateCaptcha.asp', { btnTest: $('#btnTest').val(), captchacode: $('#captchacode').val() }, function(data) {
		    elements.filter("input, textarea, select").each(function() {
		        if (!check_parent_display($(this))) {
		            if ($(this).val() == "") {
		                err_list += "<li>You must fill the field: " + $(this).attr("title") + "</li>";
		                flag = false;
		            }
		        }
		    });
		    $(".validate_repeat").each(function() {

		        if ($(this).val() != $("#" + $(this).attr("accesskey")).val()) {
		            err_list += "<li>You must repeat the same " + $(this).attr("title") + " field</li>";
		            flag = false;
		        }
		    });
		    if (data != '') {
		        captInvalid = data.toString();
		        err_list += '<li>' + data + '</li>';
		        RefreshImage('imgCaptcha')
		        flag = false;
		    }

		    if (!flag || captInvalid != null) {
		        alert(captInvalid);
		        $("#jqm_validation_alert_dialog").html("");
		        $("#jqm_validation_alert_dialog").append("The following errors accured while submitting the form: <ul>" + err_list + "</ul>");
		        $("#jqm_validation_alert_dialog").append("<div style='text-align:right;'><a href='#' class='jqmClose'>close</a></div>");
		        $("#jqm_validation_alert_dialog").jqmShow();

		        return false;
		    } else {
		        //return true;
		        form_id.submit();
		    }


		}, 'html');
		
		//flag_atleast = false;
//		var title_atleast;
//		$(".atleast_1").each(function(){
//			if (!check_parent_display($(this))){
//				val = $(this).val();
//				title_atleast = $(this).attr("title");
//				$(".atleast_2").each(function(){
//					if(!check_parent_display($(this))){
//						if (($(this).val() !="") || val!=""){
//							flag_atleast = true;
//						}
//					}
//				});			
//			}
//		});
//		if (!flag_atleast){
//			err_list += "<li>You must choose at least one field of specialization</li>";
//			flag = false;
//		}
		
	}
	
	function check_parent_display(element){
		if(element.css("display")=="none"){
			return true;
		}else{
			if(element.parent().not($("body")).length==0){
				return false;
			}else{
				return check_parent_display(element.parent());
			}
		}
	
	}