	function getLoginWindow(sHttp,redirectUrl)
	{

		if (typeof(window.loginWindow) == 'object')
		{
			return window.loginWindow.show();
		}

		var simple = new Ext.FormPanel({

		submit: function()
		{
		   if (simple.getForm().isValid())
	            {
	            	Ext.Ajax.request({
	            		url: sHttp,
		            	form: simple.getForm().getEl().dom,
		            	extform: simple.getForm(),
		            	success: function(r,o)
		            	{
							try{
								var response = Ext.decode(r.responseText);
								if (response.valid)
								{
									if (!redirectUrl)
									{
										document.location.reload();
									}
									else
									{
										document.location.href = redirectUrl;
									}
								}
								else
								{
									o.extform.setValues([{id:'login_form_password', value:''}]);
									o.extform.clearInvalid();
									o.extform.markInvalid([{id:'login_form_name',msg: response.msg}]);
									Ext.Msg.show({
									   title:'Error',
									   msg: response.msg,
									   buttons: Ext.Msg.OK,
									   icon: Ext.MessageBox.ERROR
									});
								}
							}
							catch (e)
							{
								if (!redirectUrl)
								{
									document.location.reload();
								}
								else
								{
									document.location.href = redirectUrl;
								}
							}
		            	}
	            	});
            	//this.getForm().getEl().dom.submit();
            	}
		},


	        method:'post',
	        labelWidth: 100, // label settings here cascade unless overridden
	        frame:true,
	        title: false,
	        bodyStyle:'padding:5px 5px 0',
	        width: 360,
	        defaults: {width: 230},
	        defaultType: 'textfield',
	        items: [{
	                fieldLabel: 'Username',
	                name: 'login_form_name',
	                allowBlank:false,
	                growMax: 32
	            },{
	                fieldLabel: 'Password',
	                 inputType :'password',
	                name: 'login_form_password',
	                allowBlank:false,
	                growMax: 64
	            },new Ext.form.Checkbox({
	                fieldLabel: 'Remember me',
	                inputType :'checkbox',
	                name: 'remember_username',
	                id: 'remember_username',
	                width:20,
	                checked : Ext.Options.remember_username,
            		defaults: {width: 10}
	            }),{
		            xtype:'fieldset',
		            width: 300,
		            style:'border:none;padding:0',
		            labelWidth: 200,
		            autoHeight:true,
		            defaults: {width: 210},
		            defaultType: 'textfield',
		            collapsed: false,
		            items :[{
			                fieldLabel: '<a href=\'' +sHttp + 'reminder/\'> Forgot your password?</a>',
			                  labelSeparator :'',
			                 inputType :'label',
			                 labelWidth: 200,
			                 width: 1,
			                 hidden:true
			            }
		            ]
		        }
	        ],

	        buttons: [{
	            text: 'Log In',
	            type: 'submit',
	             handler : function(){
           		simple.getForm().submit(
               		{
                    		url:sHttp + 'login/',
	                    	success: function(simple, action) {
                    			window.loginWindow.hide();
        		        	document.location.href = document.location.href;
                    		},
	                    	waitMsg: 'Please Wait'

	                })
	             }
	        },{
	            text: 'Cancel',
	             handler : function(){
	             	window.loginWindow.hide();
	             }

	        },{
	            text: 'Register Now',
	             handler : function(){
					document.location.href =  sHttp + 'signup/';
	             }

	        }]
	    });

	    simple.render(Ext.get('login_form_container'));
	    if (Ext.Options.username)
	    {
	    	simple.getForm().items.items[0].setValue(Ext.Options.username);
	    }


		var map = new Ext.KeyMap(simple.el, {
		    key: Ext.EventObject.ENTER,
		    fn: function(){
		    		this.submit();
		    },
		    scope: simple
		});
		window.loginWindow =  new Ext.Window({
			width: 380,
			autoHeight: true,
			closable:false
			,title: 'Login Form'
			,style: 'z-index:99999'
			,layout: 'fit'
			,items: [simple],
			modal:true
		});
		return window.loginWindow.show();
	}