function login() {
	var username = document.getElementById('login_user').value;
	var password = document.getElementById('login_pass').value;
	
	if (username != '' && password != '') {
		if (alphanumeric(username)) {
			if (alphanumeric(password)) { 
				if (username.length>=6 && username.length<=24) {
					if (password.length>=6 && password.length<=24) {
						var xmlHttp = tryAndcatch(); 
	
						//LOAD AJAX IMAGE
						document.getElementById('response').innerHTML = response('Verifying... <img src="common/images/load-red.gif"/>','ok');
						
						//RETURN RESPONSE
						xmlHttp.onreadystatechange=function() {
							if(xmlHttp.readyState==4) {
							document.getElementById('response').innerHTML = xmlHttp.responseText;
								if (xmlHttp.responseText=='<span class=\"ok\">Redirecting.&nbsp;<img src=\"common/images/load-red.gif\"/></span>') {
								//window.location = 'http://oneinfin8ty.com/member/main.html';
								window.location = 'members/';
								}
							}
						}
					
						//FORMULATE URL
						var url="verify.php";
						url=url+"?username="+username;
						url=url+"&password="+password;
						xmlHttp.open("GET",url,true);
						xmlHttp.send(null);
	
					} else {
						document.getElementById('response').innerHTML = response('Invalid password.','er');
					}
				} else {
					document.getElementById('response').innerHTML = response('Invalid username.','er');
				}
			} else {
				document.getElementById('response').innerHTML = response('Invalid password.','er');
			}
		} else {
			document.getElementById('response').innerHTML = response('Invalid username.','er');
		}
	} else {
		document.getElementById('response').innerHTML = response('Please provide a username and password.','er');
	}
}

function response(txt,type) {
	return '<span class="'+type+'">'+txt+'</span>';
}
