function validate_username(frm)
{			
	var chkVal = trim(frm.un.value, frm.un);	
	if(chkVal == "")
	{
		alert("Username cannot be null.");
		frm.un.focus();
		frm.un.select();
		return false;		
	}

	else if(!isNumber(frm.un.value))
	{
           alert("Login name can't begin with numeric values or underscore.");
           frm.un.focus();
		   frm.un.select();
		   return false;	
	}

	else
	{																
		var iChars = "!#$%^&*()+=-[]\\\';,/{}|\":<>?";

		for (var i = 0; i < chkVal.length; i++) 
		{
  			if (iChars.indexOf(chkVal.charAt(i)) != -1) 
  			{
  				alert ("Your username has special characters. Please remove them and try again.");
  				frm.un.focus();
				frm.un.select();
  				return false;
  			}
		}		
	}
	
	chkVal = trim(frm.pw.value, frm.pw);	
	if(chkVal == "")
	{
		alert("Password cannot be null.");
		frm.pw.focus();
		frm.pw.select();
		return false;
	}
	return true;
}

function trim(str, field)
{
	str = str.replace(/^\s*|\s*$/g,"");	
	field.value = str;
	return str;
}
function isNumber(InString)
{		
	var RefString="1234567890_";	
	TempChar= InString.substring(0,1);
	if (RefString.indexOf (TempChar, 0)==-1)  
		return (true);
	
	return (false);
}
