//************** removing white space *****************

function trimWhitespace(string) {

	var newString  = '';
	var substring  = '';
	beginningFound = false;

	// copy characters over to a new string
	// retain whitespace characters if they are between other characters
	for (var i = 0; i < string.length; i++) {

		// copy non-whitespace characters
		if (string.charAt(i) != ' ' && string.charCodeAt(i) != 9) {

			// if the temporary string contains some whitespace characters, copy them first
			if (substring != '') {
				newString += substring;
				substring = '';
			}
			newString += string.charAt(i);
			if (beginningFound == false) beginningFound = true;
		}

		// hold whitespace characters in a temporary string if they follow a non-whitespace character
		else if (beginningFound == true) substring += string.charAt(i);
	}
	return newString;
}

//************** chacking Numeric *****************

function isAlphanumeric(frmfield) {
if (frmfield.search) {
	if ((frmfield.search(/[^\w\s]/) != -1) || (frmfield.search(/\W/) != -1))
	{
		return -1;
	}
}
return 1;
}

//************** Login Screen validation *****************

function validation_login(doc)
{
      str ="";
      //Loginstring = ;
      Loginstring = trimWhitespace(doc.frmlogin.value);
      Passwordstring = trimWhitespace(doc.frmpass.value);

	if((Loginstring == "") || (isAlphanumeric(Loginstring) == -1))
	{
		str += "Please enter the Login name. \n"
	}
	if((Passwordstring == "") || (isAlphanumeric(Passwordstring) == -1))
	{
	       str += "Please enter the Password. \n"
	}
	if(str)
	{
	   alert(str);
	   return false;
	}
	else
	{
	  return true;
	}
}