
function trim(strText) 
{ 
    // this will get rid of leading spaces 
    while (strText.substring(0,1) == ' ') 
        strText = strText.substring(1, strText.length);

    // this will get rid of trailing spaces 
    while (strText.substring(strText.length-1,strText.length) == ' ')
        strText = strText.substring(0, strText.length-1);

   return strText;
} 
function isEmpty(s)
{   
	return ((s == null) || (s.length == 0))
}
function isWhitespace (s)
{  
	
  	for (i = 0; i < s.length; i++)
   {   if (s.charAt(i) == " ") 
   			return true;
   		
   		else if (s.charAt(i) == "\r") 
   			return true;

		else if (s.charAt(i) == "\t") 
   			return true;

		else if (s.charAt(i) == "\n") 
   			return true;

   }
    return false;
}
function isValidEmail (s)
{   
	
   if (isWhitespace(s)) 
   		return false;
   	
   var i = 1;
   var sLength = s.length;

    // look for @
   while ((i < sLength) && (s.charAt(i) != "@"))
   { 
   		i++
   }

   if ((i >= sLength) || (s.charAt(i) != "@")) 
   		return false;
   
   else i += 2;

    // look for .
   while ((i < sLength) && (s.charAt(i) != "."))
  	{ 
  		i++
   }

    // there must be at least one character after the .
    if ((i >= sLength - 1) || (s.charAt(i) != ".")) 
    	return false;
    
    else 
    	return true;
}

function isNotCorporateEmail(s)
{   
	
  var t=s.indexOf('@');
  var check=s.substring(t+1);
  if(check=='hotmail.com')
  	return true;
  
  else if (check=='yahoo.com')
  	return true;
  
  else if (check=='rediffmail.com')
  	return true;
  
  else if (check=='yahoo.co.in')
  	return true;
  	
  else if (check=='usa.net')
  	return true;
  
  else if (check=='lycos.com')
  	return true;
  
  else
  	return false;
}
