if(typeof window.modules=='undefined')
{window.modules={};}
window.modules.chat=Ext.extend(Ext.app.Module,{id:'chat',init:function()
{this.launcher={text:'~quant~ Chat &alpha;1.7',iconCls:'icon-user-comment',handler:this.createWindow,scope:this}},createWindow:function()
{var desktop=this.app.getDesktop();var win=desktop.getWindow('chatWin');if(!win)
{var msg_grid=new Ext.grid.EditorGridPanel
({autoExpandColumn:'msg',cm:new Ext.grid.ColumnModel
({defaults:{hideable:false,sortable:false,width:80},columns:[{id:'user',header:"User",dataIndex:'user',renderer:function(value,meta)
{meta.attr='style="white-space:nowrap"';return value;}},{id:'timestamp',header:"Time",dataIndex:'timestamp',width:60,hideable:true},{id:'msg',header:'message',dataIndex:'msg',css:"white-space: normal !important;",editor:{xtype:'textarea'}}]}),flex:2,frame:true,height:300,id:'msg_grid',loadMask:true,store:window.stores.chatStore,stripeRows:true,sm:new Ext.grid.RowSelectionModel
({singleSelect:true}),view:new Ext.grid.GridView
({emptyText:'No Messages Loaded',deferEmptyText:false})});var width=700;var height=(Ext.lib.Dom.getViewHeight())/3;height=(height>300)?height:300;width=(width>Ext.lib.Dom.getViewWidth())?(Ext.lib.Dom.getViewWidth()-5):width;var x=Ext.lib.Dom.getViewWidth()-width;var y=Ext.lib.Dom.getViewHeight()-height-30;win=desktop.createWindow({id:'chatWin',title:'~quant~ Chat &alpha;1.7',width:width,height:height,x:x,y:y,iconCls:'icon-user-comment',shim:true,animCollapse:false,constrainHeader:true,plain:true,layout:'border',post:function()
{win=Ext.getCmp('chatWin');var poller=Ext.Direct.getProvider('jabber_polling');if(typeof(poller)!='undefined')
{if(poller.isConnected())
{poller.disconnect();}}
var value=trim(Ext.getCmp('jab_htmled').getValue());Ext.getCmp('jab_htmled').reset();if(!Ext.isEmpty(value))
{chatFunctions.post(value,jabberVariables['lastMsg'],window.userVariables['name'],callbacks);}},post_message:function(msg,scroll)
{if(typeof scroll=='undefined')
{scroll=false;}
if(typeof(msg.msg)!='undefined'&&typeof msg.user!='undefined'&&jabberVariables['lastConvo']!=msg.msg)
{msg.time=msg.time*1;var timestamp=date('H:i:s',msg.time);var grid=Ext.getCmp('msg_grid');var a={};if(strpos(msg.msg,"/me ")!==false)
{a=new window.stores.chatStore.record
({ID:msg.ID,user:'&nbsp;',timestamp:timestamp,msg:String.format('<i><b> *{0}</b> {1}*</i>',msg.user,msg.msg.replace("/me "," "))});}
else
{a=new window.stores.chatStore.record
({ID:msg.ID,user:msg.user,timestamp:timestamp,msg:msg.msg});}
var count=grid.getStore().getCount();var max=75;var prune=50;grid.getStore().add(a);grid.getSelectionModel().selectLastRow();if(count>0&&scroll)
{grid.getView().focusRow(count);}
if(count==max+prune)
{var tr={};var removal=[];var found=false;for(var i=prune;i>=0;i=i-1)
{var del=(count-max-i);tr=grid.getStore().getAt(del);if(typeof tr!=undefined)
{found=true;removal[i]=tr;}}
if(found===true)
{grid.getStore().remove(removal);}}
jabberVariables['lastConvo']=msg.msg;Ext.get('jab_htmled').focus();if(Ext.isChrome)
{window.setTimeout(function()
{Ext.get('jab_htmled').focus();},20);}}},defaults:{resizeable:true,hideMode:'nosize',frame:true,focusOnLoad:true,vtype:'an'},items:[{bodyStyle:"overflow-y:auto;",ref:'users',region:'west',collapsible:true,style:"white-space: nowrap;",title:'Users',width:100},{region:'center',collapsible:false,margins:'0 0 0 0',layout:{type:'vbox',align:'stretch'},items:[msg_grid,{xtype:'toolbar',cls:'x-html-editor-tb',ref:'toolbar',items:[{xtype:'button',iconCls:'x-edit-bold',ref:'../btnBold',handler:function(b)
{b.refOwner.wrapText('[b]','[/b]');}},{xtype:'button',iconCls:'x-edit-italic',ref:'btnItalic',handler:function(b)
{b.refOwner.wrapText('[i]','[/i]');}},{xtype:'button',iconCls:'x-edit-underline',ref:'btnUnderline',handler:function(b)
{b.refOwner.wrapText('[u]','[/u]');}},'-','->',{xtype:'button',enableToggle:true,iconCls:'icon-pause',ref:'../btnPause',toggleHandler:function(b,isToggled)
{if(isToggled===true)
{if(Ext.Direct.getProvider('jabber_polling').isConnected())
{Ext.Direct.getProvider('jabber_polling').disconnect();}}
else
{if(typeof(Ext.Direct.getProvider('jabber_polling'))!='undefined')
{if(!(Ext.Direct.getProvider('jabber_polling').isConnected()))
{Ext.Direct.getProvider('jabber_polling').connect();}}}}}]},{xtype:'textarea',name:'jabberEditor',height:75,id:'jab_htmled',ref:'../textarea'}]}],listeners:{render:function()
{window.jabberVariables=[];window.jabberVariables['lastMsg']=0;window.jabberVariables['midPoll']=false;window.jabberVariables['asleep']=false;window.jabberVariables['pollInterval']=10000;window.jabberVariables['lastConvo']='';},afterrender:function(p)
{var mask=new Ext.LoadMask
(this.getEl(),{msg:'Loading Chat History',removeMask:true});mask.show();new Ext.KeyMap(this.textarea.getEl(),{key:13,shift:false,stopEvent:true,handler:p.post});this.textarea.onEditorEvent=function(e)
{this.updateToolbar();var keyCode=(document.layers)?keyStroke.which:e.keyCode;if(keyCode==13)
{var p=Ext.getCmp('chatWin');p.post();return false;}}
if(typeof(Ext.Direct.getProvider('jabber_polling'))=='undefined')
{Ext.Direct.addProvider
({type:'polling',url:'?a=jab',id:'jabber_polling',priority:4,interval:jabberVariables.pollInterval,baseParams:{poll:0,user:window.userVariables['name']},listeners:{beforepoll:function(poll)
{if(poll.baseParams.poll>(600000/jabberVariables['pollInterval']))
{if(jabberVariables.asleep===false)
{var desktop=MyDesktop.getDesktop();jabberVariables.asleep=true;if(Ext.Direct.getProvider('jabber_polling').isConnected())
{Ext.Direct.getProvider('jabber_polling').disconnect();Ext.Direct.getProvider('jabber_polling').interval=900000;Ext.Direct.getProvider('jabber_polling').connect();}
var mask=new Ext.LoadMask
(desktop.getWindow('chatWin').getEl(),{msg:'Asleep due to inactivity - only checking for updates every 15 minutes.  <br /> Hover over me to resume real-time updates.'});mask.show();desktop.getWindow('chatWin').getEl().on('mouseover',function()
{if(jabberVariables.asleep===true)
{mask.hide();Ext.Direct.getProvider('jabber_polling').disconnect();Ext.Direct.getProvider('jabber_polling').interval=jabberVariables.pollInterval;Ext.Direct.getProvider('jabber_polling').connect();desktop.getWindow('chatWin').getEl().removeListener('mouseover');jabberVariables.asleep=false;}});}}
jabberVariables.midPoll=poll.baseParams.poll+1;poll.baseParams.poll=jabberVariables.midPoll;if(typeof jabberVariables.lastMsg=='undefined'&&typeof window.formPanels.jabberConvo!='undefined')
{jabberVariables.lastMsg=0;window.formPanels.jabberConvo.append("<br />Chat out of Sync - Please wait a moment<br />");}
poll.url='?a=jab&last='+jabberVariables.lastMsg;},data:function(provider,e)
{if(e.data)
{if(e.data.pid<jabberVariables.midPoll)
{return true;}
jabberVariables.lastMsg=e.data.last;if(e.data.firstRun==true)
{Ext.get('chatWin').unmask();}
for(var i in e.data.msgs)
{p.post_message(e.data.msgs[i],true);}
Ext.getCmp('jab_htmled').focus();}
if(e.active)
{var html=''
var user=''
var last=1;for(var i=0;i<e.active.results;i++)
{user=e.active.rows[i].user;if(e.active.rows[i].recent==0)
{if(last==1)
{last=0;html+="<br />Idlers:<br />"}
user="<i>"+user+"</i>";}
html+=user+"<br />";}
p.users.update(html);}},connect:function(poll)
{poll.baseParams.poll=0;}}});}},deactivate:function()
{},activate:function()
{if(typeof(Ext.Direct.getProvider('jabber_polling'))!='undefined')
{if(!(Ext.Direct.getProvider('jabber_polling').isConnected())&&!this.btnPause.pressed==true)
{Ext.Direct.getProvider('jabber_polling').connect();}}
Ext.get('jab_htmled').focus();},beforeclose:function()
{if(Ext.Direct.getProvider('jabber_polling').isConnected())
{Ext.Direct.getProvider('jabber_polling').disconnect();}
return true;}},wrapText:function(start,end)
{var sel=this.textarea.getSelection().text;var ret=start+sel+end;var val=this.textarea.getValue();if(Ext.isEmpty(sel)||true)
{this.textarea.insertAtCursor(ret);}
else
{var value=this.textarea.getValue();}}});}
win.show();}});;if(typeof window.modules=='undefined')
{window.modules={};}
window.modules.embeddedBrowser=Ext.extend(Ext.app.Module,{id:'embeddedBrowser',init:function()
{this.launcher={text:'~quant~ Forums',iconCls:'favicon-quant',handler:this.createWindow,scope:this,windowID:2}},createWindow:function()
{var desktop=this.app.getDesktop();var win=desktop.getWindow('embeddedBrowserWin');if(!win)
{var height=(Ext.lib.Dom.getViewHeight()-45);win=desktop.createWindow({id:'embeddedBrowserWin',title:'~quant~ Forums',width:800,height:height,x:5,y:5,iconCls:'favicon-quant',shim:false,animCollapse:false,constrainHeader:true,layout:'fit',tbar:[{xtype:'button',text:'Return to Forums',iconCls:'favicon-quant',handler:function(b)
{Ext.ComponentMgr.get('forumPanel').getFrame().setLocation('http://www.clan-quant.net/forums/index.php?rd=123425');}},{xtype:'button',ref:'../raptr_btn',text:'Join Raptr!',iconCls:'favicon-Raptr',disabled:false,handler:function()
{Ext.ComponentMgr.get('forumPanel').getFrame().setLocation('http://www.ratpr.com/');}},"->",{xtype:'tbtext',text:'Game Search',},{xtype:'textfield',emptyText:'Search by game',name:'gamesearchfield',id:'gamesearchfield',vtype:'an',listeners:{specialkey:function(field,e)
{if(e.getKey()==e.ENTER)
{searchGames(field.getValue());}}}}],items:[new Ext.TabPanel
({activeTab:0,id:'browserTab',defaults:{xtype:'iframepanel',hideMode:'nosize',autoScroll:true,cmargins:'0 1 1 1',frame:true,focusOnLoad:Ext.isIE,closable:true},listeners:{render:function(panel)
{var URL='http://www.clan-quant.net/forums/index.php?rd=1242325';panel.add
({closable:false,id:'forumPanel',defaultSrc:URL,title:'~quant~',loadMask:URL?{msg:'Loading... ',}:false,});}}})]});}
win.show();}});function searchGames(name)
{Ext.ComponentMgr.get('forumPanel').getFrame().setLocation('http://www.clan-quant.net/forums/search.php?keywords='+name.replace(" ","+")+'&terms=all&author=&sc=1&sf=all&sk=t&sd=d&sr=posts&st=0&ch=300&t=0&submit=Search');var URLS=[];URLS['GameFAQs']='http://www.gamefaqs.com/search/index.html?game='+name.replace(" ","+")+'&platform=0&s=s';URLS['VGChartz']='http://www.vgchartz.com/games/index.php?name='+name.replace(" ","+");URLS['GiantBomb']='http://www.giantbomb.com/search/?q='+name.replace(" ","+");URLS['GameSpot']='http://www.gamespot.com/search.html?qs='+name.replace(" ","+")+'#game';URLS['IGN']='http://search.ign.com/product?query='+name.replace(" ","+");var panel=Ext.ComponentMgr.get('browserTab');var id='';var comp='';var icon='';for(var i in URLS)
{if(i=='remove')
{continue;}
id='gameSearch'+i;comp=Ext.ComponentMgr.get(id);icon='favicon-'+i;if(typeof comp=='object')
{comp.getFrame().setLocation(URLS[i]);}
else
{panel.add
({id:id,defaultSrc:URLS[i],title:i,iconCls:icon,loadMask:URLS[i]?{msg:'Loading:... ',}:false,listeners:{documentloaded:function(p1)
{p1.iconCls=icon;}}});}}};if(typeof window.modules=='undefined')
{window.modules={};}
window.modules.googleChat=Ext.extend(Ext.app.Module,{id:'googleChat',init:function()
{this.launcher={text:'Google Chat',iconCls:'icon-googleChat',handler:this.createWindow,scope:this}},createWindow:function()
{var desktop=this.app.getDesktop();var win=desktop.getWindow('googleChatWin');if(!win)
{var width=240;var height=Ext.lib.Dom.getViewHeight()-30;var x=Ext.lib.Dom.getViewWidth()-width;var y=0;win=desktop.createWindow({id:'googleChatWin',title:'Google Chat',width:width,height:height,x:x,y:y,iconCls:'icon-googleChat',shim:true,animCollapse:false,autoScroll:true,constrainHeader:true,maximizable:false,layout:'fit',defaults:{xtype:'iframepanel',hideMode:'nosize',autoScroll:true,cmargins:'0 1 1 1',frame:true,focusOnLoad:true,closable:true},listeners:{render:function(panel)
{var URL='http://talkgadget.google.com/talkgadget/client?';panel.add
({header:false,defaultSrc:URL,iconCls:URL?'loading-indicator':null,loadMask:URL?{msg:'Loading: '+URL}:false,});}}});}
win.show();}});;if(typeof window.modules=='undefined')
{window.modules={};}
window.modules.knichel=Ext.extend(Ext.app.Module,{id:'knichel',init:function()
{this.launcher={text:'Server Variables',iconCls:'icon-serverVar',handler:this.createWindow,scope:this};},createWindow:function()
{var desktop=this.app.getDesktop();var debug_win=desktop.getWindow('knichelWin');if(!debug_win)
{var height=500;var width=600;var x=5;var y=5;var freightClasses=[50,55,60,65,70,77.5,85,92.5,100,110,125,150,175,200,250,300,400,500];var knichelWinRowCount=1;debug_win=desktop.createWindow({id:'knichelWin',title:'Knichel Logisitics Test App',width:width,height:height,x:x,y:y,animCollapse:false,border:false,buttonAlign:'center',constrainHeader:true,debug:false,frame:true,iconCls:'icon-serverVar',fieldData:{},modal:false,rowCount:0,sites:['aes','transtrade','eship','priority1'],sitePos:0,siteSimul:1,stat:{},freightClasses:freightClasses,layout:'fit',process:function(fieldData)
{var win=this;win.sitePos=0;window.stores.knichel.store.removeAll();win.siteSimul=fieldData.concurrent;if(!Ext.isArray(fieldData.site))
{fieldData.site=[fieldData.site];}
win.sites=fieldData.site;MyDesktop.getModule('knichelStatus').createWindow();win.stat=Ext.getCmp('knichelStatusWin');var offset=0;for(var y=0;y<(win.siteSimul<=win.sites.length?win.siteSimul:win.sites.length);y++)
{var task=new Ext.util.DelayedTask(function(win,fieldData)
{var i=win.sitePos;fieldData.site=win.sites[i];win.stat.barPanel[win.sites[i]].wait({text:'Contacting '+win.sites[i]});knichel.getData(fieldData,callbacks);win.sitePos+=1;},this,[win,fieldData]);task.delay(offset);offset+=3000;}},addRow:function()
{if(Ext.isDefined(Ext.getCmp('btnA'+this.rowCount)))
{Ext.getCmp('btnA'+this.rowCount).hide();}
if(Ext.isDefined(Ext.getCmp('btnB'+this.rowCount)))
{Ext.getCmp('btnB'+this.rowCount).hide();}
if(this.rowCount==4)
{return true;}
this.rowCount++;this.form.rowPanel.add({html:'Item '+this.rowCount,id:'label'+this.rowCount},{xtype:'textfield',id:'weight'+this.rowCount,fieldLabel:'Weight',name:'weight',value:1000,vtype:'numeric',width:75},{xtype:'combo',id:'class'+this.rowCount,fieldLabel:'Class',name:'class',store:freightClasses,triggerAction:'all',typeAhead:true,value:70,valuefield:'freightclass',width:50},{xtype:'button',id:'btnA'+this.rowCount,ref:'../btnAddRow',style:'margin-left: 5px',text:'&nbsp;&nbsp;+&nbsp;&nbsp;',handler:function(b)
{b.refOwner.refOwner.addRow();}},{xtype:'button',id:'btnB'+this.rowCount,ref:'../btnDelRow',style:'margin-left: 5px',text:'&nbsp;&nbsp;-&nbsp;&nbsp;',handler:function(b)
{b.refOwner.refOwner.delRow();}});if(this.rowCount==1)
{this.form.btnDelRow.hide();}
else if(this.rowCount==4)
{this.form.btnAddRow.hide();}
this.doLayout();},delRow:function()
{this.form.rowPanel.remove('label'+this.rowCount);this.form.rowPanel.remove('weight'+this.rowCount);this.form.rowPanel.remove('class'+this.rowCount);this.form.rowPanel.remove('btnA'+this.rowCount);this.form.rowPanel.remove('btnB'+this.rowCount);this.rowCount--;if(Ext.isDefined(Ext.getCmp('btnA'+this.rowCount)))
{Ext.getCmp('btnA'+this.rowCount).show();}
if(Ext.isDefined(Ext.getCmp('btnB'+this.rowCount))&&this.rowCount>1)
{Ext.getCmp('btnB'+this.rowCount).show();}
this.doLayout();},items:[{xtype:'form',autoScroll:true,border:false,ref:'form',defaults:{defaults:{allowBlank:true}},items:[{xtype:'fieldset',border:false,items:[{xtype:'textfield',allowBlank:false,fieldLabel:'Origin Zip',maxLength:6,name:'zipOrig',value:68116,vtype:'alphanum'},{xtype:'textfield',allowBlank:false,fieldLabel:'Destination Zip',maxLength:6,name:'zipDest',value:90210,vtype:'alphanum'},{xtype:'datefield',allowBlank:false,fieldLabel:'Ship Date',name:'date',value:new Date()}]},{xtype:'fieldset',border:false,ref:'rowPanel',defaults:{border:false,style:'margin-bottom: 3px;'},layout:{columns:5,type:'table'},items:[{html:'&nbsp;',width:105},{html:'<span style:"font-weight: bold;">Weight (lbs)</span>',width:100},{html:'Class',width:50},{html:'&nbsp;',colspan:2}]},{xtype:'fieldset',ref:'optionPanel',title:'Additional Options',width:350,layout:{type:'column'},defaults:{},items:[{xtype:'container',autoEl:'center',width:150,layout:'form',items:[{xtype:'displayfield',value:'Origin',},{xtype:'checkbox',fieldLabel:'Lift Gate',name:'liftgateP',},{xtype:'checkbox',fieldLabel:'Notify',name:'notifyP'},{xtype:'label',fieldLabel:'Inside Delivery'}]},{xtype:'container',autoEl:'center',columnWidth:1,layout:'form',defaults:{hideLabel:true},items:[{xtype:'displayfield',value:'Dest.'},{xtype:'checkbox',name:'liftgateD'},{xtype:'checkbox',name:'notifyD'},{xtype:'checkbox',name:'inside'}]}]},{xtype:'fieldset',collapsible:true,title:'Connection Options',width:350,defaults:{checked:true},items:[{xtype:'textfield',width:200,fieldLabel:'Concurrent Requests',name:'concurrent',value:2},{xtype:'checkboxgroup',columns:2,fieldLabel:'Enable Sites',defaults:{checked:'true',name:'site'},items:[{boxLabel:'AES Logistics',inputValue:'aes'},{boxLabel:'eShip+',inputValue:'eship'},{boxLabel:'Priority 1',inputValue:'priority1'},{boxLabel:'TransTrade',inputValue:'transtrade'}]}]}]}],buttons:[{text:'Scan',ref:'../btnScan',handler:function(b)
{var form=b.refOwner.form.getForm();if(form.isValid())
{var fieldData=form.getValues();fieldData.debug=b.refOwner.debug;b.refOwner.fieldData=fieldData;b.refOwner.process(fieldData);}}},new Ext.Button
({text:'Close',handler:function(b)
{b.findParentByType('window').close();}})],listeners:{afterrender:function(win)
{win.mask=new Ext.LoadMask(win.getEl(),{msg:"Contacting Logistics Providers"});win.addRow();},show:function(win)
{}},mask:Ext.emptyFn()});}
debug_win.show();}});window.modules.knichelDebug=Ext.extend(Ext.app.Module,{id:'knichelDebug',init:function()
{this.launcher={text:'Server Variables',iconCls:'icon-serverVar',handler:this.createWindow,scope:this};},createWindow:function()
{var desktop=this.app.getDesktop();var debug_win=desktop.getWindow('knichelDebugWin');if(!debug_win)
{var height=600;var width=800;var x=605;var y=5;debug_win=desktop.createWindow({id:'knichelDebugWin',title:'Knichel Debug Logisitics Test App',width:width,height:height,x:x,y:y,animCollapse:false,border:true,buttonAlign:'center',constrainHeader:true,iconCls:'icon-serverVar',modal:false,sites:['aes','eship','priority1','transtrade'],sitePos:0,defaults:{xtype:'panel',collapsible:true,flex:1,defaults:{flex:1,xtype:'textarea'},layout:{align:'stretch',type:'vbox'},},layout:{align:'stretch',type:'accordion'},tbar:[{ref:'../btnRefresh',text:'Refresh',handler:function(b)
{b.refOwner.fireEvent('show',b.refOwner);}}],items:[{collapsed:false,title:'Login Return',items:[{ref:'../panelLogin'}]},{collapsed:false,title:'Request Return',items:[{ref:'../panelRequest'}]},{collapsed:false,title:'Additional Return',items:[{ref:'../panelAdditional'}]},{collapsed:false,title:'Parsed Data',items:[{ref:'../panelParse'}]}],buttons:[new Ext.Button
({text:'Close',handler:function(b)
{b.findParentByType('window').close();}})],listeners:{afterrender:function(win)
{win.mask=new Ext.LoadMask(win.getEl(),{msg:"Contacting Logistics Providers"});},show:function(win)
{}},mask:Ext.emptyFn()});}
debug_win.show();}});window.modules.knichelResults=Ext.extend(Ext.app.Module,{id:'knichelResults',init:function()
{this.launcher={text:'Query Results',iconCls:'bogus',handler:this.createWindow,scope:this}},createWindow:function()
{var desktop=this.app.getDesktop();var win=desktop.getWindow('knichelResultsWin');if(!win)
{var height=300;var width=500;var x=(Ext.lib.Dom.getViewWidth()-width)/2;var y=125;height=(height>MyDesktop.desktop.getViewHeight()-y)?MyDesktop.desktop.getViewHeight()-(y+1):height;width=(width>Ext.lib.Dom.getViewWidth()-x)?Ext.lib.Dom.getViewWidth()-x:width;win=desktop.createWindow({id:'knichelResultsWin',title:'Query Results',height:height,width:width,x:x,y:y,animCollapse:true,border:true,closable:true,constrainHeader:true,iconCls:'bogus',layout:'fit',maximizable:true,minimizable:true,modal:false,items:[{xtype:'grid',autoExpandColumn:'carrier',flex:1,loadMask:true,ref:'grid',store:window.stores.knichel.store,stripeRows:true,cm:new Ext.grid.ColumnModel
({columns:[{id:'rateholder',dataIndex:'rateholder',header:'Rate Holder',sortable:true},{id:'carrier',dataIndex:'carrier',header:'Carrier',sortable:true},{id:'transit',dataIndex:'transit',header:'Transit',sortable:true},{id:'rate',dataIndex:'rate',header:'Rate',sortable:true}]})}]});}
win.show();}});window.modules.knichelStatus=Ext.extend(Ext.app.Module,{id:'knichelStatus',init:function()
{this.launcher={text:'Connection Status',iconCls:'bogus',handler:this.createWindow,scope:this}},createWindow:function()
{var desktop=this.app.getDesktop();var win=desktop.getWindow('knichelStatusWin');if(!win)
{var height=120;var width=200;var x=(Ext.lib.Dom.getViewWidth()-width)/2;var y=5;height=(height>Ext.lib.Dom.getViewHeight()-35)?Ext.lib.Dom.getViewHeight()-35:height;width=(width>Ext.lib.Dom.getViewWidth()-35)?Ext.lib.Dom.getViewWidth()-35:width;win=desktop.createWindow({id:'knichelStatusWin',title:'Connection Status',height:height,width:width,x:x,y:y,animCollapse:true,border:true,closable:false,constrainHeader:true,iconCls:'bogus',layout:'fit',maximizable:false,minimizable:false,modal:false,items:[{xtype:'panel',ref:'barPanel',defaults:{xtype:'progress'},}],listeners:{beforerender:function(p)
{var main=Ext.getCmp('knichelWin');if(!Ext.isDefined(main))
{this.close();}
else
{for(var i=0;i<main.sites.length;i++)
{this.barPanel.add({ref:main.sites[i],text:main.sites[i]});}
this.doLayout();}}}});}
win.show();}});;if(typeof window.modules=='undefined')
{window.modules={};}
window.modules.login=Ext.extend(Ext.app.Module,{id:'login',init:function()
{this.launcher={text:'Login',iconCls:'bogus',handler:this.createWindow,scope:this}},createWindow:function()
{var desktop=this.app.getDesktop();var loginWin=desktop.getWindow('loginWin');if(!loginWin)
{var height=135;var width=300;var x=(Ext.lib.Dom.getViewWidth()-width)/2;var y=(Ext.lib.Dom.getViewHeight()-height)/2;loginWin=desktop.createWindow({id:'loginWin',title:'~quant~ Login',width:width,height:height,x:x,y:y,iconCls:'bogus',border:true,animCollapse:false,constrainHeader:true,minimizable:false,maximizable:false,closable:false,layout:'fit',modal:true,items:[{xtype:'fieldset',defaults:{vtype:'an',allowBlank:false},items:[new Ext.form.TextField
({fieldLabel:'Username',name:'Username1',id:'username',maxLength:30,ref:'../user',value:Ext.util.Cookies.get('username'),vtype:'alphanum',allowBlank:false}),new Ext.form.TextField
({name:'password1',inputType:'password',fieldLabel:'Password',disabled:true})]}],buttonAlign:'center',buttons:[new Ext.Button
({ref:'../btnLogin',text:'Log In',handler:function()
{this.findParentBy(function(comp,button)
{if(comp.id=='loginWin')
{field=comp.findById('username');}});if(field.isValid())
{v=field.getValue();if(typeof(v)!=='undefined')
{var now=new Date();var exdate=new Date(now.getTime()+1000*60*60*24*7);Ext.util.Cookies.set('username',v,exdate);MyDesktop.getDesktop().taskbar.startMenu.title=v;window.userVariables['name']=v;this.findParentByType('window').close();MyDesktop.getDesktop().taskbar.startButton.enable();MyDesktop.initAutorun(MyDesktop.autorun);}}}})],listeners:{render:function(p)
{MyDesktop.getDesktop().taskbar.startButton.disable();},show:function(p)
{if(!Ext.isEmpty(Ext.util.Cookies.get('username')))
{p.btnLogin.handler();}}}});}
loginWin.show();}});;if(typeof window.modules=='undefined')
{window.modules={};}
window.modules.recipePlanner=Ext.extend(Ext.app.Module,{id:'recipePlanner',title:'&alpha; Recipe Stuff',init:function()
{this.launcher={text:this.title,iconCls:'bogus',handler:this.createWindow,scope:this}},createWindow:function()
{var desktop=this.app.getDesktop();var win=desktop.getWindow('recipePlannerWin');if(!win)
{var height=(Ext.lib.Dom.getViewHeight()-45);win=desktop.createWindow({id:'recipePlannerWin',title:this.title,height:height,x:5,y:5,shim:false,animCollapse:false,constrainHeader:true,layout:'fit',items:[{xtype:'panel',layout:'column',items:[{xtype:'combo',mode:'local',store:window.stores.recipe_foodGroup.store,valueField:'FdGrp_Cd',displayField:'FdGrp_Desc',typeAhead:true,triggerAction:'all',lazyRender:false,emptyText:'Choose an Ingredient Category',width:235,listeners:{select:function(combo,record,index)
{window.stores.recipe_foodDescription.store.load
({params:{0:record.data.FdGrp_Cd,1:''}});Ext.getCmp('debug').focus();}}},{xtype:'combo',id:'debug',mode:'local',store:window.stores.recipe_foodDescription.store,valueField:'NDB_No',displayField:'Long_Desc',typeAhead:true,enableKeyEvents:true,selectOnFocus:true,triggerAction:'all',lazyRender:false,emptyText:'Add an Ingredient',listeners:{beforequery:function()
{console.info(arguments);}}}]}],listeners:{render:function()
{window.stores.recipe_foodGroup.store.load({params:'fel'});}}});}
win.show();}});;if(typeof window.modules=='undefined')
{window.modules={};}
window.modules.memberList=Ext.extend(Ext.app.Module,{id:'memberList',init:function()
{this.launcher={text:'~quant~ Members',iconCls:'icon-user',handler:this.createWindow,scope:this,windowID:1}},createWindow:function()
{var desktop=this.app.getDesktop();var win=desktop.getWindow('memberListWin');if(!win)
{win=desktop.createWindow
({id:'memberListWin',title:'~quant~ Membership',width:740,height:480,iconCls:'icon-user',shim:false,animCollapse:false,constrainHeader:true,layout:'fit',items:new Ext.grid.GridPanel
({waitMsg:'loading',loadMask:true,border:false,store:members_store,cm:members_cm,view:new Ext.grid.GridView
({emptyText:'Memberlist Loading',deferEmptyText:false}),viewConfig:{forceFit:true},tbar:[{text:'Add Something',tooltip:'Add a new row',iconCls:'add'},'-',{text:'Options',tooltip:'Blah blah blah blaht',iconCls:'option'},'-',{text:'Remove Something',tooltip:'Remove the selected item',iconCls:'remove'}],listeners:{render:function(grid)
{grid.getStore().load();}}})});}
win.show();}});;if(typeof window.modules=='undefined')
{window.modules={};}
window.modules.worldMaps=Ext.extend(Ext.app.Module,{id:'worldMaps',init:function()
{this.launcher={text:'~quant~ Minecraft Maps',iconCls:'favicon-minecraft',handler:this.createWindow,scope:this}},createWindow:function()
{var desktop=this.app.getDesktop();var win=desktop.getWindow('worldMapsWin');if(!win)
{var height=768;var width=1024;var x=(Ext.lib.Dom.getViewWidth()-width)/2;var y=(Ext.lib.Dom.getViewHeight()-height)/2;height=(height>Ext.lib.Dom.getViewHeight()-35)?Ext.lib.Dom.getViewHeight()-35:height;width=(width>Ext.lib.Dom.getViewWidth()-35)?Ext.lib.Dom.getViewWidth()-35:width;win=desktop.createWindow({id:'worldMapsWin',title:'~quant~ Minecraft Map',height:height,width:width,x:x,y:y,animCollapse:true,border:true,closable:true,constrainHeader:true,iconCls:'favicon-minecraft',layout:'fit',maximizable:true,minimizable:true,modal:false,items:[{xtype:'iframepanel',activeTab:0,autoScroll:true,hideMode:'nosize',cmargins:'0 1 1 1',frame:false,focusOnLoad:Ext.isIE,header:false,defaultSrc:"/maps/map.html"}]});}
win.show();}});;if(typeof window.modules=='undefined')
{window.modules={};}
window.modules.BogusModule=Ext.extend(Ext.app.Module,{init:function(){this.launcher={text:'Bogus Window',iconCls:'bogus',handler:this.createWindow,scope:this,windowId:12345}},createWindow:function(src){var desktop=this.app.getDesktop();var win=desktop.getWindow('bogus'+src.windowId);if(!win){win=desktop.createWindow({id:'bogus'+src.windowId,title:src.text,width:640,height:480,html:'<p>Default Window</p>',iconCls:'bogus',shim:false,animCollapse:false,constrainHeader:true});}
win.show();}});window.modules.debugServer=Ext.extend(Ext.app.Module,{id:'debugServer',init:function()
{this.launcher={text:'Server Variables',iconCls:'icon-serverVar',handler:this.createWindow,scope:this};},createWindow:function()
{var desktop=this.app.getDesktop();var debug_win=desktop.getWindow('serverDebugWin');if(!debug_win)
{var height=600;var width=800;var x=5;var y=5;debug_win=desktop.createWindow({id:'serverDebugWin',title:'Debug Information',width:width,height:height,x:x,y:y,iconCls:'icon-serverVar',border:true,animCollapse:false,constrainHeader:true,modal:true,tbar:[{text:'refresh',handler:function(b)
{miscFunctions.test('no one is home',callbacks);}}],items:[{xtype:'panel',height:535,listeners:{afterrender:function(p)
{var mask=new Ext.LoadMask(p.getEl(),{msg:"Retrieving Server Variables",removeMask:true});mask.show();}}}],buttonAlign:'center',buttons:[new Ext.Button
({text:'Close',handler:function(b)
{b.findParentByType('window').close();}})],listeners:{show:function(win)
{miscFunctions.test('no one is home',callbacks);}}});}
debug_win.show();}});;if(typeof window.modules=='undefined')
{window.modules={};}
window.modules.starocean4=Ext.extend(Ext.app.Module,{id:'starocean4',init:function()
{this.launcher={text:'starocean4',iconCls:'icon-starocean4',handler:this.createWindow,scope:this}},createWindow:function()
{var desktop=this.app.getDesktop();var win=desktop.getWindow('starocean4Win');if(!win)
{var height=700;var width=700;var x=(Ext.lib.Dom.getViewWidth()-width)/2;var y=(Ext.lib.Dom.getViewHeight()-height)/2;height=(height>Ext.lib.Dom.getViewHeight()-40)?Ext.lib.Dom.getViewHeight()-40:height;width=(width>Ext.lib.Dom.getViewWidth()-40)?Ext.lib.Dom.getViewWidth()-40:width;function addItemFormRow(i)
{var i=Ext.getCmp('newIngredientWin').i++;Ext.getCmp('itemlocationrowfieldset').add({xtype:'panel',id:"row"+i,border:false,layout:'column',ref:"../row"+i,defaults:{border:false,hideLabel:true,style:{padding:'0 10px 0 0'}},items:[{xtype:'fieldset',items:[{xtype:'combo',allowBlank:true,displayField:'type',emptyText:'Type',forceSelection:true,id:'locationType'+i,hideLabel:true,mode:'local',store:window.stores.starocean4_itemLocationType.store,triggerAction:'all',valueField:'ID',width:75,listeners:{select:function(combo,record,index)
{var row=Ext.getCmp("row"+i);row.remove('masterPlanet'+i);row.remove('masterLocation'+i);row.remove('masterStore'+i);row.remove('masterQuest'+i);row.remove('masterOther'+i);row.remove('newRow'+i);console.debug(record);if(record.id==1||record.id==2||record.id==3)
{row.add({xtype:'fieldset',id:'masterPlanet'+i,hideLabel:true,items:[{xtype:'combo',allowBlank:true,autoDestroy:false,displayField:'planet',emptyText:'Planet',forceSelection:false,id:'planet'+i,hideLabel:true,mode:'local',store:window.stores.starocean4_planets.store,triggerAction:'all',valueField:'ID',width:100}]});}
if(record.id==1)
{row.add({xtype:'fieldset',id:'masterStore'+i,hideLabel:true,items:[{xtype:'combo',allowBlank:true,autoDestroy:false,displayField:'store',emptyText:'Shop',forceSelection:false,id:'location'+i,hideLabel:true,mode:'local',store:window.stores.starocean4_stores.store,triggerAction:'all',valueField:'ID',width:175}]});}
else if(record.id==2||record.id==3)
{row.add({xtype:'fieldset',id:'masterLocation'+i,hideLabel:true,items:[{xtype:'combo',allowBlank:true,autoDestroy:false,displayField:'location',emptyText:'Location',forceSelection:false,id:'location'+i,hideLabel:true,mode:'local',store:window.stores.starocean4_locations.store,triggerAction:'all',valueField:'ID',width:175}]});}
else if(record.id==4)
{row.add({xtype:'fieldset',id:'masterMonster'+i,hideLabel:true,items:[{xtype:'combo',allowBlank:true,autoDestroy:false,displayField:'monster',emptyText:'Monster',forceSelection:false,id:'location'+i,hideLabel:true,mode:'local',store:window.stores.starocean4_bestiary.store,triggerAction:'all',valueField:'ID',width:285}]});}
else if(record.id==5)
{row.add({xtype:'fieldset',id:'masterQuest'+i,hideLabel:true,items:[{xtype:'combo',allowBlank:true,autoDestroy:false,displayField:'quest',emptyText:'Quest',forceSelection:false,id:'location'+i,hideLabel:true,mode:'local',store:window.stores.starocean4_bestiary.store,triggerAction:'all',valueField:'ID',width:285}]});}
else if(record.id==6)
{row.add({xtype:'fieldset',id:'masterOther'+i,hideLabel:true,items:[{xtype:'textfield',allowBlank:true,autoDestroy:false,emptyText:'Other Info',hideLabel:true,id:'location'+i,width:285}]});}
row.add({xtype:'button',id:'newRow'+i,autoDestroy:false,height:16,width:16,ref:'../plus',style:{padding:'0 0 0 0'},text:'&nbsp;+&nbsp;',handler:function(btn)
{addItemFormRow();}});Ext.getCmp('newIngredientWin').doLayout();}}}]}]});Ext.getCmp('newIngredientWin').setHeight(Ext.getCmp('newIngredientWin').getHeight()+25);}
win=desktop.createWindow({id:'starocean4Win',title:'Star Ocean IV: The Last Hope',height:height,width:width,x:x,y:y,animCollapse:true,border:true,closable:true,constrainHeader:true,iconCls:'icon-starocean4',layout:'fit',maximizable:true,minimizable:true,modal:false,items:[{xtype:'tabpanel',activeItem:0,items:[{title:'Battle Trophies'},{title:'Ingredient List',layout:{type:'vbox',align:'stretch',pack:'start'},items:[{frame:true,height:30,html:'Ingredient Location Data c/o \'Sakura Yule & Signum7\' @gamefaqs <a href="http://www.gamefaqs.com/ps3/939441-star-ocean-the-last-hope-international/faqs/57159" target="_blank">I.C. Ingredient FAQ v1.03</a>'},{xtype:'spacer',height:5,frame:true},{xtype:'grid',id:'ingredientListGrid',autoExpandColumn:'locationCol',flex:1,loadMask:true,store:window.stores.itemLocation.store,stripeRows:true,cm:new Ext.grid.ColumnModel
({columns:[{header:'Item',dataIndex:'item',sortable:true,width:125},{header:'Type',dataIndex:'type',sortable:false,renderer:function(value,metadata,record,rowIndex,colIndex,store)
{var ret='';for(var i in record.data.locations)
{if(typeof record.data.locations[i].type=='string')
{ret+='<span style="width: 100px">'+record.data.locations[i].type+'</span><br />';}}
return ret;}},{header:'Location',id:'locationCol',dataIndex:'location',sortable:false,renderer:function(value,metadata,record,rowIndex,colIndex,store)
{var ret='';for(var i in record.data.locations)
{if(typeof record.data.locations[i].loc=='string')
{ret+='<span>'+record.data.locations[i].loc+'</span><br />';}}
return ret;}}]}),tbar:[{xtype:'textfield',enableKeyEvents:true,emptyText:'Search for an Ingredient',listeners:{keypress:function(field,e)
{window.stores.itemLocation.store.filterBy(function(r)
{if(field.getValue()==''||stripos(r.data.item,field.getValue())!==false)
{return true;}});}}},'->',{ref:'../createBtn',disabled:false,iconCls:'icon-add',text:'Add',handler:function(b)
{var i=0;var win=new Ext.Window
({closable:false,i:i,id:'newIngredientWin',layout:'form',modal:true,padding:10,title:'Add an ingredient to the database',width:525,buttons:[{text:'Submit',ref:'../submit',handler:function(btn1)
{var i=Ext.getCmp('newIngredientWin').i;var fields={};fields.ingredient=Ext.getCmp('ingredient').getValue();fields.locations={};for(var y=0;y<i;y++)
{var str='locationType'+y;var str1='location'+y;var str2='planet'+y;fields.locations[y]={typeID:Ext.isDefined(Ext.getCmp(str))?Ext.getCmp(str).getValue():'',locationID:Ext.isDefined(Ext.getCmp(str1))?Ext.getCmp(str1).getValue():'',planetID:Ext.isDefined(Ext.getCmp(str2))?Ext.getCmp(str2).getValue():''}}
SO4Functions.ingredientAdd(fields,callbacks);}},{text:'Cancel',ref:'../cancel',handler:function(btn1)
{btn1.refOwner.close();}}],items:[{xtype:'textfield',id:'ingredient',allowBlank:false,fieldLabel:'Ingredient',vtype:'an',width:325},{xtype:'fieldset',id:'itemlocationrowfieldset',title:'Add Item Locations',width:430}],listeners:{show:function(p)
{addItemFormRow();p.setHeight(200);}}});win.show();},},{ref:'../deleteBtn',disabled:false,iconCls:'icon-delete',text:'Delete',handler:function(b)
{},}]}],listeners:{activate:function(p)
{window.stores.itemLocation.store.load({params:'123'});}}},{title:'Recipe List',layout:{align:'stretch',type:'vbox'},items:[{frame:true,height:30,html:'Recipe Data c/o \'Sister\' @gamefaqs <a href="http://www.gamefaqs.com/ps3/939441-star-ocean-the-last-hope-international/faqs/56846" target="_blank">Item Creation FAQ v1.2</a>'},{xtype:'spacer',height:5},{xtype:'grid',flex:1,loadMask:true,store:window.stores.starocean4_recipeList.store,cm:new Ext.grid.ColumnModel
({columns:[{header:'Category',dataIndex:'categoryID',sortable:true},{header:'S.lvl',dataIndex:'skilllevel',sortable:true},{header:'Item',dataIndex:'createID',sortable:true}]})}],listeners:{activate:function(p)
{window.stores.starocean4_recipeList.store.load({params:'high'});}}},{title:'Quest List'}]}],listeners:{render:function(win)
{window.stores.starocean4_bestiary.store.load({params:'game_starocean4_bestiary'});window.stores.starocean4_itemLocationType.store.load({params:'game_starocean4_itemLocationType'});window.stores.starocean4_locations.store.load({params:'game_starocean4_locations'});window.stores.starocean4_planets.store.load({params:'game_starocean4_planets'});window.stores.starocean4_quests.store.load({params:'game_starocean4_quests'});window.stores.starocean4_stores.store.load({params:'game_starocean4_stores'});}}});}
win.show();}});;if(typeof window.modules=='undefined')
{window.modules={};}
window.modules.ventStatus=Ext.extend(Ext.app.Module,{id:'ventStatus',init:function()
{this.launcher={text:'Venrilo Status',iconCls:'icon-ventrilo',handler:this.createWindow,scope:this,windowID:3}},createWindow:function()
{var desktop=this.app.getDesktop();var win=desktop.getWindow('ventWin');if(!win)
{var width=195;var height=130;var x=0;var y=Ext.lib.Dom.getViewHeight()-height-30;win=desktop.createWindow({id:'ventWin',title:'~quant~ Ventrilo',width:width,height:height,x:x,y:y,iconCls:'icon-ventrilo',shim:false,animCollapse:false,constrainHeader:true,header:false,layout:'fit',resizable:false,maximizable:false,autoScroll:false,items:[{xtype:'iframepanel',hideMode:'nosize',autoScroll:false,header:false,focusOnLoad:false,closable:true,shim:false,frame:true,autoHeight:true,autoWidth:true,resizable:false,autoLoad:{url:'pages/ajax/ventStatus.php',scripts:true}}],listeners:{}});}
win.show();}});
