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 smsForm_Validator(smsform)
{
//First Name
 if (trimAll(smsform.smsmobilesender.value) == "" || smsform.smsmobilesender.value == "Your Mobile no*" )
 {
 alert("Please enter a value for the \"Your Mobile no\" field.");
 smsform.smsmobilesender.focus();
 return (false);
 }
 var checkOK = "0123456789";
 var checkStr = smsform.smsmobilesender.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 \"Your Mobile no\" field.");
 smsform.smsmobilesender.focus();
 return (false);
 }
 
 
 
 //Telephone
 if (trimAll(smsform.smsmobilefriend.value) == "" || smsform.smsmobilefriend.value == "Friend's Mobile no*" )
 {
 alert("Please enter a value for the \"Friend's Mobile no\" field.");
 smsform.smsmobilefriend.focus();
 return (false);
 }
 var checkOK = "0123456789";
 var checkStr = smsform.smsmobilefriend.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 \"Friend's Mobile no\" field.");
 smsform.smsmobilefriend.focus();
 return (false);
 }
 

 
 
//E-Mail
if (trimAll(smsform.smstext.value) == "" || smsform.smstext.value == "SMS Text *" )
{
alert("Please enter a value for the \"SMS Text\" field.");
smsform.smstext.focus();
return (false);
}

return (true);
}

function sms1Form_Validator(sms1form)
{
//First Name
 if (trimAll(sms1form.smsmobilesender1.value) == "" || sms1form.smsmobilesender1.value == "Your Mobile no*" )
 {
 alert("Please enter a value for the \"Your Mobile no\" field.");
 sms1form.smsmobilesender1.focus();
 return (false);
 }
 var checkOK = "0123456789";
 var checkStr = sms1form.smsmobilesender1.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 \"Your Mobile no\" field.");
 sms1form.smsmobilesender1.focus();
 return (false);
 }
 
 
 
 //Telephone
 if (trimAll(sms1form.smsmobilefriend1.value) == "" || sms1form.smsmobilefriend1.value == "Friend's Mobile no*" )
 {
 alert("Please enter a value for the \"Friend's Mobile no\" field.");
 smsform.smsmobilefriend.focus();
 return (false);
 }
 var checkOK = "0123456789";
 var checkStr = sms1form.smsmobilefriend1.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 \"Friend's Mobile no\" field.");
 sms1form.smsmobilefriend1.focus();
 return (false);
 }
 

 
 
//E-Mail
if (trimAll(sms1form.smstext1.value) == "" || sms1form.smstext1.value == "SMS Text *" )
{
alert("Please enter a value for the \"SMS Text\" field.");
sms1form.smstext1.focus();
return (false);
}

return (true);
}
