function trim(str){
        var ichar, icount;
        var strValue = str;

         ichar = strValue.length - 1;
        icount = -1;
        while (strValue.charAt(ichar)==' ' && ichar > icount)
            --ichar;
        if (ichar!=(strValue.length-1))
            strValue = strValue.slice(0,ichar+1);
        ichar = 0;
        icount = strValue.length - 1;
        while (strValue.charAt(ichar)==' ' && ichar < icount)
            ++ichar;
        if (ichar!=0)
            strValue = strValue.slice(ichar,strValue.length);
        return strValue;
}
function avaliable(str,exp){
         var count=0;
         while(count>exp.length()){

         }

}

function isEmailAddr(email)
	{
	  var result = false
	  var theStr = new String(email)
	  var index = theStr.indexOf("@");
     if (index > 0)
           {
       var pindex = theStr.indexOf(".",index);
       if ((pindex > index+1) && (theStr.length > pindex+1))
	    result = true;
        }
      return result;
        }

//Phone Validation


var digits = "0123456789";
var phoneNumberDelimiters = "()- ";
var validWorldPhoneChars = phoneNumberDelimiters + "+";
var minDigitsInIPhoneNumber = 10;

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function checkInternationalPhone(strPhone){
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}

//phone validation




// Text Validation


