function validateForm()
{
    var why="";
    why += checkCollname(document.c2c.cname.value);
    why += checkUsername(document.c2c.uname.value);
    why += checkPassword(document.c2c.pwd.value);
    why += checkAddress(document.c2c.addr.value);
    why += checkPhone(document.c2c.phn.value);
    if (why != "")
    {
       alert(why);
       return false;
    }
return true;
}
function checkCollname(strng)
{
    var error="";
    if(strng == "")
    {
        error="You didn't enter the College Name.\n";
    }
    return error;
}
function checkUsername (strng)
 {

 var error = "";
 if (strng == "")
 {
    error = "You didn't enter a username.\n";
 }
 if ((strng.length < 4) || (strng.length > 10)) 
{
    error = "User name must be more than 4 and less than 10 char.\n";
}
var illegalChars = /\W/;
  // allow only letters, numbers, and underscores
    if (illegalChars.test(strng)) 
{
       error = "The username contains illegal characters.\n";
    } 
return error;
}

function checkPassword (strng) 
{
 var error = "";
 if (strng == "")
 {
    error = "You didn't enter a password.\n";
 }
    var illegalChars = /[\W_]/; 
    if (illegalChars.test(strng))
    {
      error = "The password contains illegal characters.\n";
    }
return error;
}
function checkAddress(strng)
 {

 var error = "";
 if (strng == "")
 {
    error = "You didn't enter the Address\n";
 }
return error;
}
function checkPhone(strng)
{
var error = "";
 if (strng == "")
 {
    error = "You didn't enter the Phone Number.\n";
 }
if (!IsNumeric(strng))
{
error = "Please enter only Numbers for Phone Number.\n";
}
if (strng.length != 10 ) 
{
	error = "The Phone Number is the wrong length.\n";
}
return error;
}
function IsNumeric(sText)
{
var ValidChars = "0123456789";
var IsNumber=true;
var Char;
for (i = 0; i < sText.length && IsNumber == true; i++)
{
Char = sText.charAt(i);
if (ValidChars.indexOf(Char) == -1)
{
IsNumber = false;
}
}
return IsNumber;
}







function validateStdForm()
{
    var why="";
    why += checkFirstName(document.c2c.fname.value);
    why += checkLastName(document.c2c.lname.value);
    why += checkSTDUserName(document.c2c.uname.value);
    why += checkSTDPassword(document.c2c.pwd.value);
    why += checkSTDMobile(document.c2c.mobile.value);
    why += checkSTDEmail(document.c2c.email.value);
    why += checkSTDAddress(document.c2c.addr.value);
    why += checkDropdown(document.c2c.college.value);
    if (why != "")
    {
       alert(why);
       return false;
    }
return true;
}
function checkFirstName (strng)
 {
 var error = "";
 if (strng == "")
 {
    error = "You didn't enter a First Name.\n";
 }
var illegalChars = /\W/;
  // allow only letters, numbers, and underscores
    if (illegalChars.test(strng)) 
{
       error = "The First Name contains illegal characters.\n";
    } 
return error;
}
function checkLastName (strng)
 {
 var error = "";
 if (strng == "")
 {
    error = "You didn't enter a Last Name.\n";
 }
var illegalChars = /\W/;
  // allow only letters, numbers, and underscores
    if (illegalChars.test(strng)) 
{
       error = "The Last Name contains illegal characters.\n";
    } 
return error;
}

function checkSTDUserName (strng)
 {

 var error = "";
 if (strng == "")
 {
    error = "You didn't enter a username.\n";
 }
 if ((strng.length < 4) || (strng.length > 10)) 
{
    error = "User name must be more than 4 and less than 10 char.\n";
}
var illegalChars = /\W/;
  // allow only letters, numbers, and underscores
    if (illegalChars.test(strng)) 
{
       error = "The Username contains illegal characters.\n";
    } 
return error;
}

function checkSTDPassword (strng) 
{
 var error = "";
 if (strng == "")
 {
    error = "You didn't enter a password.\n";
 }
    var illegalChars = /[\W_]/; 
    if (illegalChars.test(strng))
    {
      error = "The Password contains illegal characters.\n";
    }
return error;
}

function checkSTDEmail(strng)
{
var error = "";
 if (strng == "")
 {
    error = "You didn't enter a Email.\n";
 }
var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/;
if (strng.match(illegalChars)) 
{
   error = "The Email Address contains illegal characters.\n";
}
return error;
}
function checkSTDMobile(strng)
{
var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
/*strip out acceptable non-numeric characters*/
if (isNaN(parseInt(stripped))) 
{
   error = "The mobile number contains illegal characters.";
}
if (!IsNumerical(strng))
{
error = "Please enter only Numbers for Mobile.\n";
}
if (strng.length != 10) 
{
	error = "The Mobile Number is the wrong length.\n";
}
return error;
}
function IsNumerical(sText)
{
var ValidChars = "0123456789";
var IsNumber=true;
var Char;
for (i = 0; i < sText.length && IsNumber == true; i++)
{
Char = sText.charAt(i);
if (ValidChars.indexOf(Char) == -1)
{
IsNumber = false;
}
}
return IsNumber;
}

