
//Add comma seprated list of control ids to add required validation
var arrAdditionalRequiredValidation = null;

 function ValidateMe()
{
	$("#Form").unbind('submit'); 
	return	 true;
}

 try
	 { 
$.extend($.validator.messages, {  
	  required: "* Required",  
	   email: "Please enter valid email",
	   equalTo:"Passwords do not match" 
	 }); 
 
$(document).ready(function() 
{ 

if ($("#Form") ==null)
{
	return true;
}
$("#Form").validate({
focusInvalid: true,
errorPlacement: function(error, element) {
	 var errorLable = document.getElementById(element[0].id + '_errorPlaceHolder'); 
if(errorLable== null) { error.insertAfter(element); } 
else {error.insertAfter(errorLable);}
}, errorClass: "invalid"
}); 
		 	$.each($(".Required"),function(){
				AddMinLength(this); 
				var vId=this.id;
				if (vId.indexOf('AddressType') >-1)
				{
					vId += "_0";
				}
			  	$("#" + vId).rules("add", "required");
			});

		 	$.each($(".Email"),function(){ 
				AddMinLength(this); 
				$("#" + this.id).rules("add", "email");
			}); 

		 	$.each($(".REmail"),function(){ 
				AddMinLength(this); 
				$("#" + this.id).rules("add", {required:true,email:true});
			});  
		 
			$.each($(".REqualTo"),function(){ 
				if (this.getAttribute("matchWith") != null)
				{
					var matchControlId = this.id + this.getAttribute("matchWith");
					AddMinLength(this); 
					AddRequired(this);
					$("#" + matchControlId).rules("add", {required:true,equalTo:'#' + this.id});
				}
				else
				{
					AddRequired(this);
				}
			});  
			
			$.each($(".MinLength"),function(){ 
		 		AddMinLength(this); 
	 		}); 
			
			if (arrAdditionalRequiredValidation != null)
			{
				var strElements =arrAdditionalRequiredValidation.split(",");
				for(var i=0; i<strElements.length;i++)
				{
					$("#" + strElements[i]).rules("add", {required:true}); 
				}
			}
			$.each($('.tmar_textlabelrequired,.tmar_TextLabelRequired'),function(){
			this.innerHTML += '<strong><span class="tmar_textlabelrequired">&nbsp;*</span></strong>';
			}); 

});  
 
 function AddRequired(ocontrol)
 {
	$("#" + ocontrol.id).rules("add", "required"); 
 }
function AddMinLength(ocontrol)
{
	var minLength = ocontrol.getAttribute("minLength");
	if (minLength != null)
		$("#" + ocontrol.id).rules("add", {minlength:minLength}); 
}
}
catch(err)
{}