     
    function checkemail(email){
          var testresults=false;
          var str=email;
          var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
          if (filter.test(str))
               testresults=true;
          else{
               alert("Please input a valid email address!");
               testresults=false;
          }
          return (testresults);
     }
     
	//Empty or Null validator
	function isEmpty(s)
	{
		return ((s == null) || (s.length == 0));
	}

	//Phone
	function ValidatePhone(src) {
	var regex = /^([0-9]{3,3})+\-([0-9]{3,3})+\-+([0-9]{4,4})$/;
	return regex.test(src);
	}

	//Zip
	function ValidateZip(src,Country) {
		var regex = '';
		if (Country=='USA')
			regex = /^([0-9]{5}-[0-9]{4})$|^([0-9]{5})$/;
		else
			regex = /^([A-Z][0-9][A-Z][ ]{1}[0-9][A-Z][0-9])$/;
		return regex.test(src);
	}
	
	//Check Whole Number
     function CheckNum(s){
		for (var i = 0; i<s.length; i++){
			var ch = s.substring(i, i + 1);	
			//if ((ch<'0' || '9' <ch) && ch != '.' && ch != '$' && ch !=',' && ch !='-') {
			if (ch<'0' || '9' <ch){
				alert("Invalid Character '" + ch + "'. Please enter correct numeric value.");
				return true ;
			}
		}
		return false;
	}
	
	//This function will trim any spaces from a string passed to it.
function f_trimmer(thisstring)
{
	while(thisstring.charAt(0)==' ')
	{
		thisstring=thisstring.substring(1,thisstring.length);
	}
	thisstring=r_trimmer(thisstring);
	return thisstring;
}

//This function will remove any spaces from right of a string passed to it.
function r_trimmer(thisstring)
{
	while(thisstring.charAt(thisstring.length-1)==' ')
	{
		thisstring=thisstring.substring(0,(thisstring.length-1));
	}
	return thisstring;
}
