//=============================================================================
// File: login.js
// Common javascript code
//
// Author: 
// carl.phillips@gmail.com
// odin.phillips@gmail.com
//=============================================================================		
	
function onLogin()
{		
	//document.write('onLogin()...' + '<br>');	
	
	if( checkLoginValid() )
	{
		// valid! So now we can submit form to login.php (ready to send account details to mySQL database for creation).
		document.login_form.submit();
	}
	else
	{
		// failed! Do nothing...		
	}
}

function checkLoginValid()
{
	//var email = document.getElementById('email');
	var username = document.getElementById('login_username');
	var password = document.getElementById('login_password');
	// Check #1 - scan for empty fields
	//if(email.value == '' || password.value == '')		
	if(username.value == '' || password.value == '')		
	{			
		alert('Please enter all fields correctly.');
		return false;
	}
	else
	{
		return true;
	}		
}
