﻿	// JScript File
	var g_sValidChars = "";


	function ValidateRequired(controlList)
	{
		var returnValue = true;
		var controlToValidate = null;
		var controlListArray = controlList.split(';');
	      
		//loop through controls
		for (i = 0; i < controlListArray.length; i++)
		{
			//get the control
			controlToValidate = document.getElementById(controlListArray[i]);
	        
			//check value
			if (controlToValidate != null)
			{
				if (controlToValidate.value.length == 0)
				{
	                
					if (returnValue)
					{
						
					}
	                                
					returnValue = false;
				}
				else
				{
				}
			}
		}
	    
		return returnValue;
	}





	function ValidateRequiredDropDown(controlList)
	{
		var returnValue = true;
		var controlToValidate = null;
		var controlListArray = controlList.split(';');
	      
		//loop through controls
		for (i = 0; i < controlListArray.length; i++)
		{
			//get the control
			controlToValidate = document.getElementById(controlListArray[i]);
	        
			//check value
			if (controlToValidate != null)
			{
				if (controlToValidate.selectedIndex < 1)
				{
	                
					if (returnValue)
					{
						controlToValidate.focus();
					}
	                                
					returnValue = false;
				}
				else
				{
				}
			}
		}
	    
		return returnValue;
	}







	function ValidateRegex(controlList, patern)
	{
		var returnValue = true;
		var controlToValidate = null;
		var controlListArray = controlList.split(';');
	      
		//loop through controls
		for (i = 0; i < controlListArray.length; i++)
		{
			//get the control
			controlToValidate = document.getElementById(controlListArray[i]);
	        
			//check value
			if (controlToValidate != null)
			{
				if (!patern.test(controlToValidate.value))
				{
					
	                
					if (returnValue)
					{
						controlToValidate.focus();
					}
	                                
					returnValue = false;
				}
				else
				{
					
					
				}
			}
		}
	
		return returnValue;
	}


	
	function TestRegex(controlList, patern)
	{
		var returnValue = false;
		var controlToValidate = null;
		var controlListArray = controlList.split(';');
	      
		//loop through controls
		for (i = 0; i < controlListArray.length; i++)
		{
			//get the control
			controlToValidate = document.getElementById(controlListArray[i]);
	        
			//check value
			if (controlToValidate != null)
			{
				if (!patern.test(controlToValidate.value))
				{
					
					
	                returnValue = false;  
	                    
				}
				else
				{

					returnValue = true;
				}
			}
		}
		return returnValue;
	}




	function txtTextbox_OnKeyUp()
	{
		var controlListArray = g_sTextValidationList.split(';');
		//loop through value
		var value = this.value;
		
		//check value
		if (value.length > 0)
		{
			for(i = 0; i < value.length; i++)
			{
				//check this value
				if (g_sValidChars.indexOf(value.substring(i, (i + 1))) < 0)
				{
					//remove this caracter
					this.value = this.value.substr(0, i);
		            
					
			        
					return false;
				}
			}
		}
		else
		{
		}		
	}
	
	
	
	

	