function trimAll(sString)
{
while (sString.substring(0,1) == ' ')
{
sString = sString.substring(1, sString.length);
}
while (sString.substring(sString.length-1, sString.length) == ' ')
{
sString = sString.substring(0,sString.length-1);
}
return sString;
}


function Form_Validator(callbackForm)
{

 //Telephone
	 if (trimAll(document.getElementById('telephone').value) == "" )
	 {
	 alert("Please enter a value for the \"Telephone\" field.");
	 document.getElementById('telephone').focus();
	 return (false);
	 }
	 var checkOK = "0123456789";
	 var checkStr = document.getElementById('telephone').value;
	 var allValid = true;
	 var validGroups = true;
	 for (i = 0; i < checkStr.length; i++)
	 {
	 ch = checkStr.charAt(i);
	 for (j = 0; j < checkOK.length; j++)
	 if (ch == checkOK.charAt(j))
	 break;
	 if (j == checkOK.length)
	 {
	 allValid = false;
	 break;
	 }
	 }
	 if (!allValid)
	 {
	 alert("Please enter only digit in the \"Telephone\" field.");
	 document.getElementById('telephone').focus();
	 return (false);
	 }

//'address').value='Communication Address*
	if (trimAll(document.getElementById('address').value) == "" )
	{
	alert("Please enter a value for the \"Communication Address\" field.");
	document.getElementById('address').focus();
	return (false);
	}
	
	if (trimAll(document.getElementById('tbxhigedu').value) == "" )
	{
	alert("Please enter a value for the \"Highest Education\" field.");
	document.getElementById('tbxhigedu').focus();
	return (false);
	}

//E-Mail
	if (trimAll(document.getElementById('email').value) == "" )
	{
	alert("Please enter a value for the \"E-Mail\" field.");
	document.getElementById('email').focus();
	return (false);
	}
	var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_.@ \t\r\n\f";
	var checkStr = document.getElementById('email').value;
	var allValid = true;
	var validGroups = true;
	for (i = 0; i < checkStr.length; i++)
	{
	ch = checkStr.charAt(i);
	for (j = 0; j < checkOK.length; j++)
	if (ch == checkOK.charAt(j))
	break;
	if (j == checkOK.length)
	{
	allValid = false;
	break;
	}
	if (checkStr.indexOf('@') == -1 || checkStr.indexOf('.') == -1 )
	{
	allValid = false;
	break;
	}
	}
	if (!allValid)
	{
	alert("Please enter a valid id in the \"E-Mail \" field.");
	document.getElementById('email').focus();
	return (false);
	}
return (true);
}
