function validateLogin()
{
	trimFields();
	if(obj.user_name.value == "")
	{
		alert("Please enter your User ID.");
		obj.user_name.focus();
		return;
	}
	//CHECK FIRST LETTER FOR NUMBER
	if(!chkFirstChar(obj.user_name.value))
	{
		alert("First letter must be Alphabet !");
		obj.user_name.focus();
		obj.user_name.select();
		return;
	}
	else 
	{
		if(!chkString(obj.user_name.value))
		{
			alert("You can't use any special character in the User ID field.");
			obj.user_name.focus();
			obj.user_name.select();
			return;
		}
	}

	if(obj.password.value == "")
	{
		alert("Please enter your Password.");
		obj.password.focus();
		return;
	}
	if(obj.password.value.length < 6)
	{
		alert("Password should be minimum of 6 charcters in length.");
		obj.password.focus();
		return;
	}
	/*
	if(!chkString(obj.password.value))
	{
		alert("Password should be alphanumeric");
		obj.password.focus();
		return;
	}
	*/
	if(obj.user_type.selectedIndex == 0)
	{
		alert("Please choose your User Type.");
		obj.user_type.focus();
		return;
	}
	
	var inputs = document.getElementsByTagName('input');
	var i=0;
	var value;
	while(i<inputs.length)
	{
		  if (inputs[i].type == 'text')
		  {
			if (inputs[i].name == 'code')
			{
				if(obj.code.value == "")
				{
					alert("Please enter security code.");
					obj.code.focus();
					return;
				}
			}	
		  }  
		  i++;
	}
	
	//All okay???
	obj.action = "index.php";
	obj.submit();
}
//CHECK FIRST LETTER FOR NUMBER
function chkFirstChar(tmpStr)
{	
	var check_str = /^[0-9_,\s]*$/i;
	if(check_str.test(tmpStr.charAt(0)))
	{
		return false;		
	}
	else
	{
		return true;
	}

}
