function file_name_only(str) { 
	var slash = '/' 
	if (str.match(/\\/)) { 
		slash = '\\' 
	} 
	return str.substring(str.lastIndexOf(slash) + 1, str.lastIndexOf('.')) 
} 

function isValidPasswdLength(passStr) {
	if ((passStr.length <=3) || (passStr.length >12)) 
		return false;
	else
		return true;
}

function isValidLoginLength(loginStr) {
	if ((loginStr.length <=3) || (loginStr.length >20)) 
		return false;
	else
		return true;
}

function isValidPasswdChar(passStr) {
	temp = passStr.toUpperCase();
	var ValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_*";
	var IsValid=true;
	var Char;
	
	for (i = 0; i < temp.length && IsValid == true; i++) 
	{ 
		Char = temp.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) {
			IsValid = false;
		}
	}
	return IsValid;
}

function LTrim(str)
{
   var whitespace = new String(" \t\n\r");

   var s = new String(str);

   if (whitespace.indexOf(s.charAt(0)) != -1) {
      // We have a string with leading blank(s)...

      var j=0, i = s.length;

      // Iterate from the far left of string until we
      // don't have any more whitespace...
      while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
         j++;

      // Get the substring from the first non-whitespace
      // character to the end of the string...
      s = s.substring(j, i);
   }
   return s;
}

function RTrim(str)
{
    var whitespace = new String(" \t\n\r");

   var s = new String(str);

   if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {

      var i = s.length - 1;       // Get length of string

       while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
         i--;
      s = s.substring(0, i+1);
   }

   return s;
}

function Trim(str)
{
   return RTrim(LTrim(str));
}

function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;
 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
}

function testIsValidObject(objToTest) {
	if (null == objToTest) {
		return false;
	}
	if ("undefined" == typeof(objToTest) ) {
		return false;
	}
	return true;
}

function isValidEmail(strEmail){
  validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;

   // search email text for regular exp matches
    if (strEmail.search(validRegExp) == -1) 
   {
      return false;
    } 
    return true; 
}

