
function loginAttempt()
{
	var username = Ext.get('username');
	var password = Ext.get('password');
	
	
	
	//Ajax Request to submit contact form. 
	Ext.Ajax.request({
       	form: 'login',
       	url: 'proc_signin.php',
       	method: 'POST',
       	success: function(result){
       		var successString = Ext.decode(result.responseText);
		//var successString = result.responseText.split(':');
       		//successString = successString[1].split('}');
       		
       		//if(result.responseText.trim() == 'true')
       		if(successString.success == true)
       		{
       			window.location = '../student/home.php';
       		}
       		else
       		{			
			var strReason = successString.reason;			
       			if(strReason == 'username')
       			{
       				username.setStyle('background-color','#FFDCDC');
				alert('You have entered an invalid username. Please try again.');
				username.focus();
       			}
       			else if(strReason == 'password')
       			{
       				password.setStyle('background-color','#FFDCDC');
				alert('You have entered an invalid password. Please try again.');
				password.focus();
       			}
			else if(strReason == 'verified')
			{
				alert('Your account registration is incomplete. Please check your email inbox for the account confirmation email.');
			}
       			else
       			{
       				username.setStyle('background-color','#FFDCDC');
       				password.setStyle('background-color','#FFDCDC');
       			}

       		}
			//Ext.MessageBox.alert('Status', 'Changes saved successfully.');
       		//window.location = '../student/home.php';
       		//Ext.set('msg_success','Message Successfully Sent');
       		//alert(result.responseText);
           	//if (result.responseText.trim() == 'ok') {
              	//	Ext.MessageBox.alert('Sucess', 'Success ;).');
           	//}
       	},
       	failure: function(o){
       		username.setStyle('background-color','red');
       		password.setStyle('background-color','red');
           	return;
       	}
   	});
}

function chooseAccountType(accountType)
{
	switch(accountType)
	{
		case 1:
			window.location = '../registration/registrationStudent.php';
			break;
		case 2:
			window.location = '../registration/registrationStudent.php';
			break;
		case 3:
			window.location = '../registration/registrationFaculty.php';
			break;
		case 4:
			window.location = '../registration/registrationStudent.php';
			break;
	}// switch(accountType)

}// function chooseAccountType(accountType)
