// JavaScript Document
function signupValidate()
{
	missinginfo = "";
	errorBGColor = 'Yellow';
	BGColor = 'White';
	document.frmSignup.txtboxUserID.value = trimStartEnd(document.frmSignup.txtboxUserID.value); //trim value from left and right;
	document.frmSignup.txtboxUserEmail.value = trimStartEnd(document.frmSignup.txtboxUserEmail.value); //trim value from left and right;
	document.frmSignup.txtboxUserPassword.value = trimStartEnd(document.frmSignup.txtboxUserPassword.value); //trim value from left and right;
	document.frmSignup.txtboxUserPasswordRetyped.value = trimStartEnd(document.frmSignup.txtboxUserPasswordRetyped.value); //trim value from left and right;
	document.frmSignup.txtboxUserFirstName.value = trimStartEnd(document.frmSignup.txtboxUserFirstName.value); //trim value from left and right;
	document.frmSignup.txtboxUserLastName.value = trimStartEnd(document.frmSignup.txtboxUserLastName.value); //trim value from left and right;
	document.frmSignup.txtboxCity.value = trimStartEnd(document.frmSignup.txtboxCity.value); //trim value from left and right;
	document.frmSignup.txtboxUserMobileNo.value = trimStartEnd(document.frmSignup.txtboxUserMobileNo.value); //trim value from left and right;
	document.frmSignup.txtboxCompany.value = trimStartEnd(document.frmSignup.txtboxCompany.value); //trim value from left and right;
	if (document.frmSignup.txtboxUserID.value == "") 
	{
		document.frmSignup.txtboxUserID.style.background = errorBGColor;
		missinginfo += "\n     -  User Name must contains characters and/or numbers i.e A-Za-z0-9_";
	}
	if (document.frmSignup.txtboxUserID.value.length < 3 ||
		document.frmSignup.txtboxUserID.value.length > 50) 
	{
		document.frmSignup.txtboxUserID.style.background = errorBGColor;
		missinginfo += "\n     -  User Name length must be between 3 to 50. Letters-Number";
	}
	else if(/\W/.test(document.frmSignup.txtboxUserID.value))
	{
		document.frmSignup.txtboxUserID.style.background = errorBGColor;
		missinginfo += "\n     -  User Name contains illegal characters e.g. ()/\\%$#&=+ etc.";
	}
	else
	{
		document.frmSignup.txtboxUserID.style.background = BGColor;
	}
	if (document.frmSignup.txtboxUserEmail.value == "" ||
		document.frmSignup.txtboxUserEmail.value.length < 5) 
	{
		document.frmSignup.txtboxUserEmail.style.background = errorBGColor;
		missinginfo += "\n     -  Please enter valid Email Address\n	i.e. yourname@company.com";
	}
	else if (!validateEmail(document.frmSignup.txtboxUserEmail.value))
	{
		missinginfo += "\n     -  Please enter valid Email Address\n	i.e. yourname@company.com";
	}
	else
	{
		document.frmSignup.txtboxUserEmail.style.background = BGColor;
	}
	
	if (document.frmSignup.txtboxUserPassword.value == "" ||
		document.frmSignup.txtboxUserPassword.value.length < 4) 
	{
		document.frmSignup.txtboxUserPassword.style.background = errorBGColor;
		missinginfo += "\n     -  Please enter Password. Atleast 4 digits";
	}
	else if(/[\W_]/.test(document.frmSignup.txtboxUserPassword.value)) // allow only letters and numbers 
	{
		document.frmSignup.txtboxUserPassword.style.background = errorBGColor;
		missinginfo += "\n     -  Passsowrd must contains only letters and numbers";
	}
	else
	{
		document.frmSignup.txtboxUserPassword.style.background = BGColor;
	}

	if (document.frmSignup.txtboxUserPassword.value != document.frmSignup.txtboxUserPasswordRetyped.value) 
	{
		document.frmSignup.txtboxUserPasswordRetyped.style.background = errorBGColor;
		missinginfo += "\n     -  Password entered in one field does\n         not match with second field.";
	}
	else
	{
		document.frmSignup.txtboxUserPasswordRetyped.style.background = BGColor;
	}

	if (document.frmSignup.txtboxUserFirstName.value == "" ||
		document.frmSignup.txtboxUserFirstName.value.length < 2) 
	{
		document.frmSignup.txtboxUserFirstName.style.background = errorBGColor;
		missinginfo += "\n     -  Please enter your first name.";
	}
	else
	{
		document.frmSignup.txtboxUserFirstName.style.background = BGColor;
	}
	if (document.frmSignup.txtboxUserLastName.value == "" ||
		document.frmSignup.txtboxUserLastName.value.length < 2) 
	{
		document.frmSignup.txtboxUserLastName.style.background = errorBGColor;
		missinginfo += "\n     -  Please enter your last name.";
	}
	else
	{
		document.frmSignup.txtboxUserLastName.style.background = BGColor;
	}
	if(document.frmSignup.gender.value == "")
	{
		document.frmSignup.gender.style.background = errorBGColor;
		missinginfo += "\n     -  Select Gender.";
	}
	else
	{
		document.frmSignup.gender.style.background = BGColor;
	}

	if(document.frmSignup.dobMonth.value == "")
	{
		document.frmSignup.dobMonth.style.background = errorBGColor;
		missinginfo += "\n     -  Select Month.";
	}
	else
	{
		document.frmSignup.dobMonth.style.background = BGColor;
	}
	if(document.frmSignup.dobDay.value == "")
	{
		document.frmSignup.dobDay.style.background = errorBGColor;
		missinginfo += "\n     -  Select Day.";
	}
	else
	{
		document.frmSignup.dobDay.style.background = BGColor;
	}
	if(document.frmSignup.dobYear.value == "")
	{
		document.frmSignup.dobYear.style.background = errorBGColor;
		missinginfo += "\n     -  Select Year.";
	}
	else
	{
		document.frmSignup.dobYear.style.background = BGColor;
	}

	if(document.frmSignup.listProfession.value == "")
	{
		document.frmSignup.listProfession.style.background = errorBGColor;
		missinginfo += "\n     -  Select Profession.";
	}
	else
	{
		document.frmSignup.listProfession.style.background = BGColor;
	}

	if (document.frmSignup.txtboxCompany.value == "" ||
		document.frmSignup.txtboxCompany.value.length < 2) 
	{
		document.frmSignup.txtboxCompany.style.background = errorBGColor;
		missinginfo += "\n     -  Please enter your Company/Department name.";
	}
	else
	{
		document.frmSignup.txtboxCompany.style.background = BGColor;
	}
	
	if(document.frmSignup.txtboxCity.value == "")
	{
		document.frmSignup.txtboxCity.style.background = errorBGColor;
		missinginfo += "\n     -  Please enter you City.";
	}
	else
	{
		document.frmSignup.txtboxCity.style.background = BGColor;
	}

	if (missinginfo != "") 
	{
		missinginfo ="_____________________________\n" +
		"You failed to correctly fill in your:\n" +
		missinginfo + "\n_____________________________" +
		"\nPlease re-enter and submit again!";
		alert(missinginfo);
		return false;
	}
	else return true;
}