function checkSTDAddress(strng)
 {

 var error = "";
 if (strng == "")
 {
    error = "You didn't enter the Address\n";
 }
return error;
}
function checkDropdown(strng)
{
var error = "";
 if (strng == "Select")
 {
    error = "Please choose any College\n";
 }
return error;
}

function updateForm()
{
    var why="";
    why += checkUPassword(document.c2c.pwd.value);
    why += checkUAddress(document.c2c.addr.value);
    why += checkUPhone(document.c2c.phn.value);
    if (why != "")
    {
       alert(why);
       return false;
    }
return true;
}
function checkUPassword (strng) 
{
 var error = "";
 if (strng == "")
 {
    error = "You didn't enter a password.\n";
 }
    var illegalChars = /[\W_]/; 
    if (illegalChars.test(strng))
    {
      error = "The password contains illegal characters.\n";
    }
return error;
}
function checkUAddress(strng)
 {

 var error = "";
 if (strng == "")
 {
    error = "You didn't enter the Address\n";
 }
return error;
}
function checkUPhone(strng)
{
var error = "";
 if (strng == "")
 {
    error = "You didn't enter the Phone Number.\n";
 }
if (!IsNumeric(strng))
{
error = "Please enter only Numbers for Phone Number.\n";
}
if (strng.length != 10) 
{
	error = "The Phone Number is the wrong length.\n";
}
return error;
}
function IsNumeric(sText)
{
var ValidChars = "0123456789";
var IsNumber=true;
var Char;
for (i = 0; i < sText.length && IsNumber == true; i++)
{
Char = sText.charAt(i);
if (ValidChars.indexOf(Char) == -1)
{
IsNumber = false;
}
}
return IsNumber;
}










function updateStd()
{
    var why="";
    why += checkFirstName(document.c2c.fname.value);
    why += checkLastName(document.c2c.lname.value);
    why += checkSTDPassword(document.c2c.pwd.value);
    why += checkSTDMobile(document.c2c.mobile.value);
    why += checkSTDEmail(document.c2c.email.value);
    why += checkSTDAddress(document.c2c.addr.value);
    if (why != "")
    {
       alert(why);
       return false;
    }
return true;
}
function checkFirstName (strng)
 {
 var error = "";
 if (strng == "")
 {
    error = "You didn't enter a First Name.\n";
 }
var illegalChars = /\W/;
  // allow only letters, numbers, and underscores
    if (illegalChars.test(strng)) 
{
       error = "The First Name contains illegal characters.\n";
    } 
return error;
}
function checkLastName (strng)
 {
 var error = "";
 if (strng == "")
 {
    error = "You didn't enter a Last Name.\n";
 }
var illegalChars = /\W/;
  // allow only letters, numbers, and underscores
    if (illegalChars.test(strng)) 
{
       error = "The Last Name contains illegal characters.\n";
    } 
return error;
}
function checkSTDPassword (strng) 
{
 var error = "";
 if (strng == "")
 {
    error = "You didn't enter a password.\n";
 }
    var illegalChars = /[\W_]/; 
    if (illegalChars.test(strng))
    {
      error = "The Password contains illegal characters.\n";
    }
return error;
}

function checkSTDEmail(strng)
{
var error = "";
 if (strng == "")
 {
    error = "You didn't enter a Email.\n";
 }
var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/;
if (strng.match(illegalChars)) 
{
   error = "The Email Address contains illegal characters.\n";
}
return error;
}
function checkSTDMobile(strng)
{
 var error = "";
var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
/*strip out acceptable non-numeric characters*/
if (isNaN(parseInt(stripped))) 
{
   error = "The mobile number contains illegal characters.";
}
if (!IsNumerical(strng))
{
error = "Please enter only Numbers for Mobile.\n";
}
if (strng.length != 10) 
{
	error = "The Mobile Number is the wrong length.\n";
}
return error;
}
function IsNumerical(sText)
{
var ValidChars = "0123456789";
var IsNumber=true;
var Char;
for (i = 0; i < sText.length && IsNumber == true; i++)
{
Char = sText.charAt(i);
if (ValidChars.indexOf(Char) == -1)
{
IsNumber = false;
}
}
return IsNumber;
}

function checkSTDAddress(strng)
 {

 var error = "";
 if (strng == "")
 {
    error = "You didn't enter the Address\n";
 }
return error;
}







