function DropDownValidate(source, arguments)
{
	arguments.IsValid = false;

	if ((arguments.Value.length>0)&& (arguments.Value!="-1"))
	{
		arguments.IsValid = true;
		return;
	}
}
			// A function that checks a string and if it is a digit, returns true and else false  			
			function isDigit( j_Str ) 
			{
				exp = /^\s*[-\+]?\d+\s*$/;
				
				if (j_Str.match(exp) == null) 
					return false;
				else
					return true;
	        }

			// A function that checks a wipes spaces from left and right of it ( like trim() function in VB ).
			function ValidatorTrim(s) 
			{
				var m = s.match(/^\s*(\S+(\s+\S+)*)\s*$/);
				return (m == null) ? "" : m[1];
			}

			// A function that checks a value and returns true or false
			// 1st Param : j_Val 
			//			   It contains a value that should be checked.
			// 2nd Param : j_Type
			//			   It contains type of validation 
			//			   1- "" value : It determines that we want only to check if j_Val parameter is null or not.  
			//			   2- Email    : It determines that we want to check j_Val parameter as an email address.
			//			   3- Number   : It determines that we want to check j_Val parameter as number.		 
			//
			// If j_Type has "Number" value, 3rd and 4th parameters determines the min and max length of the number.
			// 3rd Param : j_Condition1
			//			   Determines the min length of the number.
			// 4th Param : j_Condition2
			//			   Determines the max length of the number.
			//
			function checkField(j_Val, j_Type, j_Condition1, j_Condition2) 
			{
				var j_Result;	
				j_Result = true;

				var j_Temp = j_Val.toString();

				j_Temp = ValidatorTrim(j_Temp);
				j_Temp = j_Temp.toString();

				if (j_Temp.length == 0)
					j_Result = false;        
				else
				{
					if ( j_Type ==  "Email" )
					{
						if ( (j_Temp.indexOf("@") == -1) || (j_Temp.indexOf(".") == -1) )
							j_Result = false;
					}
					else if ( j_Type ==  "Number" )
					{	
						if ( (!isDigit( j_Temp )) || (j_Temp.length < j_Condition1) || (j_Temp.length > j_Condition2) )
							j_Result = false;
					}
				}					

				return ( j_Result );
			}

			// A function that checks a value for filling and returns true or false
			// If there is any characters except only space, it returns true
			// 1st Param : j_Val 
			//			   It contains a value that should be checked.
			// 
			function isFilled(j_Val) 
			{
				var j_Result;	
				j_Result = true;

				j_Val = j_Val.toString();

				j_Val = ValidatorTrim(j_Val);

				if (j_Val.length == 0)
					j_Result = false;        

				return ( j_Result );
			}
			
			// A function that checks a number value for Min and Max length
			// 1st Param : j_Val 
			//			   It contains a value that should be checked.
			// 2nd Param : j_MinLength
			//			   Determines the min length of the number.
			// 3rd Param : j_MaxLength
			//			   Determines the max length of the number.
			//
			function isValidMinAndMaxLength(j_Val, j_MinLength, j_MaxLength) 
			{
				var j_Result;	
				j_Result = true;

				j_Val = j_Val.toString();

				if ( (j_Val.length < j_MinLength) || (j_Val.length > j_MinLength) )
					j_Result = false;

				return ( j_Result );
			}
			
			// A function to separate a money input variable with caommas.
			function setCommaForMoney(obj)
			{
			  var separatorCahr = ",";
			  var int = obj.value.replace ( new RegExp ( separatorCahr, "g" ), "" );
			  
			  
			  var regexp = new RegExp ( "\\B(\\d{3})(" + separatorCahr + "|$)" );
			  do
			  {
				int = int.replace ( regexp, separatorCahr + "$1" );
			  }
			  while ( int.search ( regexp ) >= 0 )
			  
			  obj.value = int;
 		    }	  
			  

			// A function to reomove comma separators from a money input variable.
			function removeComma(obj)
			{
			  var separatorCahr = ",";
		  
			  obj.value = obj.value.replace ( new RegExp ( separatorCahr, "g" ), "" );
			
			}
			// this function is Displayer Message validator
			function VirtualMessageBox(ti,pi,te,bu){
	document.all['alerttitle'].innerText=ti
	switch (pi){
		case '1':
			document.all['alertpic'].src='../images/Defaultlayout/AlertInfo.gif'
			break
		case '2':
			document.all['alertpic'].src='../images/Defaultlayout/Error.gif'
			break
			}
	 document.all['AlertText'].innerText=te	
	 document.all['alertbutton'].value=bu
	//spacerl.style.visibility="visible"
	walert.style.visibility="visible"
}

function clickButton(e, buttonid){ 
      var bt = document.getElementById(buttonid); 
      if (typeof bt == 'object'){ 
            if(navigator.appName.indexOf("Netscape")>(-1)){ 
                  if (e.keyCode == 13){ 
                        bt.click(); 
                        return false; 
                  } 
            } 
            if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1)){ 
                  if (event.keyCode == 13){ 
                        bt.click(); 
                        return false; 
                  } 
            } 
      }
} 
