
function ValidateState(source, arguments)
{
  //-1 - not selected State
  if (arguments.Value != -1)
    arguments.IsValid = true;
  else
    arguments.IsValid = false;
}

function ValidateDistrict(source, arguments)
{
  //-1 - not selected District
  if (arguments.Value != -1)
    arguments.IsValid = true;
  else
    arguments.IsValid = false;
}

function ValidateSchoolLevel(source, arguments)
{
  //-1 - not selected SchoolLevel
  if (arguments.Value != -1)
    arguments.IsValid = true;
  else
    arguments.IsValid = false;
}

function ValidateSchool(source, arguments)
{
  //-1 - not selected School
  if (arguments.Value != -1)
    arguments.IsValid = true;
  else
    arguments.IsValid = false;
}

function ValidateSubject(source, arguments)
{
  //-1 - not selected Subject
  if (arguments.Value != -1)
    arguments.IsValid = true;
  else
    arguments.IsValid = false;
}

function ValidateCategory(source, arguments)
{
  //-1 - not selected Category
  if (arguments.Value != -1)
    arguments.IsValid = true;
  else
    arguments.IsValid = false;
}

function ValidateCurrency(sender, args) 
{
        var input = args.Value;

        // Check for currency formatting.
        // Expression is from http://regexlib.com/REDetails.aspx?regexp_id=70
        re = /^\$?([0-9]{1,3},([0-9]{3},)*[0-9]{3}|[0-9]+)(.[0-9][0-9])?$/;
        isCurrency = input.match(re);
        if (isCurrency) 
        {
                // Convert the string to a number.
                var number = parseFloat(CleanUp(input));
                
                if (number != NaN) 
                {
                        // Check the range.
                        var min = 5;
                        var max = 10000000;
                        if (min <= number && max >= number) {
                                // Input is valid.
                                args.IsValid = true;
                                return;
                        }
                }
        }

        // Input is not valid if we reach this point.
        args.IsValid = false;
        return;
}

function CleanUp(number) 
{
        re = /^\$|,/g;
        return number.replace(re, ""); // remove "$" and ","
}  