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 careercouselorForm_Validator(careercouselorform)
{
	//File
 if (trimAll(careercouselorform.tbxname.value) == "" ||trimAll(careercouselorform.tbxname.value) == "Name *")
 {
 alert("Please enter a value for the \"Name\" field.");
 careercouselorform.tbxname.focus();
 return (false);
 }
 
 if (trimAll(careercouselorform.tbxeduqualification.value) == "" ||trimAll(careercouselorform.tbxeduqualification.value) == "Education Qualification *")
 {
 alert("Please enter a value for the \"Education Qualification\" field.");
 careercouselorform.tbxeduqualification.focus();
 return (false);
 }
	
//File
 if (trimAll(careercouselorform.tbxemail.value) == ""||trimAll(careercouselorform.tbxemail.value) == "Groupstudy Subject *" )
 {
 alert("Please enter a value for the \"Groupstudy Subject\" field.");
 careercouselorform.groupstudytelephone.focus();
 return (false);
 }
	
 //Mobile
 if (trimAll(careercouselorform.tbxmobileno.value) == ""||trimAll(careercouselorform.tbxmobileno.value) == "Mobile Number *" )
 {
 alert("Please select \"Mobile Number\" to upload.");
 careercouselorform.tbxmobileno.focus();
 return (false);
 }
 var checkOK = "0123456789";
 var checkStr = careercouselorform.tbxmobileno.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 \"Mobile Number\" field.");
 careercouselorform.tbxmobileno.focus();
 return (false);
 }



//E-Mail
if (trimAll(careercouselorform.tbxemail.value) == "" || careercouselorform.tbxemail.value == "E-mail *" )
{
alert("Please enter a value for the \"E-Mail\" field.");
careercouselorform.tbxemail.focus();
return (false);
}
var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_.@ \t\r\n\f";
var checkStr = careercouselorform.tbxemail.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.");
careercouselorform.tbxemail.focus();
return (false);
}

 if (trimAll(careercouselorform.locations.value) == ""||trimAll(careercouselorform.locations.value) == "Location *" )
 {
 alert("Please select a value for the \"Location\" field.");
 careercouselorform.locations.focus();
 return (false);
 }
if (trimAll(careercouselorform.Profession.value) == ""||trimAll(careercouselorform.Profession.value) == "Profession *" )
 {
 alert("Please select a value for the \"Profession\" field.");
 careercouselorform.locations.focus();
 return (false);
 }
 if (trimAll(careercouselorform.writing.value) == ""||trimAll(careercouselorform.writing.value) == "Rate your written English skill*" )
 {
 alert("Please select a value for the \"Writing\" field.");
 careercouselorform.writing.focus();
 return (false);
 }
if (trimAll(careercouselorform.verbal.value) == ""||trimAll(careercouselorform.verbal.value) == "Rate your verbal English skill*" )
 {
 alert("Please select a value for the \"Verbal\" field.");
 careercouselorform.verbal.focus();
 return (false);
 }
if (trimAll(careercouselorform.employerpref.value) == ""||trimAll(careercouselorform.employerpref.value) == "Nature of employer preferred *" )
 {
 alert("Please select a value for the \"Nature of employer preffered\" field.");
 careercouselorform.employerpref.focus();
 return (false);
 }
 if (trimAll(careercouselorform.tbxenquiry.value) == ""||trimAll(careercouselorform.tbxenquiry.value) == "Enquiry *" )
 {
 alert("Please select a value for the \"Enquiry\" field.");
 careercouselorform.tbxenquiry.focus();
 return (false);
 }


return (true);
}
