function DoLogin(){    
	Ext.QuickTips.init();
    // turn on validation errors beside the field globally
    Ext.form.Field.prototype.msgTarget = 'side';

    var login = new Ext.form.Form({
        labelWidth: 155,
        url:'/html/_login/ajax',
		timeout: 10,
        buttonPosition: 'right'
    });

    login.fieldset(
        {legend:'Log-in to your account'},
				new Ext.form.TextField({
						fieldLabel: 'Gaelic Account ID',
						name: 'strUsername',
						id: 'strUsername',
						width:200,
						value: '',
						blankText: 'Gaelic ID is Required!',
						allowBlank:true
				}),

				new Ext.form.TextField({
						autoCreate : {tag: "input", type: "password", autocomplete: "off"},
						fieldLabel: 'Password',
						name: 'strPassword',
						id: 'strPassword',
						value: '',
						width:200,
						allowBlank:true,
						blankText: 'Password is Required!'
				})
    );
	
	save = login.addButton('Log In', function() {
				login.submit({
						waitMsg: 'Trying to log you in.<br />',
						reset: true,
						scope: login,
						success:
						function (something, action){
							var type = action.type; // e.g. "load"
							var data = action.result; // your full json data pre parsed
					   		//Ext.MessageBox.alert('Log-In Success', 'You have been logged in.<br />Transferring to your account.<br />',goAccount);
					   		//function goAccount(btn) {
								if(data.areaID==1 || data.areaID==2) {
									loadPage("/html/_createnav/ajax", "Nav", 1);
									loadPage("/html/minicart/ajax", "Cart", 1);
								}
					   			location.href=data.area;
					   		//}
						},
						params: {action: 'login'}
				});
    }, login);
	
    
    login.render('form-login');


	login.on('actionfailed', function(form, action){
        if(action.type == 'submit' && action.failureType == Ext.form.Action.SERVER_INVALID){
             // server side validation failed
             Ext.MessageBox.alert('Error', 'Your Username/Password combination do not match.<br />Please try again.<br />');
        }
   });
   
}
//DoLogin();
Ext.EventManager.onDocumentReady(DoLogin, DoLogin, true);
