
function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}
function lrTrim(sText)
{
//performs left and right trim on sText argument passed in
var sTemp = new String(sText);
var s1 = "";
var bDone = 0;
	//left trim
	do
	{
		s1 = sTemp.charAt(0)
		if (s1 == " ")
		{
			sTemp = sTemp.slice(1);
		}
	}
	while (s1 == " ")
	s1 = ""
	//right trim
	do
	{
		s1 = sTemp.charAt(sTemp.length - 1)
		if (s1 == " ")
		{
			sTemp = sTemp.slice(0, sTemp.length - 1);
		}
	}
	while (s1 == " ")
	
	return sTemp
}

function isLetter (c)
{   return ( ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) )
}

function isDigit (c)
{

   return ((c >= "0") && (c <= "9"))
}

function isLetterOrDigit (c)
{   return (isLetter(c) || isDigit(c))
}

function isInteger (s)

{   var i;

    // Search through string's characters one by one
    // until we find a non-numeric character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);

        if (!isDigit(c)) return false;
    }

    // All characters are numbers.
    return true;
}

function isAlphabetic (s)

{   var i;

    // Search through string's characters one by one
    // until we find a non-alphabetic character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is letter.
        var c = s.charAt(i);

        if (!isLetter(c))
        return false;
    }

    // All characters are letters.
    return true;
}

function isAlphanumeric (s)

{   var i;

    // Search through string's characters one by one
    // until we find a non-alphanumeric character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number or letter.
        var c = s.charAt(i);

        if (! (isLetter(c) || isDigit(c) ) )
        return false;
    }

    // All characters are numbers or letters.
    return true;
}

function isIntegerInRange (s, a, b)
{
    // Catch non-integer strings to avoid creating a NaN below,
    // which isn't available on JavaScript 1.0 for Windows.
    if (!isInteger(s, false)) return false;

    // Now, explicitly change the type to integer via parseInt
    // so that the comparison code below will work both on 
    // JavaScript 1.2 (which typechecks in equality comparisons)
    // and JavaScript 1.1 and before (which doesn't).
    var num = parseInt (s);
    return ((num >= a) && (num <= b));
}

function isNumeric(inputToCheck)
	{
		//Desc:  If input character is not numeric then kill the Key code.
		//Input: Character.
	
		var sNumString = "0123456789"
		var sTemp = new String(String.fromCharCode (window.event.keyCode))
		var sASCi
		//note the following chars are not handled in abouve string - " and \
		//text matching is case senstive!!
		sASCi = sTemp.toLowerCase()
	
		if (sNumString.indexOf(sASCi) == -1 && window.event.keyCode != 10)
		{
			//not a number - kill keycode
			window.event.keyCode = 0
			return
		}
	}
function isDecimal(inputToCheck)
	{	
		//Desc:  If input character is not numeric then kill the Key code.
		//Input: Character.
	
		var sNumString = "0123456789."
		var sTemp = new String(String.fromCharCode (window.event.keyCode))
		var sASCi
		//note the following chars are not handled in abouve string - " and \
		//text matching is case senstive!!
		sASCi = sTemp.toLowerCase()
	
		if (sNumString.indexOf(sASCi) == -1 && window.event.keyCode != 10)
		{
			//not a number - kill keycode
			window.event.keyCode = 0
			return
		}
	}
	
//'Data CleanUp App changes by Murali 02/03/04 Starts
function titleCase (str) {  
  var match;
  var r = '';
  var val;
  val = str.value;
  val = val.toLowerCase();
  if (document.all) {
    var re = /\b\w/g;
    while ((match = re.exec(val))) {		
      re = /(.|\n)\b\w/g;    
	  r += val.substring(0, match.index) + match[0].toUpperCase();	  
      val = val.substring(match.index + match[0].length);      
    }       
    r += val;
  }
  else {
    var re = /\b\w/g;
    var ind = 0;    
    while ((match = re.exec(val))) {   
	  r += val.substring(ind, match.index) + match[0].toUpperCase();	  
      ind = re.lastIndex;
    }      
    r += val.substring(ind)
  }
  str.value = lrTrim(r);  
}
//'Data CleanUp App changes by Murali 02/03/04 Ends