if(typeof Range!="undefined"&&typeof Range.prototype.createContextualFragment=="undefined"){Range.prototype.createContextualFragment=function(B){var C=this.startContainer.ownerDocument;var A=C.createElement("div");A.innerHTML=B;var E=C.createDocumentFragment(),D;while((D=A.firstChild)){E.appendChild(D)}return E}}Ext.BLANK_IMAGE_URL=BLANK_IMAGE_URL;Ext.namespace("Custlogin");Custlogin.Auth_panel=Ext.extend(Ext.form.FormPanel,{labelWidth:80,url:BASE_URL+"cred/login",frame:true,border:false,defaultType:"textfield",defaults:{anchor:"-24"},buttonAlign:"right",monitorValid:true,initComponent:function(){Ext.apply(this,{keys:{key:[10,13],handler:this.submit,scope:this},items:[{fieldLabel:"Username",name:"username",allowBlank:false},{fieldLabel:"Password",name:"password",inputType:"password",allowBlank:false},{boxLabel:"Remember me on this computer.",xtype:"checkbox",name:"remember",hideLabel:true}],buttons:[{text:"Login",formBind:true,scope:this,handler:this.submit}]});Custlogin.Auth_panel.superclass.initComponent.apply(this,arguments)},onRender:function(){Custlogin.Auth_panel.superclass.onRender.apply(this,arguments);this.getForm().waitMsgTarget=this.getEl()},submit:function(){this.getForm().submit({url:this.url+((this.app_data.site_tag=="")?"":"/r/"+this.app_data.site_tag),scope:this,success:this.onSuccess,failure:this.onFailure,waitMsg:"Authenticating..."})},onSuccess:function(A,B){if(top!=self){top.location=BASE_URL+"base"}else{window.location=BASE_URL+"base"}},onFailure:function(A,B){if(B.result&&B.result.error){this.showError(B.result.error)}},showError:function(B,A){A=A||"Error";Ext.Msg.show({title:A,msg:B,modal:true,icon:Ext.Msg.ERROR,buttons:Ext.Msg.OK})}});Ext.reg("auth_panel",Custlogin.Auth_panel);Ext.onReady(function(){Ext.QuickTips.init();var A=Ext.util.JSON.decode(APP_DATA);if(A.logged_in){if(top!=self){top.location=BASE_URL+"base"}else{window.location=BASE_URL+"base"}}var B=new Ext.Window({layout:"fit",title:"Please Login",width:300,height:150,closable:false,resizable:false,draggable:false,border:false,items:{xtype:"auth_panel",app_data:A}});B.show();setTimeout(function(){Ext.get("loading").remove();Ext.get("loading-mask").fadeOut({remove:true})},250)});
