


	function formValidation()
	{
		// Clear all fieldname css
		for(i=0; i<document.all.length; i++)
		{
			if(document.all[i].id.indexOf("_requiredValidator_") >= 0 || document.all[i].id.indexOf("_customValidator_") >= 0 || document.all[i].id.indexOf("_compareValidator_") >= 0 || document.all[i].id.indexOf("_rangeValidator_") >= 0  || document.all[i].id.indexOf("_regexValidator_") >= 0)// || document.all[i].id.indexOf("_reqDate") >= 0)
			{
				var validatorID = document.all[i].id;
				var fieldName = validatorID.substring(validatorID.lastIndexOf("_"), validatorID.length);
				document.getElementById("FieldName" + fieldName).className = "";
				
			}
		}
		
		for(i=0; i<document.all.length; i++)
		{
			
			if(document.all[i].id.indexOf("_requiredValidator_") >= 0 || document.all[i].id.indexOf("_customValidator_") >= 0 || document.all[i].id.indexOf("_compareValidator_") >= 0 || document.all[i].id.indexOf("_rangeValidator_") >= 0 || document.all[i].id.indexOf("_regexValidator_") >= 0 || document.all[i].id.indexOf("_reqDate") >= 0)
			{
//				alert('2 validator found -> ' + document.all[i].id);	
				if (document.all[i].style.visibility == "visible")
				{
					var validatorID = document.all[i].id;
					//For date picker
					if (document.all[i].id.indexOf("_reqDate") >= 0)
					{
						//there are 2 underscores, meaning the datepicker is used inside a control
						if (validatorID.indexOf("_") != validatorID.lastIndexOf("_"))
						{
							var fieldName = validatorID.substring(validatorID.indexOf("_"), validatorID.lastIndexOf("_"));	
						}
						else
						{
							var fieldName = "_" + validatorID.substring(0, validatorID.lastIndexOf("_"));	
						}
					}
					else
					{
						var fieldName = validatorID.substring(validatorID.lastIndexOf("_"), validatorID.length);
					}
					//alert(fieldName);	
					document.getElementById("FieldName" + fieldName).className = "error_content";
					divValidationMessage.style.display = '';
				}
			}
		}
		/*		
			
		for(i=0; i<document.all.length; i++)
		{
			if(document.all[i].id.indexOf("_requiredValidator_") >= 0 || document.all[i].id.indexOf("_customValidator_") >= 0 || document.all[i].id.indexOf("_compareValidator_") >= 0)
			{
				if (document.all[i].style.visibility == "visible")
				{
					var validatorID = document.all[i].id;
					var fieldName = validatorID.substring(validatorID.lastIndexOf("_"), validatorID.length);			
					document.getElementById("FieldName" + fieldName).className = "error_content";
				}
			}
		}*/
	}
	function getFieldName(strInput)
	{
		var pos = strInput.lastIndexOf("_");
		return strInput.substring(pos+1, strInput.length);
	}
