/*
 * Ext JS Library 2.0 RC 1
 * Copyright(c) 2006-2007, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */


if(agregator==null)
{var agregator=new Object();}
agregator.labels={feeds:'Feed-uri',add:'Adauga',addFeed:'Adauga feed',newTab:'Tab nou',openNewTab:'Deschide tab nou',open:'Deschide',news:'Stiri',cancel:'Anulare',edit:'Editeaza',validatingFeed:'Se valideaza feed-ul...',validatingFeedErrors:'Ne pare rau, sunt probleme cu validarea feed-ului. Incercati mai tarziu, daca problemele persista ne puteti contacta la contact@agregator.ro.',inputFeed:'Introduceti adresa feed-ului',defaultFeeds:[['http://www.groparu.ro/?feed=rss2','Groparu'],['http://metalfan.ro/rss/news.xml','Metalfan'],['http://www.gsp.ro/usr/feed/index20.xml','Gazeta Sporturilor'],['http://www.hotnews.ro/rss','Hotnews']],inputExample:'http://nume-site-exemplu.ro/blog/feed',loading:'Se incarca ...',search:'Cauta ...',eokTitle:'eOK.ro - Top saptamanal',stocksCompany:'Companie',stocksPrice:'Pret',stocksPercent:'% Variatie',stocksData:'Data',stocksDelete:'Sterge',stocksDeleteCompany:'Sterge companie',stocksAddCompany:'Adauga companie',stocksTitle:'Actiuni BVB Regular',weatherTitle:'Vremea in Romania',weatherSelect:'Selectati localitatea:',ratesTitle:'Convertor valutar',ratesText:'Cursul valutar este preluat de la <a target="_blank" href="http://www.bnr.ro/Cursul-de-schimb-524.aspx">BNR</a> pentru data de: ',tvTitle:'Programe TV',tvNow:'Acum',tvNext:'Urmeaza',tvPrograms:'Programe',tvFilter:'Filtru:',tvChannels:'Canale:',mediaTitle:'Muzica - Imeem.com',mediaMusic:'Muzica',mediaVideo:'Video',mediaSearch:'Cauta',mediaTrackTitle:'Titlu',mediaArtist:'Artist',mediaDuration:'Durata',zelistTitle:'Ze bestest',zelistBlogs:'pe bloguri',zelistPress:'in presa',imagesTitle:'Imagini',imagesInteresting:'interesante',imagesGeo:'din',photoTitle:'Badorgood.com',radioTitle:'Radio Guerrilla',topTwitterTitle:'Top hashtag-uri in Romania / 6 ore',topTwitter24:'La 6 ore',topTwitterChart:'Grafic',twitterSearchTitle:'Cauta pe Twitter',menuTree:[{text:'Widget-uri',cls:'feeds-node',expanded:true,children:[{type:'widget',name:'Zelist',text:'Zelist.ro',icon:'http://www.zelist.ro/favicon.ico',leaf:true,cls:'feed'},{type:'widget',name:'TopTwitter',text:'Top Twitter',icon:'http://assets1.twitter.com/images/favicon.ico',leaf:true,cls:'feed'},{type:'widget',name:'Photo',text:'Badorgood',icon:'/public/images/photo-icon.png',leaf:true,cls:'feed'},{type:'widget',name:'SearchTwitter',text:'Cauta pe Twitter',icon:'http://assets1.twitter.com/images/favicon.ico',leaf:true,cls:'feed'},{type:'widget',name:'TV',text:'Programe TV',icon:'http://www.femei-moderne.ro/favicon.ico',leaf:true,cls:'feed'},{type:'widget',name:'Rates',text:'Convertor valutar',icon:'/public/images/money_dollar.png',leaf:true,cls:'feed'},{type:'widget',name:'Weather',text:'Vremea in Romania',icon:'/public/images/weather_cloudy.png',leaf:true,cls:'feed'}]},{text:'Stiri',cls:'feeds-node',expanded:false,children:[{url:'http://www.hotnews.ro/rss',text:'Hotnews.ro',icon:"http://hotnews.ro/favicon.ico",leaf:true,cls:'feed'},{url:'http://cotidianul.ro/rssfeed/ToateStirile.xml',text:'Cotidianul',icon:"http://cotidianul.ro/favicon.ico",leaf:true,cls:'feed'},{url:'http://realitatea.net/feed/stiri.xml',text:'Realitatea',icon:"http://realitatea.net/favicon.ico",leaf:true,cls:'feed'},{url:'http://www.jurnalul.ro/rss',text:'Jurnalul National',icon:"http://jurnalul.ro/favicon.ico",leaf:true,cls:'feed'},{url:'http://www.evz.ro/xml/rss',text:'Evenimentul Zilei',icon:"http://www.evz.ro/images/favicon.ico",leaf:true,cls:'feed'},{url:'http://www.gandul.info/rss-stiri-prima-pagina.xml',text:'Gandul',icon:"http://gandul.info/favicon.ico",leaf:true,cls:'feed'},{url:'http://www.adevarul.ro/rss/latest',text:'Adevarul',icon:"http://www.adevarul.ro/favicon.ico",leaf:true,cls:'feed'},{url:'http://www.cancan.ro/rss.xml',text:'Cancan',icon:"http://www.cancan.ro/favicon.ico",leaf:true,cls:'feed'},{url:'http://www.libertatea.ro/rss/index.xml',text:'Libertatea',iconCls:'feed-icon',leaf:true,cls:'feed'},{url:'http://www.konkurs.ro/feed',text:'Konkurs.ro',icon:'http://www.konkurs.ro/favicon.ico',leaf:true,cls:'feed'}]},{text:'Sport',cls:'feeds-node',expanded:false,children:[{url:'http://www.gsp.ro/usr/feed/index20.xml',text:'Gazeta Sporturilor',icon:"http://www.gsp.ro/favicon.ico",leaf:true,cls:'feed'},{url:'http://www.prosport.ro/rss.xml',text:'ProSport',icon:"http://www.prosport.ro/favicon.ico",leaf:true,cls:'feed'},{url:'http://www.onlinesport.ro/stiri/rss/?feed=10',text:'Onlinesport.ro',icon:"http://www.onlinesport.ro/favicon.ico",leaf:true,cls:'feed'},{url:'http://www.sport.ro/rss',text:'Sport.ro',icon:'http://d1.a4w.ro/sport/design/images/favicon.gif',leaf:true,cls:'feed'}]},{text:'Muzica',cls:'feeds-node',expanded:false,children:[{url:'http://www.metalfan.ro/rss/stiri-rock.xml',text:'Metalfan',iconCls:'feed-icon',leaf:true,cls:'feed'},{url:'http://www.mtv.ro/rss/stiri',text:'MTV.ro',icon:"http://www.mtv.ro/favicon.ico",leaf:true,cls:'feed'},{url:'http://feeds.feedburner.com/Stiri-METALHEAD-ro',text:'Metalhead',icon:"http://www.metalhead.ro/m.gif",leaf:true,cls:'feed'}]},{text:'Blog-uri',cls:'feeds-node',expanded:false,children:[{url:'http://www.dailycotcodac.ro/feed/',text:'DailyCotcodac',iconCls:'feed-icon',leaf:true,cls:'feed'},{url:'http://www.groparu.ro/?feed=rss2',text:'Groparu',icon:"http://www.groparu.ro/favicon.ico",leaf:true,cls:'feed'},{url:'http://cocalari.com/feed/rss/',text:'Cocalari',icon:"http://cocalari.com/favicon.ico",leaf:true,cls:'feed'},{url:'http://feeds.feedburner.com/BobbyVoicu_ro',text:'Bobby Voicu',icon:"http://www.bobbyvoicu.ro/favicon.ico",leaf:true,cls:'feed'},{url:'http://feeds.feedburner.com/blogspot/manafu',text:'Manafu',iconCls:'feed-icon',leaf:true,cls:'feed'},{url:'http://feeds.feedburner.com/bookblogro',text:'Bookblog',icon:"http://bookblog.ro/favicon.ico",leaf:true,cls:'feed'},{url:'http://www.zoso.ro/feed',text:'Zoso',icon:"http://www.zoso.ro/favicon.ico",leaf:true,cls:'feed'},{url:'http://deceblog.net/feed',text:'Deceblog',icon:"http://deceblog.net/favicon.ico",leaf:true,cls:'feed'},{url:'http://feeds.feedburner.com/visurat1',text:'Visurat',iconCls:'feed-icon',leaf:true,cls:'feed'},{url:'http://www.piticu.ro/feed',text:'Piticu',icon:'http://media.dorombach.ro/favicon.ico',leaf:true,cls:'feed'},{url:'http://subiectiv.ro/feed',text:'Subiectiv',icon:"http://subiectiv.ro/wp-content/themes/subiectiv2/images/favicon.ico",leaf:true,cls:'feed'},{url:'http://feeds2.feedburner.com/alanegru',text:'Cabral',icon:"http://www.cabral.ro/wp-content/themes/cabral_niu/favicon.ico",leaf:true,cls:'feed'},{url:'http://www.jeg.ro/feed',text:'JEG',iconCls:'feed-icon',leaf:true,cls:'feed'},{url:'http://www.tolo.ro/feed/',text:'Tolontan',icon:'http://www.tolo.ro/favicon.ico',leaf:true,cls:'feed'}]},{text:'Twitters',cls:'feeds-node',expanded:false,children:[{url:'http://twitter.com/statuses/user_timeline/45863.rss',text:'Alex Brie',icon:"http://assets1.twitter.com/images/favicon.ico",leaf:true,cls:'feed'},{url:'http://twitter.com/statuses/user_timeline/14111168.rss',text:'eCostin',icon:"http://assets1.twitter.com/images/favicon.ico",leaf:true,cls:'feed'},{url:'http://twitter.com/statuses/user_timeline/11953772.rss',text:'Bobby Voicu',icon:"http://assets1.twitter.com/images/favicon.ico",leaf:true,cls:'feed'},{url:'http://twitter.com/statuses/user_timeline/5675232.rss',text:'Manafu',icon:"http://assets1.twitter.com/images/favicon.ico",leaf:true,cls:'feed'},{url:'http://twitter.com/statuses/user_timeline/10521362.rss',text:'Piticu',icon:"http://assets1.twitter.com/images/favicon.ico",leaf:true,cls:'feed'},{url:'http://twitter.com/statuses/user_timeline/14094468.rss',text:'Alex Popescu',icon:"http://assets1.twitter.com/images/favicon.ico",leaf:true,cls:'feed'},{url:'http://twitter.com/statuses/user_timeline/11561322.rss',text:'Sergiu Biris',icon:"http://assets1.twitter.com/images/favicon.ico",leaf:true,cls:'feed'},{url:'http://twitter.com/statuses/user_timeline/14203676.rss',text:'Zoso',icon:"http://assets1.twitter.com/images/favicon.ico",leaf:true,cls:'feed'},{url:'http://twitter.com/statuses/user_timeline/4868721.rss',text:'Subiectiv',icon:"http://assets1.twitter.com/images/favicon.ico",leaf:true,cls:'feed'},{url:'http://twitter.com/statuses/user_timeline/14169216.rss',text:'Manac',icon:"http://assets1.twitter.com/images/favicon.ico",leaf:true,cls:'feed'},{url:'http://twitter.com/statuses/user_timeline/14108877.rss',text:'Lamaie',icon:"http://assets1.twitter.com/images/favicon.ico",leaf:true,cls:'feed'},{url:'http://twitter.com/statuses/user_timeline/10702902.rss',text:'Kleampa',icon:"http://assets1.twitter.com/images/favicon.ico",leaf:true,cls:'feed'},{url:'http://twitter.com/statuses/user_timeline/11746402.rss',text:'Razvan Antonescu',icon:"http://assets1.twitter.com/images/favicon.ico",leaf:true,cls:'feed'}]},{text:'Tehnologie',cls:'feeds-node',expanded:false,children:[{url:'http://www.pcmhz.com/?format=feed&type=rss ',text:'PCMHZ',icon:'http://www.pcmhz.com/templates/ja_purity_ii/favicon.ico',leaf:true,cls:'feed'},{url:'http://feeds2.feedburner.com/Go4itro-Stiri',text:'Go4it.ro',icon:"http://www.go4it.ro/favicon.ico",leaf:true,cls:'feed'},{url:'http://www.chip.ro/index.php?option=com_ninjarsssyndicator&feed_id=9&format=raw',text:'CHIP.RO',icon:"http://www.chip.ro/favicon.ico",leaf:true,cls:'feed'},{url:'http://www.hit.ro/rss/',text:'Hit',icon:"http://www.hit.ro/favicon.ico",leaf:true,cls:'feed'},{url:'http://www.agora.ro/rss/agoranews.xml',text:'Agora',icon:"http://www.agora.ro/favicon.ico",leaf:true,cls:'feed'}]},{text:'Economie',cls:'feeds-node',expanded:false,children:[{url:'http://www.money.ro/rss',text:'Money',icon:"http://www.money.ro/favicon.ico",leaf:true,cls:'feed'},{url:'http://www.dailybusiness.ro/rss.xml',text:'DailyBussiness.ro',iconCls:'feed-icon',leaf:true,cls:'feed'},{url:'http://www.businessmagazin.ro/rss-feed.xml',text:'Business Magazin',iconCls:'feed-icon',leaf:true,cls:'feed'},{url:'http://www.zf.ro/rss.xml',text:'Ziarul Financiar',iconCls:'feed-icon',leaf:true,cls:'feed'},{url:'http://www.bvb.ro/Rss/StiriBVB.ashx',text:'Bursa de Valori Bucuresti',icon:"http://www.bvb.ro/favicon.ico",leaf:true,cls:'feed'},{url:'http://bloombiz.ro/assets/rss/rss.xml',text:'Bloombiz',icon:"http://www.bloombiz.ro/favicon.ico",leaf:true,cls:'feed'},{url:'http://img.wall-street.ro/rssfeeds/wall-street.xml',text:'Wall-Street.ro',icon:"http://www.wall-street.ro/favicon.ico",leaf:true,cls:'feed'},{url:'http://www.bursa.ro/on-line/_rss/?t=tz',text:'Bursa',iconCls:'feed-icon',leaf:true,cls:'feed'},{url:'http://www.capital.ro/usr/rss/index20.xml',text:'Capital',icon:"http://www.capital.ro/favicon.ico",leaf:true,cls:'feed'}]},{text:'Fete',cls:'feeds-node',expanded:false,children:[{url:'http://ele.ro/rss_noutati',text:'Ele.ro',icon:"http://www.ele.ro/favicon.ico",leaf:true,cls:'feed'},{url:'http://www.femei-moderne.ro/feed-femei-moderne',text:'Femei-Moderne.ro',icon:"http://www.femei-moderne.ro/favicon.ico",leaf:true,cls:'feed'},{url:'http://www.egirl.ro/data/stiri.rss.xml',text:'EGirl.ro',icon:"http://www.egirl.ro/favicon.ico",leaf:true,cls:'feed'},{url:'http://www.121.ro/rss/rss.php?id_feed=1',text:'121.ro',icon:"http://www.121.ro/favicon.ico",leaf:true,cls:'feed'},{url:'http://www.stilfeminin.ro/index.php?option=com_rd_rss&id=1',text:'Stilfeminin.ro',icon:"http://www.stilfeminin.ro/favicon.ico",leaf:true,cls:'feed'}]}]};

if(agregator==null)
{var agregator=new Object();}
agregator.companies=[{s:"ABR",n:"ABROM S.A."},{s:"ARS",n:"AEROSTAR S.A."},{s:"AER",n:"AEROTEH S.A."},{s:"ASA",n:"AGRAS VIENNA INSURANCE GROUP S.A."},{s:"ALB",n:"ALBAPAM S.A."},{s:"ALR",n:"ALRO S.A."},{s:"ALT",n:"ALTUR S.A."},{s:"AMC",n:"AMCO S.A."},{s:"AMO",n:"AMONIL S.A."},{s:"AMY",n:"AMYLON S.A."},{s:"ATB",n:"ANTIBIOTICE S.A."},{s:"APS",n:"APSA S.A."},{s:"ARM",n:"ARMATURA S.A."},{s:"AUR",n:"AURORA S.A."},{s:"AZO",n:"AZOMURES S.A."},{s:"BCC",n:"BANCA COMERCIALA CARPATICA S.A."},{s:"TLV",n:"BANCA TRANSILVANIA S.A."},{s:"UPS",n:"GHCL UPSOM ROMANIA S.A."},{s:"BRM",n:"BERMAS S.A."},{s:"BIO",n:"BIOFARM S.A."},{s:"BRD",n:"BRD - GROUPE SOCIETE GENERALE S.A."},{s:"TEL",n:"C.N.T.E.E. TRANSELECTRICA"},{s:"CRB",n:"CARBID-FOX S.A."},{s:"CBC",n:"CARBOCHIM S.A."},{s:"CER",n:"CERCON ARIESUL S.A."},{s:"CPR",n:"CHIMOPAR S.A. BUCURESTI"},{s:"CIP",n:"CIPROM S.A."},{s:"CMF",n:"COMELF S.A."},{s:"CMP",n:"COMPA S. A."},{s:"ENP",n:"COMPANIA ENERGOPETROL S.A."},{s:"DOR",n:"DOROBANTUL S.A."},{s:"ELJ",n:"ELECTROAPARATAJ S.A."},{s:"ELC",n:"ELECTROCERAMICA S.A."},{s:"EPT",n:"ELECTROPUTERE S.A."},{s:"EPN",n:"EMA PIATRA NEAMT S.A."},{s:"FAU",n:"FAUR S.A."},{s:"FEL",n:"FELEACUL S.A."},{s:"FLA",n:"FLAMINGO INTERNATIONAL SA"},{s:"FSP",n:"FORAJ SONDE PLOIESTI S.A."},{s:"GDP",n:"GRUPUL EDITORILOR SI DIFUZORILOR DE PRESA S.A."},{s:"ECT",n:"GRUPUL INDUSTRIAL ELECTROCONTACT S.A."},{s:"IMP",n:"IMPACT DEVELOPER & CONTRACTOR S.A."},{s:"EXC",n:"KANDIA - EXCELENT S.A."},{s:"MPN",n:"TITAN S.A."},{s:"MECF",n:"MECANICA CEAHLAU"},{s:"COS",n:"MECHEL TARGOVISTE S.A."},{s:"MEF",n:"MEFIN S.A."},{s:"MJM",n:"MJ MAILLIS ROMANIA S.A."},{s:"ALF",n:"MOBILA ALFA S.A."},{s:"MOL",n:"MOLDOMOBILA S.A."},{s:"MDS",n:"MOLDOSIN S.A."},{s:"NVL",n:"NAVOL S.A."},{s:"NCL",n:"NICOLINA S.A."},{s:"OIL",n:"OIL TERMINAL S.A."},{s:"OLT",n:"OLTCHIM S.A. RM. VALCEA"},{s:"PEI",n:"PETROLEXPORTIMPORT S.A."},{s:"PTS",n:"PETROLSUB S.A."},{s:"SNP",n:"PETROM S.A."},{s:"PCL",n:"POLICOLOR S.A."},{s:"PPL",n:"PRODPLAST S.A."},{s:"VAC",n:"PRODVINALCO S.A."},{s:"ASP",n:"RAFINARIA ASTRA ROMANA S.A."},{s:"RAF",n:"RAFO S.A."},{s:"RLS",n:"ROLAST S.A."},{s:"RRC",n:"ROMPETROL RAFINARE S.A."},{s:"PTR",n:"ROMPETROL WELL SERVICES S.A."},{s:"RBL",n:"RULMENTI S.A."},{s:"RBR",n:"RULMENTUL S.A."},{s:"BRK",n:"S.S.I.F. BROKER S.A."},{s:"SNC",n:"SANTIERUL NAVAL CONSTANTA S.A."},{s:"SNO",n:"SANTIERUL NAVAL ORSOVA S.A."},{s:"IDA",n:"SEPAROM S.A."},{s:"SIF1",n:"SIF BANAT CRISANA S.A."},{s:"SIF2",n:"SIF MOLDOVA S.A."},{s:"SIF4",n:"SIF MUNTENIA S.A."},{s:"SIF5",n:"SIF OLTENIA S.A."},{s:"SIF3",n:"SIF TRANSILVANIA S.A."},{s:"SLC",n:"SILCOTUB S.A."},{s:"STZ",n:"SINTEZA S.A."},{s:"SRT",n:"SIRETUL PASCANI S.A."},{s:"SOCP",n:"SOCEP S.A."},{s:"SOF",n:"SOFERT S.A."},{s:"SMS",n:"SOMES S.A."},{s:"STR",n:"STRATUSMOB S.A."},{s:"ART",n:"T.M.K. - ARTROM S.A."},{s:"TBM",n:"TURBOMECANICA S.A."},{s:"TUFE",n:"TURISM FELIX S.A. BAILE FELIX"},{s:"EFO",n:"TURISM HOTELURI RESTAURANTE MAREA NEAGRA S.A."},{s:"UAM",n:"UAMT S.A."},{s:"UCM",n:"UCM RESITA S.A."},{s:"UTN",n:"UTON S.A."},{s:"UZT",n:"UZTEL S.A."},{s:"UZC",n:"UZUC S.A."},{s:"APC",n:"VAE APCAROM S.A."},{s:"VEL",n:"SAPTE SPICE S.A."},{s:"VNC",n:"VRANCART SA"},{s:"SCD",n:"ZENTIVA S.A."},{s:"ZIM",n:"ZIMTUB S.A."},{s:"ALU",n:"ALUMIL ROM INDUSTRY S.A."},{s:"BCM",n:"CASA DE BUCOVINA-CLUB DE MUNTE"},{s:"COMI",n:"CONDMAG S.A."},{s:"DAFR",n:"DAFORA SA"},{s:"EBS",n:"Erste Bank der oesterreichischen Sparkassen AG"},{s:"ROCE",n:"ROMCARBON SA BUZAU "},{s:"TGN",n:"S.N.T.G.N. TRANSGAZ S.A."},{s:"VESY",n:"VES SA"}];

Ext.ux.Announcer=Ext.extend(Ext.ToolTip,{showDelay:500,hideDelay:200,dismissDelay:25000,mouseOffset:[0,0],trackMouse:false,cls:"announcer",constrainPosition:true,autoHide:false,closable:true,draggable:false,floating:{shadow:false,shim:true,useDisplay:true,constrain:true},initTarget:function(){this.targetXY=[0,0];},hide:function(){this.clearTimer('dismiss');this.clearTimers();this.lastActive=new Date();if(this.hidden!=true)
{this.getEl().slideOut('t',{duration:0.5,easing:'easeIn'});this.hidden=true;}},show:function(){this.showAt(0);},showAt:function(xy){this.lastActive=new Date();this.clearTimers();Ext.ux.Announcer.superclass.showAt.call(this,xy);this.getEl().slideIn('l',{duration:2,easing:'easeIn'});if(this.dismissDelay&&this.autoHide!==false){this.dismissTimer=this.hide.defer(this.dismissDelay,this);}},onShow:function(){Ext.ux.Announcer.superclass.onShow.call(this);},onHide:function(){Ext.ux.Announcer.superclass.onHide.call(this);}});

Ext.ux.Rates=function(data){var initData=(data==null)?{fromValue:"1",fromRate:"EUR",toRate:"RON"}:data;this.fromValue=initData.fromValue;this.fromRate=initData.fromRate;this.toRate=initData.toRate;this.addEvents({stateevent:true});this.store=new Ext.data.Store({proxy:new Ext.data.HttpProxy({url:'index/rates'}),reader:new Ext.data.JsonReader({root:"rates"},[{name:'currency',mapping:'currency'},{name:'value',mapping:'value'},{name:'countryFlag',mapping:'cf'}]),listeners:{"load":{fn:this.loadStore,scope:this}}});this.Id=Ext.id();Ext.ux.Rates.superclass.constructor.call(this,{widgetType:"rates",loadMask:{msg:agregator.labels.loading},autoWidth:true,width:350,height:110,border:false,style:'padding:25px 5px 0px 5px',items:[{layout:'column',border:false,defaults:{border:false},items:[{width:'70px',items:[{xtype:'textfield',width:65,id:this.Id+'txFrom',selectOnFocus:true,tabIndex:1}]},{width:'95px',items:[{xtype:'iconcombo',id:this.Id+'cmbFrom',tabIndex:2,fieldLabel:'IconCombo',width:75,valueField:'currency',displayField:'currency',iconClsField:'countryFlag',triggerAction:'all',forceSelection:true,selectOnFocus:true,typeAhead:true,editable:true,mode:'local',listeners:{'select':{fn:this.cmbHandler,scope:this}}}]},{width:'70px',items:[{xtype:'textfield',width:65,id:this.Id+'txTo',cls:'x-item-disabled',readOnly:true}]},{items:[{xtype:'iconcombo',id:this.Id+'cmbTo',tabIndex:3,fieldLabel:'IconCombo',width:75,valueField:'currency',displayField:'currency',iconClsField:'countryFlag',triggerAction:'all',forceSelection:true,selectOnFocus:true,typeAhead:true,editable:true,mode:'local',listeners:{'select':{fn:this.cmbHandler,scope:this}}}]}]},{xtype:'box',id:this.Id+'txSummary',style:'padding:25px 0 0 0 ',autoEl:{tag:'div'}}]});this.on('render',this.loadRates,this);this.on('afterlayout',this.afterLayoutHandler,this);}
Ext.extend(Ext.ux.Rates,Ext.Panel,{loadRates:function(){this.store.load();},loadStore:function(store,record,options)
{var cmbFrom=Ext.getCmp(this.Id+"cmbFrom");var cmbTo=Ext.getCmp(this.Id+"cmbTo");var txFrom=Ext.getCmp(this.Id+"txFrom");var txTo=Ext.getCmp(this.Id+"txTo");var txSummary=Ext.getCmp(this.Id+"txSummary");cmbFrom.store=store;cmbTo.store=store;if(this.fromRate!=null&&this.fromValue!=null&&this.toRate!=null)
{txFrom.setValue(this.fromValue);cmbTo.setValue(this.toRate);cmbFrom.setValue(this.fromRate);}
else
{txFrom.setValue(1);cmbTo.setValue('RON');cmbFrom.setValue('EUR');}
txFrom.focus();txFrom.getEl().on('keyup',this.txHandler,this);txTo.getEl().on('keyup',this.txHandler,this);this.date=Date.parseDate(store.reader.jsonData.date,'Y-m-d');txSummary.getEl().dom.innerHTML=agregator.labels.ratesText+this.date.format("j F Y");var titleIcon=this.ownerCt.header.child("img.x-panel-inline-icon");if(titleIcon!=null&&titleIcon.dom!=null)
{titleIcon.removeClass("feed-icon");titleIcon.dom.src="/public/images/money_dollar.png";}
this.ownerCt.setTitle(agregator.labels.ratesTitle+' (BNR - '+this.date.format("j M Y")+')');this.computeRates(txFrom,cmbFrom,txTo,cmbTo);},computeRates:function(txFrom,cmbFrom,txTo,cmbTo)
{this.store.clearFilter();var fromRecord=this.store.find("currency",cmbFrom.getValue());var fromRate=this.store.getAt(fromRecord).data.value;var toRecord=this.store.find("currency",cmbTo.getValue());var toRate=this.store.getAt(toRecord).data.value;var fromValue=txFrom.getValue()*1;if(isNaN(fromValue))
{return;}
var toValue=(fromValue*fromRate)/toRate;if(!isNaN(toValue))
{var m=(toValue<1)?Math.pow(10,6):Math.pow(10,4);m=(toValue>10)?Math.pow(10,2):m;txTo.setValue(parseInt(toValue*m,10)/m);this.frameAnimation(txTo.getEl(),"0000FF",1,{duration:1,block:true,stopFx:true});}},txHandler:function(ev,cmp)
{if(ev!=null&&(ev.isNavKeyPress()||ev.isSpecialKey()))
{return;}
var cmbFrom=Ext.getCmp(this.Id+"cmbFrom");var cmbTo=Ext.getCmp(this.Id+"cmbTo");var txFrom=Ext.getCmp(this.Id+"txFrom");var txTo=Ext.getCmp(this.Id+"txTo");this.fromValue=txFrom.getValue();this.computeRates(txFrom,cmbFrom,txTo,cmbTo);Ext.state.stateObserver.doSave();},cmbHandler:function(cmp,ev)
{var cmbFrom=Ext.getCmp(this.Id+"cmbFrom");var cmbTo=Ext.getCmp(this.Id+"cmbTo");var txFrom=Ext.getCmp(this.Id+"txFrom");var txTo=Ext.getCmp(this.Id+"txTo");this.fromRate=cmbFrom.getValue();this.toRate=cmbTo.getValue();this.computeRates(txFrom,cmbFrom,txTo,cmbTo);Ext.state.stateObserver.doSave();},afterLayoutHandler:function(cmp)
{this.un('afterlayout',this.afterLayoutHandler,this);this.loadMask=new Ext.LoadMask(this.container.dom.parentNode,{msg:agregator.labels.loading,store:this.store});this.loadMask.show();},addMyListeners:function()
{this.on('afterLayout',Ext.state.stateObserver.doSave,Ext.state.stateObserver);},refresh:function()
{this.store.load();},frameAnimation:function(myEl,color,count,o){var el=myEl.getFxEl();o=o||{};el.queueFx(o,function(){color=color||"#C3DAF9";if(color.length==6){color="#"+color;}
count=count||1;var duration=o.duration||1;myEl.show();var b=myEl.getBox();b.height-=2;b.width-=2;if(Ext.isIE)
{b.y+=1;}
else
{if(Ext.isSafari)
{b.x+=1;}}
var animFn=function(){var proxy=Ext.getBody().createChild({style:{visbility:"hidden",position:"absolute","z-index":"35000",border:"0px solid "+color}});proxy.animate({top:{from:b.y,to:b.y},left:{from:b.x,to:b.x},borderWidth:{from:0,to:2},opacity:{from:1,to:0},height:{from:b.height,to:b.height},width:{from:b.width,to:b.width}},duration,function(){proxy.remove();if(--count>0){animFn();}else{el.afterFx(o);}});};animFn.call(myEl);});return myEl;},getDefaultTitle:function()
{return agregator.labels.ratesTitle;},getCurrentState:function()
{return{fromValue:this.fromValue,fromRate:this.fromRate,toRate:this.toRate};},ToString:function()
{return"Rates";}});

Ext.ux.FeedTV=function(stores){this.stores=stores;Ext.ux.FeedTV.superclass.constructor.call(this,{draggable:false,collapsible:false,autoScroll:true,stateful:false,plain:true,width:100,height:100,maximizable:true,maximized:true});this.on("show",this.open,this);};Ext.extend(Ext.ux.FeedTV,Ext.Window,{open:function(){this.getEl().setStyle("z-index","9999999");this.tools.restore.hide();this.storeIndex=-1;this.feedIndex=-1;var task={run:this.iterateStores,scope:this,interval:15000}
Ext.TaskMgr.start(task);},iterateStores:function(){this.storeIndex++;if(this.storeIndex>=this.stores.length)
{this.storeIndex=0;this.feedIndex++;if(this.feedIndex>=20)
{this.feedIndex=0;}}
var record=this.stores[this.storeIndex].getAt(this.feedIndex);if(record!=null)
{this.showOneFeed(record);}
else
{this.iterateStores();}},showOneFeed:function(record)
{var xf=Ext.util.Format;var description=xf.ellipsis(xf.stripTags(record.data.description),200);var date="";if(record.data.pubDate!=null&&record.data.pubDate.getTime!=null&&!isNaN(record.data.pubDate))
{date="["+record.data.pubDate.format("j M H:i")+"] - ";}
var name=record.store.reader.jsonData.title;if(name.toLowerCase().indexOf("twitter")>-1)
{description="";}
var item=String.format("<a href='{0}' target='_blank'><h1 class='tv-feed-name'>{4}</h1><h2 class='tv-feed-title'>{2}{3}</h2><h2 class='tv-feed-description'>{1}</h2></a>",record.data.link,description,date,record.data.title,name);this.body.dom.innerHTML=item;}});

Ext.ux.IconCombo=Ext.extend(Ext.form.ComboBox,{initComponent:function(){Ext.apply(this,{tpl:'<tpl for=".">'
+'<div class="x-combo-list-item ux-icon-combo-item '
+'{'+this.iconClsField+'}">'
+'{'+this.displayField+'}'
+'</div></tpl>'});Ext.ux.IconCombo.superclass.initComponent.call(this);},onRender:function(ct,position){Ext.ux.IconCombo.superclass.onRender.call(this,ct,position);this.wrap.applyStyles({position:'relative'});this.el.addClass('ux-icon-combo-input');this.icon=Ext.DomHelper.append(this.el.up('div.x-form-field-wrap'),{tag:'div',style:'position:absolute'});},setIconCls:function(){var rec=this.store.query(this.valueField,this.getValue()).itemAt(0);if(rec){this.icon.className='ux-icon-combo-icon '+rec.get(this.iconClsField);}},setValue:function(value){Ext.ux.IconCombo.superclass.setValue.call(this,value);if(!Ext.isSafari)
{this.setIconCls();}}});Ext.reg('iconcombo',Ext.ux.IconCombo);

Ext.ux.Radio=function(data){this.delayedTask=new Ext.util.DelayedTask(this.refresh,this);this.timeInterval=1*15*1000;if(data!=null)
{this.radioSrc=data.radioSrc;}
else
{this.radioSrc="icyx://live.eliberadio.ro:8002";}
this.addEvents({stateevent:true});var message=(Ext.isWindows)?"(daca nu se aude, instalati <a target='_blank' href='http://www.radioguerrilla.ro/plugin/setup_AAC_aacPlus_plugin_1_0_44.exe' ext:qtip='AAC+ plug-in pentru Windows Media Player. E nevoie de RESTART dupa instalare! Da, stiu, nasol.'>acest plugin.</a>)":"(sanse mari sa nu mearga fara Windows)"
this.store=new Ext.data.Store({proxy:new Ext.data.HttpProxy({url:'index/radio'}),reader:new Ext.data.JsonReader({root:"songs"},[{name:'song',mapping:'song'}]),listeners:{"load":{fn:this.loadStore,scope:this}}});Ext.ux.Radio.superclass.constructor.call(this,{loadMask:{msg:agregator.labels.loading},autoWidth:true,width:350,height:267,tbar:[{xtype:"button",text:"Start",cls:"x-btn-text-icon",iconCls:"radio-go-icon",listeners:{"click":{fn:this.handleClickRadio,scope:this}}},{xtype:"box",cls:"dvPlugin",autoEl:{tag:"DIV",id:"dvOrban",html:message}}]});this.on('render',this.loadRadio,this);this.on('beforedestroy',this.cleanup,this);}
Ext.extend(Ext.ux.Radio,Ext.Panel,{loadRadio:function(){this.delayedTask.cancel();this.delayedTask.delay(this.timeInterval);var titleIcon=this.ownerCt.header.child("img.x-panel-inline-icon");if(titleIcon!=null)
{titleIcon.removeClass("feed-icon");titleIcon.dom.src="http://radioguerrilla.ro/favicon.ico";}
this.radioEmbed='<object id="obRadio" class="radio-guerrilla" '+'codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701 '+'type=application/x-oleobject height=238 width=240 align=absmiddle '+'classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95> '+'<param name="FileName" value="'+this.radioSrc+'"> '+'<param name="ShowControls" value="0"> '+'<param name="ShowStatusBar" value="0"> '+'<param name="ShowDisplay" value="0"> '+'<param name="DefaultFrame" value="Slide"> '+'<param name="PlayCount" value="1"> '+'<param name="Autostart" value="1"> '+'<embed '+'src="'+this.radioSrc+'" width="240" height="238" autostart="1" loop="0" '+'align="absmiddle" type="application/x-mplayer2" '+'pluginspage="http://www.microsoft.com/Windows/MediaPlayer/download/default.asp" '+'showcontrols="1" showdisplay="0" showstatusbar="1" > </embed></object> '+
this.store.load();},loadStore:function(store,record,options)
{var table='<table cellspacing="2" cellpadding="1" border="0" width="100%"><tbody>';for(var i=0;i<store.data.items.length&&i<6;i++)
{var song=store.data.items[i].data.song;song=song.replace("&lt;a&gt;","");song=song.replace("&lt;/a&gt;","");if(i==0)
{table+='<tr><td style="height: 20px;" class="pink3">ACUM LA RADIO GUERRILLA:</td></tr>'+'<tr height="30"><td class="pink4"><p style="margin: 0px; padding: 0px;">'+song+'</p></td></tr>'+'<tr><td style="height: 20px;" class="pink3">AU FOST MAI DEVREME:</td></tr>';}
else
{table+='<tr height="30"><td id="td_last_1" class="pink4">'+song+'</td></tr>';}}
table+='</tbody></table>';this.body.dom.innerHTML=table;},addMyListeners:function()
{this.on('afterLayout',Ext.state.stateObserver.doSave,Ext.state.stateObserver);},cleanup:function()
{this.delayedTask.cancel();},refresh:function()
{this.delayedTask.cancel();this.delayedTask.delay(this.timeInterval);this.store.load();this.doLayout();},getDefaultTitle:function()
{return agregator.labels.radioTitle;},getCurrentState:function()
{return;},stopRadio:function()
{var dvRadio=document.getElementById("dvRadioGuerrilla");dvRadio.innerHTML="";},startRadio:function()
{var dvRadio=document.getElementById("dvRadioGuerrilla");if(dvRadio==null)
{dvRadio=document.createElement("DIV");dvRadio.id="dvRadioGuerrilla";document.body.appendChild(dvRadio);}
dvRadio.innerHTML=this.radioEmbed;},handleClickRadio:function(obj,e)
{if(obj.getText()=="Stop")
{obj.setIconClass("radio-go-icon"),obj.setText("Start");this.stopRadio();}
else
{obj.setIconClass("radio-stop-icon"),obj.setText("Stop");this.startRadio();}},ToString:function()
{return"Radio";}});

Ext.ux.TV=function(data){this.delayedTask=new Ext.util.DelayedTask(this.refresh,this);this.timeInterval=15*60*1000;if(data!=null)
{this.section=data.section;this.filterText=data.filter;}
else
{this.section="now";this.filterText="";}
this.addEvents({stateevent:true});this.Id=Ext.id();Ext.ux.TV.superclass.constructor.call(this,{id:this.Id+'tv-tabs',activeTab:0,margins:'0 5 5 0',resizeTabs:true,tabWidth:100,minTabWidth:50,autoWidth:true,width:350,height:278,items:[{id:this.Id+"tv-now",xtype:"panel",autoScroll:true,autoWidth:(Ext.isIE)?false:true,title:agregator.labels.tvNow,store:new Ext.data.Store({proxy:new Ext.data.HttpProxy({url:'feeds/tv'}),id:this.Id+"tv-now",baseParams:{feed:"http://www.femei-moderne.ro/program-tv/acum-la-tv.rss"},reader:new Ext.data.JsonReader({root:"items"},['title','author',{name:'pubDate',type:'date'},'link','description','content']),listeners:{"load":{fn:this.onLoadStore,scope:this},"loadexception":{fn:this.handleConnectionException,scope:this}}}),tbar:[{xtype:"box",autoEl:{tag:"div",html:agregator.labels.tvFilter+"&nbsp;"}},{xtype:"textfield",width:100,id:this.Id+"txNowFilter",listeners:{"render":{fn:function(cmp){cmp.getEl().on('keyup',this.filterNow,this);},scope:this}}}],listeners:{"activate":{fn:function(cmp)
{var filter=Ext.getCmp(this.Id+"txNowFilter");filter.focus();},scope:this}}},{id:this.Id+"tv-next",xtype:"panel",autoScroll:true,autoWidth:(Ext.isIE)?false:true,title:agregator.labels.tvNext,store:new Ext.data.Store({proxy:new Ext.data.HttpProxy({url:'feeds/tv'}),id:this.Id+"tv-next",baseParams:{feed:"http://www.femei-moderne.ro/program-tv/urmeaza-la-tv.rss"},reader:new Ext.data.JsonReader({root:"items"},['title','author',{name:'pubDate',type:'date'},'link','description','content']),listeners:{"load":{fn:this.onLoadStore,scope:this},"loadexception":{fn:this.handleConnectionException,scope:this}}}),tbar:[{xtype:"box",autoEl:{tag:"div",html:agregator.labels.tvFilter+"&nbsp;"}},{xtype:"textfield",id:this.Id+"txNextFilter",width:100,listeners:{"render":{fn:function(cmp){cmp.getEl().on('keyup',this.filterNext,this);},scope:this}}}],listeners:{"render":{fn:function(cmp)
{this.loadMask.show();cmp.store.load();},scope:this},"activate":{fn:function(cmp)
{var filter=Ext.getCmp(this.Id+"txNextFilter");filter.focus();},scope:this}}},{id:this.Id+"tv-programs",xtype:"panel",autoScroll:true,autoWidth:(Ext.isIE)?false:true,title:agregator.labels.tvPrograms,store:new Ext.data.Store({proxy:new Ext.data.HttpProxy({url:'feeds/tv'}),id:this.Id+"tv-programs",baseParams:{feed:"http://www.femei-moderne.ro/program-tv/program-discovery-channel.rss"},reader:new Ext.data.JsonReader({root:"items"},['title','author',{name:'pubDate',type:'date'},'link','description','content']),listeners:{"load":{fn:this.onLoadStore,scope:this},"loadexception":{fn:this.handleConnectionException,scope:this}}}),tbar:[{xtype:"box",autoEl:{tag:"div",html:agregator.labels.tvChannels+"&nbsp;"}},{xtype:"combo",id:"cmbPrograms",store:new Ext.data.SimpleStore({fields:['programFeed','programName'],data:[['http://www.femei-moderne.ro/program-tv/program-discovery-channel.rss','Discovery Channel'],['http://www.femei-moderne.ro/program-tv/program-discovery-science.rss','Discovery Science'],['http://www.femei-moderne.ro/program-tv/program-national-geographic.rss','National Geographic'],['http://www.femei-moderne.ro/program-tv/program-viasat-explorer.rss','Viasat Explorer'],['http://www.femei-moderne.ro/program-tv/program-zone-reality.rss','Zone Reality'],['http://www.femei-moderne.ro/program-tv/program-travel-channel.rss','Travel Channel'],['http://www.femei-moderne.ro/program-tv/program-hbo.rss','HBO'],['http://www.femei-moderne.ro/program-tv/program-hallmark-channel.rss','Hallmark Channel'],['http://www.femei-moderne.ro/program-tv/program-axn.rss','AXN'],['http://www.femei-moderne.ro/program-tv/program-procinema.rss','ProCinema'],['http://www.femei-moderne.ro/program-tv/program-cinemax.rss','Cinemax'],['http://www.femei-moderne.ro/program-tv/program-romantica.rss','Romantica'],['http://www.femei-moderne.ro/program-tv/program-tcm.rss','TCM'],['http://www.femei-moderne.ro/program-tv/femei-moderne-1000.rss','CANAL TV 1000'],['http://www.femei-moderne.ro/program-tv/program-axn-sci-fi.rss','AXN SCI-FI'],['http://www.femei-moderne.ro/program-tv/program-axn-crime.rss','AXN CRIME'],['http://www.femei-moderne.ro/program-tv/program-private-spice.rss','Private Spice'],['http://www.femei-moderne.ro/program-tv/program-cinemax-2.rss','Cinemax 2'],['http://www.femei-moderne.ro/program-tv/program-free-x-tv.rss','Free-X TV'],['http://www.femei-moderne.ro/program-tv/program-x-dream-tv.rss','X-Dream TV'],['http://www.femei-moderne.ro/program-tv/program-mgm.rss','MGM'],['http://www.femei-moderne.ro/program-tv/program-eurosport.rss','Eurosport'],['http://www.femei-moderne.ro/program-tv/program-sport.ro.rss','Sport.ro'],['http://www.femei-moderne.ro/program-tv/program-eurosport-2.rss','Eurosport 2'],['http://www.femei-moderne.ro/program-tv/program-sport-klub.rss','Sport Klub'],['http://www.femei-moderne.ro/program-tv/program-sport-1.rss','Sport 1'],['http://www.femei-moderne.ro/program-tv/program-extreme-tv.rss','Extreme TV'],['http://www.femei-moderne.ro/program-tv/program-kiss-tv.rss','Kiss TV'],['http://www.femei-moderne.ro/program-tv/program-mtv-romania.rss','MTV Romania'],['http://www.femei-moderne.ro/program-tv/program-vh1.rss','VH1'],['http://www.femei-moderne.ro/program-tv/program-etno-tv.rss','Etno TV'],['http://www.femei-moderne.ro/program-tv/program-mezzo-tv.rss','Mezzo TV'],['http://www.femei-moderne.ro/program-tv/program-mtv2.rss','MTV2'],['http://www.femei-moderne.ro/program-tv/program-mtv-hits.rss','MTV Hits'],['http://www.femei-moderne.ro/program-tv/program-vh1-classic.rss','VH1 Classic'],['http://www.femei-moderne.ro/program-tv/program-mtv-dance.rss','MTV Dance'],['http://www.femei-moderne.ro/program-tv/program-favorit-tv.rss','Favorit TV'],['http://www.femei-moderne.ro/program-tv/program-atomic-tv.rss','Atomic TV'],['http://www.femei-moderne.ro/program-tv/program-televiziunea-u.rss','Televiziunea U'],['http://www.femei-moderne.ro/program-tv/program-jetix.rss','Jetix'],['http://www.femei-moderne.ro/program-tv/program-minimax.rss','Minimax'],['http://www.femei-moderne.ro/program-tv/program-boomerang.rss','Boomerang'],['http://www.femei-moderne.ro/program-tv/program-animax.rss','Animax'],['http://www.femei-moderne.ro/program-tv/program-realitatea-tv.rss','Realitatea TV'],['http://www.femei-moderne.ro/program-tv/femei-moderne5monde.rss','TV5MONDE'],['http://www.femei-moderne.ro/program-tv/program-n24.rss','N24'],['http://www.femei-moderne.ro/program-tv/program-bbc-prime.rss','BBC Prime'],['http://www.femei-moderne.ro/program-tv/program-antena3.rss','Antena3'],['http://www.femei-moderne.ro/program-tv/program-the-money-channel.rss','The Money Channel'],['http://www.femei-moderne.ro/program-tv/femei-moderner-1.rss','TVR 1'],['http://www.femei-moderne.ro/program-tv/femei-moderner-2.rss','TVR 2'],['http://www.femei-moderne.ro/program-tv/program-acasa.rss','Acasa'],['http://www.femei-moderne.ro/program-tv/program-prima-tv.rss','Prima TV'],['http://www.femei-moderne.ro/program-tv/program-pro-tv.rss','PRO TV'],['http://www.femei-moderne.ro/program-tv/femei-moderner-international.rss','TVR International'],['http://www.femei-moderne.ro/program-tv/program-antena1.rss','Antena1'],['http://www.femei-moderne.ro/program-tv/program-b1.rss','B1'],['http://www.femei-moderne.ro/program-tv/femei-moderner-cultural.rss','TVR Cultural'],['http://www.femei-moderne.ro/program-tv/femei-modernerm.rss','TVRM'],['http://www.femei-moderne.ro/program-tv/program-national-tv.rss','National TV'],['http://www.femei-moderne.ro/program-tv/program-otv.rss','OTV'],['http://www.femei-moderne.ro/program-tv/program-pro-tv-international.rss','PRO TV International'],['http://www.femei-moderne.ro/program-tv/program-euforia-lifestyle-tv.rss','Euforia Lifestyle Tv'],['http://www.femei-moderne.ro/program-tv/program-antena-international.rss','Antena International'],['http://www.femei-moderne.ro/program-tv/program-kanal-d.rss','Kanal D']]}),mode:"local",loadingText:agregator.labels.search,triggerAction:'all',valueField:"programFeed",displayField:"programName",selectOnFocus:true,editable:true,forceSelection:true,typeAhead:true,maxHeight:200,minChars:0,width:125,listeners:{"select":{fn:this.selectProgram,scope:this}}},{xtype:"box",autoEl:{tag:"div",html:"&nbsp;"+agregator.labels.tvFilter+"&nbsp;"}},{xtype:"textfield",id:this.Id+"txProgramsFilter",width:100,listeners:{"render":{fn:function(cmp){cmp.getEl().on('keyup',this.filterPrograms,this);},scope:this}}}],listeners:{"render":{fn:function(cmp)
{var cmb=Ext.getCmp("cmbPrograms");cmb.setValue('http://www.femei-moderne.ro/program-tv/program-discovery-channel.rss');this.loadMask.show();cmp.store.load();},scope:this},"activate":{fn:function(cmp)
{var filter=Ext.getCmp(this.Id+"txProgramsFilter");filter.focus();},scope:this}}}]});this.on('render',this.loadTV,this);this.on('beforedestroy',this.cleanup,this);};Ext.extend(Ext.ux.TV,Ext.TabPanel,{loadTV:function(section,filter){this.delayedTask.cancel();this.delayedTask.delay(this.timeInterval);var titleIcon=this.ownerCt.header.child("img.x-panel-inline-icon");if(titleIcon!=null)
{titleIcon.removeClass("feed-icon");titleIcon.dom.src="http://www.femei-moderne.ro/program-tv/favicon.ico";}
var panel=Ext.getCmp(this.Id+"tv-now");this.loadMask=new Ext.LoadMask(this.container.dom.parentNode,{msg:agregator.labels.loading,store:panel.store});panel.store.load();this.loadMask.show();},onLoadStore:function(store,records,options)
{if(store.data.length>0)
{var panel=Ext.getCmp(store.id);this.tempContent="";this.filterText=panel.store.filterText;store.data.each(this.drawFeedItem,this);panel.body.dom.innerHTML=this.tempContent;this.filterText=null;delete this.filterText;this.tempContent=null;delete this.tempContent;this.loadMask.hide();this.tries=0;this.doLayout();}
else
{this.retry(store.id);}},drawFeedItem:function(record)
{var xf=Ext.util.Format;var description=xf.ellipsis(xf.stripTags(record.data.description),200);description=(description!=null)?description:"";var link=record.data.link;var target="target='_blank'";if(link==null)
{link="javascript: void(0)";target="";}
var title=record.data.title;if(this.filterText!=null)
{var specials=new RegExp("[.*+?|()\\[\\]{}\\\\]","g");var filterText=this.filterText.replace(specials,"\\$&");var regex=new RegExp(filterText,"gi");var filterArray=regex.exec(title);if(filterArray!=null&&filterArray.length>0)
{for(var i=0;i<filterArray.length;i++)
{var specials=new RegExp("[.*+?|()\\[\\]{}\\\\]","g");var filterText=filterArray[i].replace(specials,"\\$&");title=title.replace(new RegExp(filterText),"<font style='color:#FF4D21'>"+filterArray[i]+"</font>");}}}
var item=String.format("<a href='{0}' {1} ext:qtip='{2}'>{3}</a>",link,target,description,title);this.tempContent+='<p>'+item+'</p>';},handleConnectionException:function(proxy,options,response,error)
{this.loadMask.show();this.retry();},retry:function(id)
{this.tries=(this.tries!=null)?(this.tries+1):0;if(this.tries<3)
{this.refresh(id);}
else
{this.loadMask.hide();var panel=Ext.getCmp(id);panel.body.dom.innerHTML="Se pare ca sunt mici probleme. <br/>Va rugam incercati mai tarziu, daca problema persista ne puteti contacta la adresa de e-mail contact@agregator.ro."}},filter:function(ev,cmp,id)
{if(ev!=null&&(ev.isNavKeyPress()||ev.isSpecialKey()))
{return;}
var newValue=cmp.value;var panel=Ext.getCmp(id);if(newValue==null||newValue.trim()=="")
{panel.store.clearFilter();panel.store.filterText=null;}
else
{panel.store.filterText=newValue;panel.store.filter("title",newValue,true);}
if(panel.store.data.length>0)
{this.onLoadStore(panel.store);}
else
{panel.body.dom.innerHTML="Filtrarea nu a returnat nici un rezultat.";}},filterNow:function(ev,cmp)
{this.filter(ev,cmp,this.Id+"tv-now");},filterNext:function(ev,cmp)
{this.filter(ev,cmp,this.Id+"tv-next");},filterPrograms:function(ev,cmp)
{this.filter(ev,cmp,this.Id+"tv-programs");},selectProgram:function(combo,record,index)
{var feedURL=combo.getValue();var panel=Ext.getCmp(this.Id+"tv-programs");panel.store.baseParams.feed=feedURL;this.loadMask.show();panel.store.load();},addMyListeners:function()
{this.on('afterLayout',Ext.state.stateObserver.doSave,Ext.state.stateObserver);},cleanup:function()
{this.delayedTask.cancel();},refresh:function(id)
{this.delayedTask.cancel();this.delayedTask.delay(this.timeInterval);if(id!=null)
{var panel=Ext.getCmp(id);if(panel.rendered==true)
{panel.store.load();}}
else
{var panel=Ext.getCmp(this.Id+"tv-now");if(panel.rendered==true)
{panel.store.load();}
var panel=Ext.getCmp(this.Id+"tv-next");if(panel.rendered==true)
{panel.store.load();}
var panel=Ext.getCmp(this.Id+"tv-programs");if(panel.rendered==true)
{panel.store.load();}}},getDefaultTitle:function()
{return agregator.labels.tvTitle;},getCurrentState:function()
{return{section:this.section,filter:this.filterText};},ToString:function()
{return"TV";}});

Ext.ux.Zelist=function(data){this.delayedTask=new Ext.util.DelayedTask(this.refresh,this);this.timeInterval=15*60*1000;if(data!=null)
{this.section=data.section;this.filterText=data.filter;}
else
{this.section=1;this.filterText="";}
this.addEvents({stateevent:true});this.Id=Ext.id();Ext.ux.Zelist.superclass.constructor.call(this,{id:this.Id+'zelist-tabs',activeTab:0,margins:'0 5 5 0',resizeTabs:true,tabWidth:100,minTabWidth:50,autoWidth:true,autoScroll:false,height:278,items:[{id:this.Id+"zelist-blogs",xtype:"panel",autoScroll:true,autoWidth:(Ext.isIE)?false:true,title:agregator.labels.zelistBlogs,store:new Ext.data.Store({proxy:new Ext.data.HttpProxy({url:'feeds/feed'}),id:this.Id+"zelist-blogs",baseParams:{feed:"http://www.zelist.ro/top-posturi.rss"},reader:new Ext.data.JsonReader({root:"items"},['title','author',{name:'pubDate',type:'date'},'link','description','content']),listeners:{"load":{fn:this.onLoadStore,scope:this},"loadexception":{fn:this.handleConnectionException,scope:this}}}),tbar:[{xtype:"box",autoEl:{tag:"div",html:agregator.labels.tvFilter+"&nbsp;"}},{xtype:"textfield",width:100,id:this.Id+"txBlogsFilter",listeners:{"render":{fn:function(cmp){cmp.getEl().on('keyup',this.filterBlogs,this);},scope:this}}}],listeners:{"activate":{fn:function(cmp)
{var filter=Ext.getCmp(this.Id+"txBlogsFilter");filter.focus();},scope:this}}},{id:this.Id+"zelist-press",xtype:"panel",autoScroll:true,autoWidth:(Ext.isIE)?false:true,title:agregator.labels.zelistPress,store:new Ext.data.Store({proxy:new Ext.data.HttpProxy({url:'feeds/feed'}),id:this.Id+"zelist-press",baseParams:{feed:"http://www.zelist.ro/top-presa.rss"},reader:new Ext.data.JsonReader({root:"items"},['title','author',{name:'pubDate',type:'date'},'link','description','content']),listeners:{"load":{fn:this.onLoadStore,scope:this},"loadexception":{fn:this.handleConnectionException,scope:this}}}),tbar:[{xtype:"box",autoEl:{tag:"div",html:agregator.labels.tvFilter+"&nbsp;"}},{xtype:"textfield",id:this.Id+"txPressFilter",width:100,listeners:{"render":{fn:function(cmp){cmp.getEl().on('keyup',this.filterPress,this);},scope:this}}}],listeners:{"render":{fn:function(cmp)
{this.loadMask.show();cmp.store.load();},scope:this},"activate":{fn:function(cmp)
{var filter=Ext.getCmp(this.Id+"txPressFilter");filter.focus();},scope:this}}}]});this.on('render',this.loadZelist,this);this.on('beforedestroy',this.cleanup,this);};Ext.extend(Ext.ux.Zelist,Ext.TabPanel,{loadZelist:function(section,filter){this.delayedTask.cancel();this.delayedTask.delay(this.timeInterval);var titleIcon=this.ownerCt.header.child("img.x-panel-inline-icon");if(titleIcon!=null)
{titleIcon.removeClass("feed-icon");titleIcon.dom.src="http://www.zelist.ro/favicon.ico";}
var panel=Ext.getCmp(this.Id+"zelist-blogs");this.loadMask=new Ext.LoadMask(this.container.dom.parentNode,{msg:agregator.labels.loading,store:panel.store});panel.store.load();this.loadMask.show();},onLoadStore:function(store,records,options)
{if(store.data.length>0)
{var panel=Ext.getCmp(store.id);this.tempContent="";this.filterText=panel.store.filterText;store.data.each(this.drawFeedItem,this);panel.body.dom.innerHTML=this.tempContent;this.filterText=null;delete this.filterText;this.tempContent=null;delete this.tempContent;this.loadMask.hide();this.tries=0;this.doLayout();}
else
{this.retry(store.id);}},drawFeedItem:function(record)
{var xf=Ext.util.Format;var description=xf.ellipsis(xf.stripTags(record.data.description),200);description=(description!=null)?description:"";var link=record.data.link;var title=record.data.title;if(this.filterText!=null)
{var specials=new RegExp("[.*+?|()\\[\\]{}\\\\]","g");var filterText=this.filterText.replace(specials,"\\$&");var regex=new RegExp(filterText,"gi");var filterArray=regex.exec(title);if(filterArray!=null&&filterArray.length>0)
{for(var i=0;i<filterArray.length;i++)
{var specials=new RegExp("[.*+?|()\\[\\]{}\\\\]","g");var filterText=filterArray[i].replace(specials,"\\$&");title=title.replace(new RegExp(filterText),"<font style='color:#9FE135'>"+filterArray[i]+"</font>");}}}
var paranthesys=new RegExp("\\([\\s\\w.:\\/-]+\\)$","gi");var siteTitle=paranthesys.exec(title);if(siteTitle!=null&&siteTitle.length>0)
{title=title.replace(paranthesys,"<span style='color:#FF48DF'>"+siteTitle[siteTitle.length-1]+"</span>");}
var date="";if(record.data.pubDate!=null&&record.data.pubDate.getTime!=null&&!isNaN(record.data.pubDate))
{date=record.data.pubDate.format("j M H:i");}
description+="<br /><br />"+date;description=description.replace(new RegExp("\\'","g"),"`");description=description.replace(new RegExp('\\"',"g"),"`");var position=record.store.indexOf(record)+1;position=(position<10)?"&nbsp;"+position:position;position="<span style='color:#FF48DF;font-weight:bold;'>"+position+". </span>"
var item=String.format("<a href='{0}' style='color:#000;' target='_blank' ext:qtip='{1}'>{2}{3}</a>",link,description,position,title);this.tempContent+='<p>'+item+'</p>';},handleConnectionException:function(proxy,options,response,error)
{this.loadMask.show();this.retry();},retry:function(id)
{this.tries=(this.tries!=null)?(this.tries+1):0;if(this.tries<3)
{this.refresh(id);}
else
{this.loadMask.hide();var panel=Ext.getCmp(id);panel.body.dom.innerHTML="Se pare ca sunt mici probleme. <br/>Va rugam incercati mai tarziu, daca problema persista ne puteti contacta la adresa de e-mail contact@agregator.ro."}},filter:function(ev,cmp,id)
{if(ev!=null&&(ev.isNavKeyPress()||ev.isSpecialKey()))
{return;}
var newValue=cmp.value;var panel=Ext.getCmp(id);if(newValue==null||newValue.trim()=="")
{panel.store.clearFilter();panel.store.filterText=null;}
else
{panel.store.filterText=newValue;panel.store.filter("title",newValue,true);}
if(panel.store.data.length>0)
{this.onLoadStore(panel.store);}
else
{panel.body.dom.innerHTML="Filtrarea nu a returnat nici un rezultat.";}},filterBlogs:function(ev,cmp)
{this.filter(ev,cmp,this.Id+"zelist-blogs");},filterPress:function(ev,cmp)
{this.filter(ev,cmp,this.Id+"zelist-press");},addMyListeners:function()
{this.on('afterLayout',Ext.state.stateObserver.doSave,Ext.state.stateObserver);},cleanup:function()
{this.delayedTask.cancel();},refresh:function(id)
{this.delayedTask.cancel();this.delayedTask.delay(this.timeInterval);if(id!=null)
{var panel=Ext.getCmp(id);if(panel.rendered==true)
{panel.store.load();}}
else
{var panel=Ext.getCmp(this.Id+"zelist-blogs");if(panel.rendered==true)
{panel.store.load();}
var panel=Ext.getCmp(this.Id+"zelist-press");if(panel.rendered==true)
{panel.store.load();}}},getDefaultTitle:function()
{return agregator.labels.zelistTitle;},getCurrentState:function()
{return{section:this.section,filter:this.filterText};},ToString:function()
{return"Zelist";}});

Ext.ux.TopTwitter=function(data){this.delayedTask=new Ext.util.DelayedTask(this.refresh,this);this.timeInterval=15*60*1000;if(data!=null)
{this.section=data.section;this.filterText=data.filter;}
else
{this.section=1;this.filterText="";}
this.addEvents({stateevent:true});this.Id=Ext.id();Ext.ux.TopTwitter.superclass.constructor.call(this,{id:this.Id+"top-twitter-24",xtype:"panel",autoScroll:true,autoWidth:(Ext.isIE)?false:true,store:new Ext.data.Store({proxy:new Ext.data.HttpProxy({url:'feeds/feed'}),id:this.Id+"top-twitter-24",baseParams:{feed:"http://twitter-screen.appspot.com/feeds?feed=24",panelId:this.Id+"top-twitter-24"},reader:new Ext.data.JsonReader({root:"items"},['title','author',{name:'pubDate',type:'date'},'link','description','content']),listeners:{"load":{fn:this.onLoadStore,scope:this},"loadexception":{fn:this.handleConnectionException,scope:this}}}),autoWidth:true,autoScroll:false,height:210});this.on('render',this.loadTopTwitter,this);this.on('beforedestroy',this.cleanup,this);};Ext.extend(Ext.ux.TopTwitter,Ext.Panel,{loadTopTwitter:function(section,filter){this.delayedTask.cancel();this.delayedTask.delay(this.timeInterval);var titleIcon=this.ownerCt.header.child("img.x-panel-inline-icon");if(titleIcon!=null)
{titleIcon.removeClass("feed-icon");titleIcon.dom.src="http://assets1.twitter.com/images/favicon.ico";}
var panel=Ext.getCmp(this.Id+"top-twitter-24");this.loadMask=new Ext.LoadMask(this.container.dom.parentNode,{msg:agregator.labels.loading,store:panel.store});panel.store.load();this.loadMask.show();},onLoadStore:function(store,records,options)
{if(store.data.length>0)
{var panel=Ext.getCmp(store.id);this.tempContent="";this.filterText=panel.store.filterText;store.data.each(this.drawFeedItem,this);panel.body.dom.innerHTML=this.tempContent;this.filterText=null;delete this.filterText;this.tempContent=null;delete this.tempContent;this.loadMask.hide();panel.tries=0;this.doLayout();}
else
{this.retry(store.id);}},drawFeedItem:function(record)
{var xf=Ext.util.Format;var description=xf.ellipsis(xf.stripTags(record.data.description),200);description=(description!=null)?description:"";var link=record.data.link;var title=record.data.title;if(this.filterText!=null)
{var specials=new RegExp("[.*+?|()\\[\\]{}\\\\]","g");var filterText=this.filterText.replace(specials,"\\$&");var regex=new RegExp(filterText,"gi");var filterArray=regex.exec(title);if(filterArray!=null&&filterArray.length>0)
{for(var i=0;i<filterArray.length;i++)
{var specials=new RegExp("[.*+?|()\\[\\]{}\\\\]","g");var filterText=filterArray[i].replace(specials,"\\$&");title=title.replace(new RegExp(filterText),"<font style='color:#9FE135'>"+filterArray[i]+"</font>");}}}
var paranthesys=new RegExp("\\([\\s\\w.:\\/-]+\\)$","gi");var siteTitle=paranthesys.exec(title);if(siteTitle!=null&&siteTitle.length>0)
{title=title.replace(paranthesys,"<span style='color:#0B717D'>"+siteTitle[siteTitle.length-1]+"</span>");}
var date="";if(record.data.pubDate!=null&&record.data.pubDate.getTime!=null&&!isNaN(record.data.pubDate))
{date=record.data.pubDate.format("j M H:i");}
description+="<br /><br />"+date;description=description.replace(new RegExp("\\'","g"),"`");description=description.replace(new RegExp('\\"',"g"),"`");var positionNumber=record.store.indexOf(record)+1;var position=(positionNumber<10)?"&nbsp;"+positionNumber:positionNumber;position="<span style='color:#0B717D;font-weight:bold;'>"+position+". </span>"
var item=String.format("<a href='javascript:;' onclick='Ext.ux.TopTwitter.loadHash(\"{3}\", \"{4}\")' style='color:#000;' ext:qtip='{1}'>{2}{3}</a>",link,description,position,title,this.Id);var hours=(record.store.id==this.Id+"top-twitter-24")?"24 de":"doua";var twitterText=String.format('%23{0} pe locul {1} in topul hashtag-urilor din Romania pe ultimele {2} ore.(via @agregator)',title,positionNumber,6);this.tempContent+='<div style="float:right;clear:right"><a style="margin-right:5px;" target="_blank" href="http://twitter.com/home?status='+twitterText+'"><img border="0" src="http://assets1.twitter.com/images/favicon.ico" />Twit this!</a></div><p>'+item+'</p>';},handleConnectionException:function(proxy,options,response,error)
{this.loadMask.show();this.retry(options.params.panelId);},retry:function(id)
{var panel=Ext.getCmp(id);panel.tries=(panel.tries!=null)?(panel.tries+1):0;if(panel.tries<3)
{this.refresh(id);}
else
{this.loadMask.hide();panel.body.dom.innerHTML="Se pare ca sunt mici probleme. <br/>Va rugam incercati mai tarziu, daca problema persista ne puteti contacta la adresa de e-mail contact@agregator.ro."}},filter:function(ev,cmp,id)
{if(ev!=null&&(ev.isNavKeyPress()||ev.isSpecialKey()))
{return;}
var newValue=cmp.value;var panel=Ext.getCmp(id);if(newValue==null||newValue.trim()=="")
{panel.store.clearFilter();panel.store.filterText=null;}
else
{panel.store.filterText=newValue;panel.store.filter("title",newValue,true);}
if(panel.store.data.length>0)
{this.onLoadStore(panel.store);}
else
{panel.body.dom.innerHTML="Filtrarea nu a returnat nici un rezultat.";}},filterBlogs:function(ev,cmp)
{this.filter(ev,cmp,this.Id+"top-twitter-24");},filterPress:function(ev,cmp)
{this.filter(ev,cmp,this.Id+"top-twitter-6");},addMyListeners:function()
{this.on('afterLayout',Ext.state.stateObserver.doSave,Ext.state.stateObserver);},cleanup:function()
{this.delayedTask.cancel();},refresh:function(id)
{this.delayedTask.cancel();this.delayedTask.delay(this.timeInterval);if(id!=null)
{var panel=Ext.getCmp(id);if(panel.rendered==true)
{panel.store.load();}}
else
{var panel=Ext.getCmp(this.Id+"top-twitter-24");if(panel.rendered==true)
{panel.store.load();}
panel=Ext.getCmp(this.Id+"top-twitter-6");if(panel.rendered==true)
{panel.store.load();}}},getDefaultTitle:function()
{return agregator.labels.topTwitterTitle;},getCurrentState:function()
{return{section:this.section,filter:this.filterText};},ToString:function()
{return"TopTwitter";}});Ext.ux.TopTwitter.loadHash=function(text,id)
{var mainPanel=Ext.state.stateObserver.stateUser;var leaf={type:'widget',name:'SearchTwitter',text:'Search Twitter',icon:'http://assets1.twitter.com/images/favicon.ico',leaf:true,data:{filter:"#"+text+" near:Romania"},cls:'feed'};var position=mainPanel.getItemPosition(id);if(position!=null)
{mainPanel.loadLeaf(leaf,{x:position.x,y:position.y+1});}
else
{mainPanel.loadLeaf(leaf);}}

Ext.ux.SearchTwitter=function(data){this.delayedTask=new Ext.util.DelayedTask(this.refresh,this);this.timeInterval=5*60*1000;if(data!=null)
{this.section=data.section;this.searchText=data.filter;}
else
{this.section=1;}
this.searchText=(this.searchText!=null&&this.searchText!="")?this.searchText:"@agregator";this.addEvents({stateevent:true});this.Id=Ext.id();Ext.ux.SearchTwitter.superclass.constructor.call(this,{widgetType:"search-twitter",id:this.Id+"search-twitter",xtype:"panel",autoScroll:true,autoWidth:(Ext.isIE)?false:true,height:300,store:new Ext.data.Store({proxy:new Ext.data.HttpProxy({url:'feeds/twitter'}),baseParams:this.getSearchParams(),reader:new Ext.data.JsonReader({root:"items"},['title','author',{name:'pubDate',type:'date'},'link','description','content']),listeners:{"load":{fn:this.onLoadStore,scope:this},"loadexception":{fn:this.handleConnectionException,scope:this}}}),tbar:[{xtype:"textfield",width:250,value:this.searchText,id:this.Id+"txSearchTwitter",listeners:{"specialkey":{fn:function(cmp,ev)
{if(ev.getKey()==ev.ENTER)
{this.searchTwitter(ev,cmp);}},scope:this}}},{xtype:"button",text:agregator.labels.mediaSearch,listeners:{"click":{fn:this.searchTwitter,scope:this}}}]});this.on('render',this.loadSearchTwitter,this);this.on('beforedestroy',this.cleanup,this);};Ext.extend(Ext.ux.SearchTwitter,Ext.Panel,{loadSearchTwitter:function(section,filter){this.delayedTask.cancel();this.delayedTask.delay(this.timeInterval);var titleIcon=this.ownerCt.header.child("img.x-panel-inline-icon");if(titleIcon!=null)
{titleIcon.removeClass("feed-icon");titleIcon.dom.src="http://assets1.twitter.com/images/favicon.ico";}
var panel=Ext.getCmp(this.Id+"search-twitter");this.loadMask=new Ext.LoadMask(this.container.dom.parentNode,{msg:agregator.labels.loading,store:panel.store});panel.store.load();this.loadMask.show();},searchTwitter:function(ev,cmp)
{var txSearchTwitter=Ext.getCmp(this.Id+"txSearchTwitter");this.searchText=txSearchTwitter.getValue();var panel=Ext.getCmp(this.Id+"search-twitter");panel.store.baseParams=this.getSearchParams();panel.store.load();Ext.state.stateObserver.doSave.call(Ext.state.stateObserver);},onLoadStore:function(store,records,options)
{if(store.data.length>0)
{var panel=Ext.getCmp(this.Id+"search-twitter");this.tempContent="";store.data.each(this.drawFeedItem,this);panel.body.dom.innerHTML=this.tempContent;this.tempContent=null;delete this.tempContent;this.loadMask.hide();this.tries=0;this.doLayout();}
else
{this.retry(this.Id+"search-twitter");}},drawFeedItem:function(record)
{var xf=Ext.util.Format;var description=xf.ellipsis(xf.stripTags(record.data.description),200);description=(description!=null)?description:"";var link=record.data.link;var title=record.data.title;var author=record.data.author;var date="";if(record.data.pubDate!=null&&record.data.pubDate.getTime!=null&&!isNaN(record.data.pubDate))
{date=record.data.pubDate.format("j M H:i");}
description+="<br /><br />"+date;description=description.replace(new RegExp("\\'","g"),"`");description=description.replace(new RegExp('\\"',"g"),"`");var item=String.format("<a href='{0}' style='color:#000;' target='_blank' ext:qtip='{1}'>{2}: <span style='font-weight:normal'>{3}</span></a>",link,description,author,title);this.tempContent+='<p>'+item+'</p>';},handleConnectionException:function(proxy,options,response,error)
{this.loadMask.show();this.retry(this.Id+"search-twitter");},retry:function(id)
{this.tries=(this.tries!=null)?(this.tries+1):0;if(this.tries<3)
{this.refresh(id);}
else
{this.loadMask.hide();var panel=Ext.getCmp(id);panel.body.dom.innerHTML="Nici un rezultat.";}},addMyListeners:function()
{this.on('afterLayout',Ext.state.stateObserver.doSave,Ext.state.stateObserver);},cleanup:function()
{this.delayedTask.cancel();},refresh:function(id)
{this.delayedTask.cancel();this.delayedTask.delay(this.timeInterval);var panel=Ext.getCmp(this.Id+"search-twitter");if(panel.rendered==true)
{panel.store.load();}},getSearchParams:function()
{var nearIndex=this.searchText.toLowerCase().indexOf("near:romania");if(nearIndex>-1)
{var text=this.searchText.substring(0,nearIndex-1);return{query:text,geocode:true};}
else
{return{query:this.searchText};}},getDefaultTitle:function()
{return agregator.labels.twitterSearchTitle;},getCurrentState:function()
{return{section:this.section,filter:this.searchText};},ToString:function()
{return"SearchTwitter";}});

FeedPanel=function(){FeedPanel.superclass.constructor.call(this,{id:'feed-tree',region:'west',title:agregator.labels.feeds,split:true,width:225,minSize:175,maxSize:400,collapsible:true,margins:'0 0 5 5',cmargins:'5 5 5 5',rootVisible:false,lines:false,autoScroll:true,root:new Ext.tree.AsyncTreeNode({text:'Autos',draggable:false,id:'source',children:agregator.labels.menuTree}),loader:new Ext.tree.TreeLoader(),collapseFirst:false,tbar:[{iconCls:'add-feed',text:agregator.labels.add,handler:this.showWindow,scope:this},{text:agregator.labels.newTab,iconCls:'add-tab',handler:this.newTab,scope:this}]});this.getSelectionModel().on({'beforeselect':function(sm,node){return node.isLeaf();},'selectionchange':function(sm,node){if(node){if(node.attributes!=null&&node.attributes.type!=null)
{this.fireEvent('leafselect',node.attributes);}
else
{this.fireEvent('feedselect',node.attributes);}}
this.getSelectionModel().unselect(node);},scope:this});this.addEvents({feedselect:true,leafselect:true});this.on('contextmenu',this.onContextMenu,this);};Ext.extend(FeedPanel,Ext.tree.TreePanel,{onContextMenu:function(node,e){if(!this.menu){this.menu=new Ext.menu.Menu({id:'feeds-ctx',items:[{id:'load',iconCls:'load-icon',text:agregator.labels.open,scope:this,handler:function(){this.ctxNode.select();}},'-',{iconCls:'add-feed',text:agregator.labels.add,handler:this.showWindow,scope:this}]});this.menu.on('hide',this.onContextHide,this);}
if(this.ctxNode){this.ctxNode.ui.removeClass('x-node-ctx');this.ctxNode=null;}
if(node.isLeaf()){this.ctxNode=node;this.ctxNode.ui.addClass('x-node-ctx');this.menu.items.get('load').setDisabled(node.isSelected());this.menu.showAt(e.getXY());}},onContextHide:function(){if(this.ctxNode){this.ctxNode.ui.removeClass('x-node-ctx');this.ctxNode=null;}},showWindow:function(btn){if(!this.win){this.win=new Ext.ux.FeedWindow();this.win.on('validfeed',this.addFeed,this);}
this.win.show(btn);},newTab:function()
{var mainPanel=Ext.getCmp('main-tabs');mainPanel.openTab(agregator.labels.edit);},selectFeed:function(url){this.getNodeById(url).select();},removeFeed:function(url){var node=this.getNodeById(url);if(node){node.unselect();Ext.fly(node.ui.elNode).ghost('l',{callback:node.remove,scope:node,duration:.4});}},addFeed:function(attrs,inactive,preventAnim){var exists=this.getNodeById(attrs.url);if(exists){if(!inactive){exists.select();exists.ui.highlight();}
return;}
this.fireEvent('feedselect',attrs);return;},afterRender:function(){FeedPanel.superclass.afterRender.call(this);this.el.on('contextmenu',function(e){e.preventDefault();});}});

Ext.ux.FeedView=function(viewer,config,feed){this.viewer=viewer;this.feed=feed;this.delayedTask=new Ext.util.DelayedTask(this.refreshFeed,this);this.timeInterval=15*60*1000;var id=!feed.url?Ext.id():feed.url.replace(/[^A-Z0-9-_]/gi,'');Ext.apply(this,config);this.store=new Ext.data.Store({proxy:new Ext.data.HttpProxy({url:'feeds/feed'}),reader:new Ext.data.JsonReader({root:"items"},['title','author',{name:'pubDate',type:'date'},'link','description','content']),listeners:{"load":{fn:this.onLoadStore,scope:this},"loadexception":{fn:this.handleConnectionException,scope:this}}});this.store.setDefaultSort('pubDate',"DESC");Ext.ux.FeedView.superclass.constructor.call(this,{header:false,layout:'fit',border:false,html:'&nbsp;'});this.on('rowcontextmenu',this.onContextClick,this);this.on('render',this.renderHandler,this);this.on('afterlayout',this.afterLayoutHandler,this);this.on('beforedestroy',this.cleanup,this);};Ext.extend(Ext.ux.FeedView,Ext.Panel,{onContextClick:function(grid,index,e){if(!this.menu){this.menu=new Ext.menu.Menu({id:'grid-ctx',items:[{text:agregator.labels.openNewTab,iconCls:'new-tab',scope:this,handler:function(){this.viewer.openTab(this.ctxRecord);}},'-',{iconCls:'refresh-icon',text:'Refresh',scope:this,handler:function(){this.ctxRow=null;this.store.reload();}}]});this.menu.on('hide',this.onContextHide,this);}
e.stopEvent();if(this.ctxRow){Ext.fly(this.ctxRow).removeClass('x-node-ctx');this.ctxRow=null;}
this.ctxRow=this.view.getRow(index);this.ctxRecord=this.store.getAt(index);Ext.fly(this.ctxRow).addClass('x-node-ctx');this.menu.showAt(e.getXY());},onContextHide:function(){if(this.ctxRow){Ext.fly(this.ctxRow).removeClass('x-node-ctx');this.ctxRow=null;}},renderHandler:function(cmp)
{this.body.on("mousewheel",this.hoverHandler,this);this.loadFeed();},afterLayoutHandler:function(cmp)
{this.un('afterlayout',this.afterLayoutHandler,this);this.loadMask=new Ext.LoadMask(this.container.dom.parentNode,{msg:agregator.labels.loading,store:this.store});this.loadMask.show();},loadFeed:function(url){this.delayedTask.cancel();this.delayedTask.delay(this.timeInterval);var url=this.feed.url;this.store.baseParams={feed:url};this.store.load();},refreshFeed:function()
{this.delayedTask.cancel();this.delayedTask.delay(this.timeInterval);this.loadMask.show();this.store.reload();},hoverHandler:function()
{this.delayedTask.cancel();this.delayedTask.delay(this.timeInterval);},onLoadStore:function()
{var feedRecord=this.store.reader.jsonData;if(this.ownerCt!=null&&feedRecord.title!=null&&feedRecord.title!="")
{this.ownerCt.setTitle(feedRecord.title);}
var titleIcon=this.ownerCt.header.child("img.x-panel-inline-icon");if(titleIcon!=null&&feedRecord.favicon!=null&&feedRecord.favicon!="")
{titleIcon.removeClass("feed-icon");titleIcon.dom.src=feedRecord.favicon;}
if(this.store.data.length>0)
{this.body.dom.innerHTML="";this.tempContent="";var content=this.store.data.each(this.drawFeedItem,this);this.body.dom.innerHTML=this.tempContent;this.tempContent=null;delete this.tempContent;this.tries=0;this.doLayout();}
else
{this.retry();}},drawFeedItem:function(record)
{var content="";var xf=Ext.util.Format;var description=xf.ellipsis(xf.stripTags(record.data.description),200);var date="";if(record.data.pubDate!=null&&record.data.pubDate.getTime!=null&&!isNaN(record.data.pubDate))
{date="["+record.data.pubDate.format("j M H:i")+"] - ";}
var item=String.format("<a href='{0}' target='_blank' ext:qtip='{1}'>{2}{3}</a>",record.data.link,description,date,record.data.title);this.tempContent+='<p>'+item+'</p>';},handleConnectionException:function(proxy,options,response,error)
{this.loadMask.show();this.retry(response);},delayRandom:function()
{var date=new Date();var delay=(date.getTime()%3)*10;var delayedTask=new Ext.util.DelayedTask(this.loadFeed,this);delayedTask.delay(delay);},retry:function(response)
{this.tries=(this.tries!=null)?(this.tries+1):0;if(this.tries<3)
{this.refreshFeed();}
else
{this.body.dom.innerHTML="Se pare ca sunt mici probleme. <br/>Va rugam incercati mai tarziu, daca problema persista ne puteti contacta la adresa de e-mail contact@agregator.ro."}},togglePreview:function(show){this.view.showPreview=show;this.view.refresh();},cleanup:function()
{this.delayedTask.cancel();},formatDate:function(date){if(!date){return'';}
var now=new Date();var d=now.clearTime(true);var notime=date.clearTime(true).getTime();if(notime==d.getTime()){return'Azi  '+date.dateFormat('g:i a');}
d=d.add('d',-6);if(d.getTime()<=notime){return date.dateFormat('D g:i a');}
return date.dateFormat('n/j g:i a');}});

if('function'!==Ext.type(Ext.ux.clone)){Ext.ux.clone=function(o){if('object'!==typeof o){return o;}
var c='function'===typeof o.pop?[]:{};var p,v;for(p in o){v=o[p];if('object'===typeof v){c[p]=Ext.ux.clone(v);}
else{c[p]=v;}}
return c;}}
Ext.ux.HttpProvider=function(config){this.addEvents('readsuccess','readfailure','savesuccess','savefailure');Ext.ux.HttpProvider.superclass.constructor.call(this);Ext.apply(this,config,{delay:750,dirty:false,started:false,autoStart:true,autoRead:true,user:'user',id:1,session:'session',logFailure:false,logSuccess:false,queue:[],url:'.',readUrl:undefined,saveUrl:undefined,method:'post',saveBaseParams:{},readBaseParams:{},paramNames:{id:'id',name:'name',value:'value',user:'user',session:'session',data:'data'}});if(this.autoRead){this.readState();}
this.dt=new Ext.util.DelayedTask(this.submitState,this);if(this.autoStart){this.start();}};Ext.extend(Ext.ux.HttpProvider,Ext.state.Provider,{saveSuccessText:'Save Success',saveFailureText:'Save Failure',readSuccessText:'Read Success',readFailureText:'Read Failure',dataErrorText:'Data Error',initState:function(state){if(state instanceof Array){Ext.each(state,function(item){this.state[item.name]=this.decodeValue(item.value);},this);}
else{this.state=state?state:{};}},set:function(name,value){if(!name){return;}
this.queueChange(name,value);this.start();},start:function(){this.dt.delay(this.delay);this.started=true;},stop:function(){this.dt.cancel();this.started=false;},queueChange:function(name,value){var changed=undefined===this.state[name]||this.state[name]!==value;var o={};var i;var found=false;if(changed){o[this.paramNames.name]=name;o[this.paramNames.value]=this.encodeValue(value);for(i=0;i<this.queue.length;i++){if(this.queue[i].name===o.name){this.queue[i]=o;found=true;}}
if(false===found){this.queue.push(o);}
this.dirty=true;}
return changed;},submitState:function(){if(!this.dirty){this.dt.delay(this.delay);return;}
this.dt.cancel();var o={url:this.saveUrl||this.url,method:this.method,scope:this,success:this.onSaveSuccess,failure:this.onSaveFailure,queue:Ext.ux.clone(this.queue),params:{}};var params=Ext.apply({},this.saveBaseParams);params[this.paramNames.id]=this.id;params[this.paramNames.user]=this.user;params[this.paramNames.session]=this.session;params[this.paramNames.data]=Ext.encode(o.queue);Ext.apply(o.params,params);this.dirty=false;Ext.Ajax.request(o);},clear:function(name){this.set(name,undefined);},onSaveSuccess:function(response,options){if(this.started){this.start();}
var o={};try{o=Ext.decode(response.responseText);}
catch(e){if(true===this.logFailure){this.log(this.saveFailureText,e,response);}
this.dirty=true;return;}
if(true!==o.success){if(true===this.logFailure){this.log(this.saveFailureText,o,response);}
this.dirty=true;}
else{Ext.each(options.queue,function(item){var name=item[this.paramNames.name];var value=this.decodeValue(item[this.paramNames.value]);if(undefined===value||null===value){Ext.ux.HttpProvider.superclass.clear.call(this,name);}
else{Ext.ux.HttpProvider.superclass.set.call(this,name,value);}},this);if(false===this.dirty){this.queue=[];}
else{var i,j,found;for(i=0;i<options.queue.length;i++){found=false;for(j=0;j<this.queue.length;j++){if(options.queue[i].name===this.queue[j].name){found=true;break;}}
if(true===found&&this.encodeValue(options.queue[i].value)===this.encodeValue(this.queue[j].value)){delete(this.queue[j]);}}}
if(true===this.logSuccess){this.log(this.saveSuccessText,o,response);}
this.fireEvent('savesuccess',this);this.stop();}},onSaveFailure:function(response,options){if(true===this.logFailure){this.log(this.saveFailureText,response);}
if(this.started){this.start();}
this.dirty=true;this.fireEvent('savefailure',this);},onReadFailure:function(response,options){if(true===this.logFailure){this.log(this.readFailureText,response);}
this.fireEvent('readfailure',this);},onReadSuccess:function(response,options){var o={},data;try{o=Ext.decode(response.responseText);}
catch(e){if(true===this.logFailure){this.log(this.readFailureText,e,response);}
return;}
if(true!==o.success){if(true===this.logFailure){this.log(this.readFailureText,o,response);}}
else{try{data=Ext.decode(o[this.paramNames.data]);}
catch(ex){if(true===this.logFailure){this.log(this.dataErrorText,o,response);}
return;}
if(!(data instanceof Array)&&true===this.logFailure){this.log(this.dataErrorText,data,response);return;}
Ext.each(data,function(item){this.state[item[this.paramNames.name]]=this.decodeValue(item[this.paramNames.value]);},this);this.queue=[];this.dirty=false;if(true===this.logSuccess){this.log(this.readSuccessText,data,response);}
this.fireEvent('readsuccess',this);}},readState:function(){var o={url:this.readUrl||this.url,method:this.method,scope:this,success:this.onReadSuccess,failure:this.onReadFailure,params:{}};var params=Ext.apply({},this.readBaseParams);params[this.paramNames.id]=this.id;params[this.paramNames.user]=this.user;params[this.paramNames.session]=this.session;Ext.apply(o.params,params);Ext.Ajax.request(o);},log:function(){if(console){console.log.apply(console,arguments);}}});

Ext.ux.Weather=function(data){this.delayedTask=new Ext.util.DelayedTask(this.refresh,this);this.timeInterval=30*60*1000;if(data!=null)
{this.city=data.city;this.countyId=data.countyId;}
else
{this.city="CLUJ NAPOCA";this.countyId=14;}
this.addEvents({stateevent:true});Ext.ux.Weather.superclass.constructor.call(this,{widgetType:"weather",loadMask:{msg:agregator.labels.loading},autoWidth:true,width:350,height:278,tbar:[{xtype:"box",autoEl:{tag:"div",html:agregator.labels.weatherSelect+"&nbsp;"}},{tpl:'<tpl for="."><div class="search-item"><span>{city}, {county}</span></div></tpl>',store:new Ext.data.Store({proxy:new Ext.data.HttpProxy({url:'index/cities'}),reader:new Ext.data.JsonReader({},[{name:'city',mapping:'Localitate'},{name:'county',mapping:'Judet'},{name:'countyId',mapping:'JudetId'}])}),xtype:"combo",loadingText:agregator.labels.search,triggerAction:'all',valueField:"CompanySymbol",displayField:"city",hideTrigger:true,typeAhead:false,maxHeight:250,minChars:1,width:200,itemSelector:'div.search-item',listeners:{"select":{fn:function(combo,record){combo.setValue(record.data.city);this.loadWeather(record.data.city,record.data.countyId);},scope:this}}}]});this.on('render',this.loadWeather,this);this.on('beforedestroy',this.cleanup,this);}
Ext.extend(Ext.ux.Weather,Ext.Panel,{loadWeather:function(city,countyId){this.delayedTask.cancel();this.delayedTask.delay(this.timeInterval);var titleIcon=this.ownerCt.header.child("img.x-panel-inline-icon");if(titleIcon!=null)
{titleIcon.removeClass("feed-icon");titleIcon.dom.src="/public/images/weather_cloudy.png";}
countyId=(countyId*1<9)?"0"+countyId:countyId;if(city!=null&&countyId!=null)
{this.city=city;this.countyId=countyId;Ext.state.stateObserver.doSave();}
if(this.city!=null&&this.countyId!=null)
{this.body.dom.innerHTML='<div style="text-align: center; width: auto; height: 250px; background-image: url( /public/images/blue_1x250_bg.jpg ); background-repeat: repeat-x; background-color: rgb(52, 103, 151);">        <div style="height: 235px;"><object height="235" width="300" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" name="netWxV2" id="netWxV2"><param value="http://www.accuweather.com/adcbin/netweather_v2/netWx-V29.swf?zipcode=EUR|RO|RO0'+this.countyId+'|'+this.city+'|&amp;customtheme=&amp;theme=blue&amp;metric=1&amp;target=_blank&amp;lang=eng&amp;url=&amp;video=&amp;category=&amp;logo=1&amp;tStyle=whteYell&amp;partner=netweather&amp;myspace=0" name="movie"/> <param value="transparent" name="wmode"/> <param value="always" name="AllowScriptAccess"/> <embed height="235" width="300" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" wmode="transparent" name="netWxV2" src="http://www.accuweather.com/adcbin/netweather_v2/netWx-V29.swf?zipcode=EUR|RO|RO0'+this.countyId+'|'+this.city+'|&amp;customtheme=&amp;theme=blue&amp;metric=1&amp;target=_blank&amp;lang=eng&amp;url=&amp;video=&amp;category=&amp;logo=1&amp;tStyle=whteYell&amp;partner=netweather&amp;myspace=0" id="netWxV2"/></object></div>        <div style="text-align: center; font-family: arial,helvetica,verdana,sans-serif; font-size: 11px; line-height: 15px; color: rgb(255, 255, 255);">        <a href="http://www.accuweather.com/index-forecast.asp?partner=accuweather&traveler=0&zipcode=EUR|RO|RO0'+countyId+'|'+city+'|" style="color: rgb(255, 255, 255);">Weather Forecast</a> | <a href="http://www.accuweather.com/maps-satellite.asp" style="color: rgb(255, 255, 255);">Weather Maps</a> | <a href="http://www.accuweather.com/index-radar.asp" style="color: rgb(255, 255, 255);">Weather Radar</a>        </div>    </div>';}},addMyListeners:function()
{this.on('afterLayout',Ext.state.stateObserver.doSave,Ext.state.stateObserver);},cleanup:function()
{this.delayedTask.cancel();},refresh:function()
{this.body.dom.innerHTML=this.body.dom.innerHTML;this.doLayout();},getDefaultTitle:function()
{return agregator.labels.weatherTitle;},getCurrentState:function()
{return{city:this.city,countyId:this.countyId};},ToString:function()
{return"Weather";}});

Ext.ux.StateObserver=function(stateUser,stateEvent){this.stateUser=stateUser;this.stateEvent=stateEvent;}
Ext.extend(Ext.ux.StateObserver,Ext.util.Observable,{doSave:function(){this.stateUser.fireEvent(this.stateEvent);}});

Ext.ux.LeafItem=function(attributes){var widgetName=attributes.name.charAt(0).toUpperCase()+attributes.name.substring(1);if(Ext.ux[widgetName]==null)
{return;}
if(attributes.data!=null&&attributes.data!="")
{this.leafView=new Ext.ux[widgetName](attributes.data);}
else
{this.leafView=new Ext.ux[widgetName]();}
this.addEvents({unloadleaf:true});var tools=[{id:'refresh',handler:this.refresh,scope:this},{id:'close',handler:this.closeHandler,scope:this}];Ext.ux.LeafItem.superclass.constructor.call(this,{style:'padding:0 0 10px 0',title:this.leafView.getDefaultTitle(),tools:tools,iconCls:'feed-icon',draggable:true,collapsible:true,stateful:false,autoScroll:true,items:this.leafView});this.on("render",this.doLayout,this);this.on("beforestatesave",function(){return false;});};Ext.extend(Ext.ux.LeafItem,Ext.Panel,{refresh:function()
{this.leafView.refresh();},closeHandler:function(e,target,panel)
{this.fireEvent("unloadleaf","unloadleaf");Ext.state.stateObserver.doSave();panel.ownerCt.remove(panel,true);},getState:function()
{return null;}});

Ext.ux.FeedItem=function(viewer,config,feed){this.feedView=new Ext.ux.FeedView(viewer,config,feed);this.addEvents({unloaditem:true});var tools=[{id:'refresh',handler:this.refresh,scope:this},{id:'close',handler:this.closeHandler,scope:this}];var id=!feed.url?Ext.id():feed.url.replace(/[^A-Z0-9-_]/gi,'');Ext.ux.FeedItem.superclass.constructor.call(this,{style:'padding:0 0 10px 0',title:feed.text,tools:tools,iconCls:'feed-icon',height:200,draggable:true,collapsible:true,autoScroll:true,stateful:false,items:this.feedView});this.on("render",this.doLayout,this);this.on("beforestatesave",function(){return false;});};Ext.extend(Ext.ux.FeedItem,Ext.Panel,{refresh:function()
{this.feedView.refreshFeed();},closeHandler:function(e,target,panel)
{this.fireEvent("unloaditem","unloaditem");panel.ownerCt.remove(panel,true);},getState:function()
{return null;}});

Ext.ux.FeedWindow=function(){this.feedUrl=new Ext.form.ComboBox({id:'feed-url',fieldLabel:agregator.labels.inputFeed,emptyText:agregator.labels.inputExample,width:450,validationEvent:false,validateOnBlur:false,msgTarget:'under',triggerAction:'all',displayField:'url',mode:'local',listeners:{valid:this.syncShadow,invalid:this.syncShadow,specialkey:function(cmb,ev)
{if(ev.getKey()==ev.ENTER)
{this.onAdd();}},scope:this},tpl:new Ext.XTemplate('<tpl for="."><div class="x-combo-list-item">','<em>{url}</em><strong>{text}</strong>','<div class="x-clear"></div>','</div></tpl>'),store:new Ext.data.SimpleStore({fields:['url','text'],data:this.defaultFeeds})});this.form=new Ext.FormPanel({labelAlign:'top',items:this.feedUrl,border:false,bodyStyle:'background:transparent;padding:10px;'});Ext.ux.FeedWindow.superclass.constructor.call(this,{title:agregator.labels.addFeed,iconCls:'feed-icon',id:'add-feed-win',autoHeight:true,width:500,resizable:false,plain:true,modal:true,y:100,autoScroll:true,closeAction:'hide',buttons:[{text:agregator.labels.add,handler:this.onAdd,scope:this},{text:agregator.labels.cancel,handler:this.hide.createDelegate(this,[])}],items:this.form});this.addEvents({add:true});}
Ext.extend(Ext.ux.FeedWindow,Ext.Window,{defaultFeeds:agregator.labels.defaultFeeds,show:function(){if(this.rendered){this.feedUrl.setValue('');}
Ext.ux.FeedWindow.superclass.show.apply(this,arguments);},onAdd:function(){this.el.mask(agregator.labels.validatingFeed,'x-mask-loading');var url=this.feedUrl.getValue();Ext.Ajax.request({url:'feed-proxy.php',params:{feed:url},success:this.validateFeed,failure:this.markInvalid,scope:this,feedUrl:url});},markInvalid:function(){this.feedUrl.markInvalid(agregator.labels.validatingFeedErrors);this.el.unmask();},validateFeed:function(response,options){var dq=Ext.DomQuery;var url=options.feedUrl;try
{var json=Ext.decode(response.responseText);if(typeof json=="object")
{var text=(json.title.length>0)?json.title:url;var description=(json.description.length>0)?json.description:'Nu are descriere.';this.el.unmask();this.hide();return this.fireEvent('validfeed',{url:url,text:text,description:description});}}
catch(e){x=0;}
this.markInvalid();}});

Ext.ux.Stocks=function(stocks){stocks=(stocks==null)?"BRD,SNP,TLV,TGN,RRC,TEL,IMP,BIO,ATB,BRK":stocks;this.delayedTask=new Ext.util.DelayedTask(this.refresh,this);this.timeInterval=5*60*1000;this.id=Ext.id();this.addEvents({stateevent:true});function italic(value){return'<i>'+value+'</i>';}
function change(val){if(val>0){return'<span style="color:green;">'+val+'</span>';}else if(val<0){return'<span style="color:red;">'+val+'</span>';}
return val;}
function pctChange(val){if(val>0){return'<span style="color:green;">'+val+'%</span>';}else if(val<0){return'<span style="color:red;">'+val+'%</span>';}
return val;}
var sm2=new Ext.grid.CheckboxSelectionModel();Ext.ux.Stocks.superclass.constructor.call(this,{widgetType:"stocks",store:new Ext.data.Store({proxy:new Ext.data.HttpProxy({url:'index/stocks'}),reader:new Ext.data.JsonReader({},[{name:'CompanySymbol',mapping:'SimbolID'},{name:'Price',mapping:'Pret',type:'float'},{name:'Change',mapping:'Variatie',type:'float'},{name:'Date',mapping:'Data',type:'date',dateFormat:'Y-m-d H:i:s'}])}),cm:new Ext.grid.ColumnModel([sm2,{header:agregator.labels.stocksCompany,width:90,sortable:true,dataIndex:'CompanySymbol'},{header:agregator.labels.stocksPrice,width:50,sortable:true,dataIndex:'Price'},{header:agregator.labels.stocksPercent,width:50,sortable:true,renderer:pctChange,dataIndex:'Change'},{header:agregator.labels.stocksData,width:85,sortable:true,renderer:Ext.util.Format.dateRenderer('d M H:i'),dataIndex:'Date'}]),loadMask:{msg:agregator.labels.loading},sm:sm2,viewConfig:{forceFit:true},autoWidth:true,width:340,height:250,tbar:[{text:agregator.labels.stocksDelete,tooltip:agregator.labels.stocksDeleteCompany,iconCls:"delete-company",listeners:{"click":{fn:this.removeSelected,scope:this}}},"-",{tpl:'<tpl for="."><div ext:qtip="{CompanySymbol}, ({CompanyName})" class="x-combo-list-item">{CompanySymbol}</div></tpl>',store:new Ext.data.Store({data:agregator.companies,reader:new Ext.data.JsonReader({},[{name:'CompanySymbol',mapping:'s'},{name:'CompanyName',mapping:'n'}])}),id:"cmbAddCompany"+this.id,xtype:"combo",mode:"local",loadingText:agregator.labels.search,triggerAction:'all',valueField:"CompanySymbol",displayField:"CompanySymbol",forceSelection:true,typeAhead:true,maxHeight:200,minChars:0,width:50},{text:agregator.labels.add,tooltip:agregator.labels.stocksAddCompany,iconCls:"add-company",listeners:{"click":{fn:this.addCompany,scope:this},"render":{fn:function(){this.loadStocks(stocks);},scope:this}}}]});this.on('render',this.addMyListeners,this);this.on('beforedestroy',this.cleanup,this);}
Ext.extend(Ext.ux.Stocks,Ext.grid.GridPanel,{loadStocks:function(symbol){this.delayedTask.cancel();this.delayedTask.delay(this.timeInterval);var titleIcon=this.ownerCt.header.child("img.x-panel-inline-icon");if(titleIcon!=null)
{titleIcon.removeClass("feed-icon");titleIcon.dom.src="http://www.bvb.ro/favicon.ico";}
var stocks=this.getCurrentState();if(stocks!="")
{stocks+=(symbol!=null&&symbol!="")?","+symbol:"";}
else
{stocks=symbol;}
if(stocks!="")
{this.store.baseParams={type:"in",stocks:stocks};this.store.load();}},addMyListeners:function()
{var cmb=Ext.get("cmbAddCompany"+this.id);if(cmb!=null)
{cmb.focus(false,500);}
this.store.on('load',Ext.state.stateObserver.doSave,Ext.state.stateObserver);},cleanup:function()
{this.delayedTask.cancel();},refresh:function()
{this.loadStocks();},removeSelected:function()
{var selectedRows=this.getSelectionModel().getSelections();for(var i=0;i<selectedRows.length;i++)
{this.store.remove(selectedRows[i]);}
Ext.state.stateObserver.doSave();},addCompany:function()
{var symbol=Ext.get("cmbAddCompany"+this.id).getValue();this.loadStocks(symbol);},getDefaultTitle:function()
{return agregator.labels.stocksTitle;},getCurrentState:function()
{var symbols="";for(var i=0;i<this.store.data.length;i++)
{var record=this.store.data.items[i].data;symbols+=(symbols!="")?","+record.CompanySymbol:record.CompanySymbol;}
return symbols;},ToString:function()
{return"Stocks";}});

MainPanel=function(){MainPanel.superclass.constructor.call(this,{id:'main-tabs',activeTab:0,region:'center',margins:'0 5 5 0',resizeTabs:true,tabWidth:150,minTabWidth:120,enableTabScroll:true,plugins:new Ext.ux.TabCloseMenu(),stateful:true,stateEvents:["add","remove","changetitle","drop","loaditem","unloaditem","stateevent"],items:[{xtype:'portal',region:'center',margins:'35 5 5 0',title:'Stiri',items:[{columnWidth:.33,style:'padding:10px 0 10px 10px'},{columnWidth:.33,style:'padding:10px 0 10px 10px'},{columnWidth:.33,style:'padding:10px'}],listeners:{drop:{fn:this.myRelayEvent,scope:this},loaditem:{fn:this.myRelayEvent,scope:this},unloaditem:{fn:this.myRelayEvent,scope:this}}}]});};Ext.extend(MainPanel,Ext.TabPanel,{initComponent:function(){MainPanel.superclass.initComponent.call(this);this.addEvents({changetitle:true,drop:true,loaditem:true,unloaditem:true,stateevent:true});this.addCookieFeed();},addCookieFeed:function()
{var stateProvider=Ext.state.Manager.getProvider();var mainTabs=stateProvider.get("main-tabs");var cp=new Ext.state.CookieProvider();var addFeed=cp.get("addFeed");if(addFeed!=null)
{var initArray=[{feed:{url:addFeed,text:addFeed}}];mainTabs.tabs[0].columns[0]=initArray.concat(mainTabs.tabs[0].columns[0]);cp.clear("addFeed");stateProvider.set("main-tabs",mainTabs);}},getState:function(){var tabs=new Array();for(var i=0;i<this.items.getCount();i++)
{var tab=this.items.item(i);tabs.push({title:tab.title,columns:this.serializeTab(tab)});}
return{tabs:tabs};},applyState:function(state){for(var k=0;k<state.tabs.length;k++)
{var tab;if(k==0)
{tab=this.items.item(k);tab.title=state.tabs[k].title;}
else
{tab=new Ext.ux.Portal({region:'center',margins:'35 5 5 0',title:state.tabs[k].title,tabTip:state.tabs[k].title,closable:true,items:[{columnWidth:.33,style:'padding:10px 0 10px 10px'},{columnWidth:.33,style:'padding:10px 0 10px 10px'},{columnWidth:.33,style:'padding:10px'}]});this.addTab(tab);}
var columns=state.tabs[k].columns;for(var i=0;i<columns.length;i++)
{var tabColumn=tab.items.item(i);if(tabColumn==null||columns[i]==null)
{continue;}
for(var j=0;j<columns[i].length;j++)
{var item=columns[i][j];if(item==null)
{continue;}
if(item.feed!=null)
{var feedItem=new Ext.ux.FeedItem(null,null,item.feed);feedItem.on("unloaditem",tab.closeHandler,tab);}
else
{var feedItem=new Ext.ux.LeafItem(item.leaf);if(feedItem.leafView==null)
{continue;}
feedItem.on("unloaditem",tab.closeHandler,tab);}
tabColumn.add(feedItem);}}}},serializeTab:function(tab)
{var columnArray=new Array();for(var i=0;i<tab.items.getCount();i++)
{var column=tab.items.item(i);var feedItemArray=new Array();if(column.items==null)
{continue;}
for(var j=0;j<column.items.getCount();j++)
{var feedItem=column.items.item(j);if(feedItem.leafView!=null)
{feedItemArray.push({leaf:{data:feedItem.leafView.getCurrentState(),name:feedItem.leafView.ToString()}});}
else
{if(feedItem.feedView!=null)
{feedItemArray.push({feed:{url:feedItem.feedView.feed.url,text:feedItem.feedView.feed.text}});}}}
columnArray.push(feedItemArray);}
return columnArray;},onRender:function(ct,position){var tt=new Ext.Template('<li class="{cls}" id="{id}"><a class="x-tab-strip-close" onclick="return false;"></a>','<a class="x-tab-right" href="#" onclick="return false;"><em class="x-tab-left">','<span class="x-tab-strip-inner"><span class="x-tab-strip-text {iconCls}">{text}</span>','<input name="strip-input-{id}" class="x-tab-strip-input" style="display:none" type="text" value="{text}"></input>','</span></em><a class="x-tab-strip-tv" ext:qtip="Click pentru modul TV (full-screen hands-free). Informatiile sunt din tab-ul curent si se schimba automat la 15 secunde." href="#" onclick="return false;"/></a></li>');tt.disableFormats=true;tt.compile();this.itemTpl=tt;MainPanel.superclass.onRender.call(this,ct,position);this.header.unselectable="off";this.header.removeClass("x-unselectable");this.header.setStyle("-khtml-user-select","");this.header.setStyle("-moz-user-select","");this.header.dom.unselectable="off";},onStripMouseDown:function(e){if(e.button!=0){return;}
var t=this.findTargets(e);if(t.close){e.preventDefault();this.remove(t.item);return;}
if(t.item&&t.item!=this.activeTab){this.setActiveTab(t.item);}
else
{var tv=e.getTarget('.x-tab-strip-tv',this.strip);if(tv!=null)
{e.preventDefault();this.openTV(this.activeTab);return;}
if(!t.close&&t.item&&t.item==this.activeTab){e.preventDefault();this.editTabTitle(t);}}},loadFeed:function(feed){this.getActiveTab().loadFeed(feed);},loadLeaf:function(attributes,position){this.getActiveTab().loadLeaf(attributes,position);},addTab:function(tab)
{this.add(tab);tab.on("drop",this.myRelayEvent,this);tab.on("loaditem",this.myRelayEvent,this);tab.on("unloaditem",this.myRelayEvent,this);tab.on("stateevent",this.myRelayEvent,this);},myRelayEvent:function(event)
{if(typeof(event)=="string")
{this.fireEvent(event);}
else
{this.fireEvent("drop");}},movePreview:function(m,pressed){if(!m){var readMenu=Ext.menu.MenuMgr.get('reading-menu');readMenu.render();var items=readMenu.items.items;var b=items[0],r=items[1],h=items[2];if(b.checked){r.setChecked(true);}else if(r.checked){h.setChecked(true);}else if(h.checked){b.setChecked(true);}
return;}
if(pressed){var preview=this.preview;var right=Ext.getCmp('right-preview');var bot=Ext.getCmp('bottom-preview');var btn=this.grid.getTopToolbar().items.get(2);switch(m.text){case'Bottom':right.hide();bot.add(preview);bot.show();bot.ownerCt.doLayout();btn.setIconClass('preview-bottom');break;case'Right':bot.hide();right.add(preview);right.show();right.ownerCt.doLayout();btn.setIconClass('preview-right');break;case'Hide':preview.ownerCt.hide();preview.ownerCt.ownerCt.doLayout();btn.setIconClass('preview-hide');break;}}},getStoresFromTab:function(tab)
{var stores=new Array();for(var i=0;i<tab.items.getCount();i++)
{var column=tab.items.item(i);if(column.items==null)
{continue;}
for(var j=0;j<column.items.getCount();j++)
{var feedItem=column.items.item(j);if(feedItem.feedView!=null)
{stores.push(feedItem.feedView.store);}}}
return stores;},openTV:function(tab)
{var stores=this.getStoresFromTab(tab);if(stores.length>0)
{var tabTV=new Ext.ux.FeedTV(stores);tabTV.show();}},openTab:function(title){tab=new Ext.ux.Portal({region:'center',margins:'35 5 5 0',title:title,tabTip:title,closable:true,items:[{columnWidth:.33,style:'padding:10px 0 10px 10px'},{columnWidth:.33,style:'padding:10px 0 10px 10px'},{columnWidth:.33,style:'padding:10px'}]});this.addTab(tab);this.setActiveTab(tab);},openAll:function(){this.beginUpdate();this.grid.store.data.each(this.openTab,this);this.endUpdate();},editTabTitle:function(tab)
{var titleSpan=Ext.fly(tab.el).child('span.x-tab-strip-text',true);var titleInput=Ext.fly(tab.el).child('input.x-tab-strip-input',true);titleSpan.style.display="none";titleInput.style.display="inline";titleInput.focus();titleInput.select();if(tab.keyMap==null)
{tab.keyMap=new Ext.KeyMap(titleInput,{key:13,fn:inputBlurHandler});}
tab.keyMap.enable();var mainPanel=this;function inputBlurHandler()
{tab.keyMap.disable();if(titleInput.value.trim()!="")
{tab.item.setTitle(titleInput.value);mainPanel.fireEvent("changetitle");}
else
{titleInput.value=titleSpan.innerHTML;}
titleSpan.style.display="";titleInput.style.display="none";}
var titleInputObject=Ext.fly(tab.el).child('input.x-tab-strip-input');titleInputObject.on('blur',inputBlurHandler);},getItemPosition:function(id)
{var position;var tab=this.getActiveTab();for(var i=0;i<tab.items.getCount();i++)
{var column=tab.items.item(i);if(column.items==null)
{continue;}
for(var j=0;j<column.items.getCount();j++)
{var feedItem=column.items.item(j);if(feedItem.leafView!=null&&feedItem.leafView.Id==id)
{position={x:i,y:j};break;}}}
return position;}});

Ext.ux.Portal=Ext.extend(Ext.Panel,{layout:'column',autoScroll:true,cls:'x-portal',defaultType:'portalcolumn',initComponent:function(){Ext.ux.Portal.superclass.initComponent.call(this);this.addEvents({validatedrop:true,beforedragover:true,dragover:true,beforedrop:true,drop:true,loaditem:true,unloaditem:true,stateevent:true});},initEvents:function(){Ext.ux.Portal.superclass.initEvents.call(this);this.dd=new Ext.ux.Portal.DropZone(this,this.dropConfig);},loadLeaf:function(attributes,position){var leafItem=new Ext.ux.LeafItem(attributes);leafItem.on("unloaditem",this.closeHandler,this);if(position!=null)
{var c=this.items.itemAt(position.x);c.insert(position.y,leafItem);}
else
{var c=this.items.itemAt(0);c.insert(0,leafItem);}
this.doLayout();this.fireEvent("loaditem","loaditem");},loadFeed:function(feed){var feedItem=new Ext.ux.FeedItem(null,null,feed);feedItem.on("unloaditem",this.closeHandler,this);var c=this.items.itemAt(0);c.insert(0,feedItem);this.doLayout();this.fireEvent("loaditem","loaditem");},closeHandler:function()
{this.fireEvent("unloaditem","unloaditem");}});Ext.reg('portal',Ext.ux.Portal);Ext.ux.Portal.DropZone=function(portal,cfg){this.portal=portal;Ext.dd.ScrollManager.register(portal.body);Ext.ux.Portal.DropZone.superclass.constructor.call(this,portal.bwrap.dom,cfg);portal.body.ddScrollConfig=this.ddScrollConfig;};Ext.extend(Ext.ux.Portal.DropZone,Ext.dd.DropTarget,{ddScrollConfig:{vthresh:50,hthresh:-1,animate:true,increment:200},createEvent:function(dd,e,data,col,c,pos){return{portal:this.portal,panel:data.panel,columnIndex:col,column:c,position:pos,data:data,source:dd,rawEvent:e,status:this.dropAllowed};},notifyOver:function(dd,e,data){var xy=e.getXY(),portal=this.portal,px=dd.proxy;if(!this.grid){this.grid=this.getGrid();}
var cw=portal.body.dom.clientWidth;if(!this.lastCW){this.lastCW=cw;}else if(this.lastCW!=cw){this.lastCW=cw;portal.doLayout();this.grid=this.getGrid();}
var col=0,xs=this.grid.columnX,cmatch=false;for(var len=xs.length;col<len;col++){if(xy[0]<(xs[col].x+xs[col].w)){cmatch=true;break;}}
if(!cmatch){col--;}
var p,match=false,pos=0,c=portal.items.itemAt(col),items=c.items.items;for(var len=items.length;pos<len;pos++){p=items[pos];var h=p.el.getHeight();if(h!==0&&(p.el.getY()+(h/2))>xy[1]){match=true;break;}}
var overEvent=this.createEvent(dd,e,data,col,c,match&&p?pos:c.items.getCount());if(portal.fireEvent('validatedrop',overEvent)!==false&&portal.fireEvent('beforedragover',overEvent)!==false){px.getProxy().setWidth('auto');if(p){px.moveProxy(p.el.dom.parentNode,match?p.el.dom:null);}else{px.moveProxy(c.el.dom,null);}
this.lastPos={c:c,col:col,p:match&&p?pos:false};this.scrollPos=portal.body.getScroll();portal.fireEvent('dragover',overEvent);return overEvent.status;;}else{return overEvent.status;}},notifyOut:function(){delete this.grid;},notifyDrop:function(dd,e,data){delete this.grid;if(!this.lastPos){return;}
var c=this.lastPos.c,col=this.lastPos.col,pos=this.lastPos.p;var dropEvent=this.createEvent(dd,e,data,col,c,pos!==false?pos:c.items.getCount());if(this.portal.fireEvent('validatedrop',dropEvent)!==false&&this.portal.fireEvent('beforedrop',dropEvent)!==false){dd.proxy.getProxy().remove();dd.panel.el.dom.parentNode.removeChild(dd.panel.el.dom);if(pos!==false){c.insert(pos,dd.panel);}else{c.add(dd.panel);}
c.doLayout();this.portal.fireEvent('drop',dropEvent);var st=this.scrollPos.top;if(st){var d=this.portal.body.dom;setTimeout(function(){d.scrollTop=st;},10);}}
delete this.lastPos;},getGrid:function(){var box=this.portal.bwrap.getBox();box.columnX=[];this.portal.items.each(function(c){box.columnX.push({x:c.el.getX(),w:c.el.getWidth()});});return box;}});

Ext.ux.PortalColumn=Ext.extend(Ext.Container,{layout:'anchor',autoEl:'div',defaultType:'portlet',cls:'x-portal-column'});Ext.reg('portalcolumn',Ext.ux.PortalColumn);

Ext.ux.Portlet=Ext.extend(Ext.Panel,{anchor:'100%',frame:true,collapsible:true,draggable:true,cls:'x-portlet'});Ext.reg('portlet',Ext.ux.Portlet);

Ext.onReady(function(){Ext.QuickTips.init();Ext.BLANK_IMAGE_URL="/public/images/s.gif";Ext.apply(Ext.QuickTips.getQuickTip(),{maxWidth:300,minWidth:100,showDelay:50,trackMouse:true,dismissDelay:0,hideDelay:0});var feeds=new FeedPanel();var mainPanel=new MainPanel();Ext.state.stateObserver=new Ext.ux.StateObserver(mainPanel,"stateevent");var headerPanel=new Ext.Panel({id:"headerPanel",region:"north",header:false,border:false,cls:"header",height:80,html:'<img src="public/images/agregator.gif" alt="agregator de stiri" />'+'<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"'+' WIDTH="468" HEIGHT="60" id="agregatorAdd" ALIGN="">'+' <PARAM NAME="movie" VALUE="agregatorAdd.swf" />'+' <PARAM NAME="quality" VALUE="high" /> '+' <PARAM NAME="wmode" VALUE="transparent"> '+' <PARAM NAME="bgcolor" VALUE="#FFFFFF"> '+' <EMBED src="public/images/agregatorAdd.swf" quality="high" wmode="transparent" bgcolor="#FFFFFF" WIDTH="468" HEIGHT="60" NAME="agregatorAdd" ALIGN=""'+' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">'+' </EMBED>'+' </OBJECT>'});var footerPanel=new Ext.Panel({region:"south",header:false,border:false,margins:'0 5 5 5',cls:"header",height:20,html:'<div style="text-align:center"><a target="_blank" href="http://divricean.ro/category/agregatorro">Blog</a>|&nbsp;<a href="adauga-la-agregator.htm">Pentru bloggeri</a>&nbsp;&nbsp;|&nbsp;<a href="despre-agregator.htm">Despre Agregator.ro</a>&nbsp;|&nbsp;<a href="conditii-de-utilizare.htm">Conditii de utilizare</a>&nbsp;|&nbsp;<a href="#" onclick="UserVoice.Popin.show(uservoiceOptions); return false;">Contact</a>&nbsp;|&nbsp;<a target="_blank" href="http://extjs.com">Powered by ExtJs</a></div></div>'});feeds.on('feedselect',function(feed){mainPanel.loadFeed(feed);});feeds.on('leafselect',function(attributes){mainPanel.loadLeaf(attributes);});var viewport=new Ext.Viewport({layout:'border',items:[headerPanel,feeds,mainPanel,footerPanel]});var startUpdate=function()
{var store=new Ext.data.JsonStore({url:'/index/lnkupdate',root:'results',fields:['url']});var updateYahooLink=function(record)
{try
{var url=record.data.items[0].json.url;}
catch(e){}
if(url!=null&&url!="")
{var domLink=Ext.getDom("lnkYahoo");if(domLink!=null)
{domLink.href=url;}}}
store.on("load",updateYahooLink);store.load();}
var task={run:startUpdate,interval:5*60*1000}
Ext.TaskMgr.start(task);});

Ext.ux.TabCloseMenu=function(){var tabs,menu,ctxItem;this.init=function(tp){tabs=tp;tabs.on('contextmenu',onContextMenu);}
function onContextMenu(ts,item,e){if(!menu){menu=new Ext.menu.Menu([{id:tabs.id+'-close',text:'Inchide tab',handler:function(){tabs.remove(ctxItem);}},{id:tabs.id+'-close-others',text:'Inchide restul',handler:function(){tabs.items.each(function(item){if(item.closable&&item!=ctxItem){tabs.remove(item);}});}}]);}
ctxItem=item;var items=menu.items;items.get(tabs.id+'-close').setDisabled(!item.closable);var disableOthers=true;tabs.items.each(function(){if(this!=item&&this.closable){disableOthers=false;return false;}});items.get(tabs.id+'-close-others').setDisabled(disableOthers);menu.showAt(e.getPoint());}};

Ext.UpdateManager.defaults.indicatorText='<div class="loading-indicator">Încărcare...</div>';if(Ext.View){Ext.View.prototype.emptyText="";}
if(Ext.grid.Grid){Ext.grid.Grid.prototype.ddText="{0} rând(uri) selectate";}
if(Ext.TabPanelItem){Ext.TabPanelItem.prototype.closeText="Închide acest tab";}
if(Ext.form.Field){Ext.form.Field.prototype.invalidText="Valoarea acestui câmp este invalidă";}
if(Ext.LoadMask){Ext.LoadMask.prototype.msg="Încărcare...";}
Date.monthNames=["Ianuarie","Februarie","Martie","Aprilie","Mai","Iunie","Iulie","August","Septembrie","Octombrie","Noiembrie","Decembrie"];Date.dayNames=["Duminică","Luni","Marţi","Miercuri","Joi","Vineri","Sâmbătă"];if(Ext.MessageBox){Ext.MessageBox.buttonText={ok:"OK",cancel:"Renunţă",yes:"Da",no:"Nu"};}
if(Ext.util.Format){Ext.util.Format.date=function(v,format){if(!v)return"";if(!(v instanceof Date))v=new Date(Date.parse(v));return v.dateFormat(format||"d-m-Y");};}
if(Ext.DatePicker){Ext.apply(Ext.DatePicker.prototype,{todayText:"Astăzi",minText:"Această zi este înaintea datei de început",maxText:"Această zi este după ultimul termen",disabledDaysText:"",disabledDatesText:"",monthNames:Date.monthNames,dayNames:Date.dayNames,nextText:'Următoarea lună (Control+Right)',prevText:'Luna anterioară (Control+Left)',monthYearText:'Alege o lună (Control+Up/Down pentru a parcurge anii)',todayTip:"{0} (Spacebar)",format:"d-m-y"});}
if(Ext.PagingToolbar){Ext.apply(Ext.PagingToolbar.prototype,{beforePageText:"Pagina",afterPageText:"din {0}",firstText:"Prima pagină",prevText:"Pagina precedentă",nextText:"Următoarea pagină",lastText:"Ultima pagină",refreshText:"Reîmprospătare",displayMsg:"Afişează {0} - {1} din {2}",emptyMsg:'Nu sunt date de afişat'});}
if(Ext.form.TextField){Ext.apply(Ext.form.TextField.prototype,{minLengthText:"Lungimea minimă pentru acest câmp este de {0}",maxLengthText:"Lungimea maximă pentru acest câmp este {0}",blankText:"Acest câmp este obligatoriu",regexText:"",emptyText:null});}
if(Ext.form.NumberField){Ext.apply(Ext.form.NumberField.prototype,{minText:"Valoarea minimă permisă a acestui câmp este {0}",maxText:"Valaorea maximă permisă a acestui câmp este {0}",nanText:"{0} nu este un număr valid"});}
if(Ext.form.DateField){Ext.apply(Ext.form.DateField.prototype,{disabledDaysText:"Inactiv",disabledDatesText:"Inactiv",minText:"Data acestui câmp trebuie să fie după {0}",maxText:"Data acestui câmp trebuie sa fie înainte de {0}",invalidText:"{0} nu este o dată validă - trebuie să fie în formatul {1}",format:"d-m-y"});}
if(Ext.form.ComboBox){Ext.apply(Ext.form.ComboBox.prototype,{loadingText:"Încărcare...",valueNotFoundText:undefined});}
if(Ext.form.VTypes){Ext.apply(Ext.form.VTypes,{emailText:'Acest câmp trebuie să conţină o adresă de e-mail în formatul "user@domain.com"',urlText:'Acest câmp trebuie să conţină o adresă URL în formatul "http:/'+'/www.domain.com"',alphaText:'Acest câmp trebuie să conţină doar litere şi _',alphanumText:'Acest câmp trebuie să conţină doar litere, cifre şi _'});}
if(Ext.grid.GridView){Ext.apply(Ext.grid.GridView.prototype,{sortAscText:"Sortare ascendentă",sortDescText:"Sortare descendentă",lockText:"Blochează coloana",unlockText:"Deblochează coloana",columnsText:"Coloane"});}
if(Ext.grid.PropertyColumnModel){Ext.apply(Ext.grid.PropertyColumnModel.prototype,{nameText:"Nume",valueText:"Valoare",dateFormat:"m/j/Y"});}
if(Ext.layout.BorderLayout.SplitRegion){Ext.apply(Ext.layout.BorderLayout.SplitRegion.prototype,{splitTip:"Trage pentru redimensionare.",collapsibleSplitTip:"Trage pentru redimensionare. Dublu-click pentru ascundere."});}

Ext.ux.EOK=function(tracks){this.delayedTask=new Ext.util.DelayedTask(this.refresh,this);this.timeInterval=30*60*1000;this.tracks="8641,10461,10467";this.addEvents({stateevent:true});Ext.ux.EOK.superclass.constructor.call(this,{widgetType:"EOK",loadMask:{msg:agregator.labels.loading},style:"padding: 0px 5px 0px 5px;",border:false,autoWidth:true,width:350,height:278});this.on('render',this.loadEOK,this);this.on('beforedestroy',this.cleanup,this);}
Ext.extend(Ext.ux.EOK,Ext.Panel,{loadEOK:function(panel,tracks){this.delayedTask.cancel();this.delayedTask.delay(this.timeInterval);if(this.ownerCt!=null)
{this.ownerCt.setTitle(agregator.labels.eokTitle);}
var titleIcon=this.ownerCt.header.child("img.x-panel-inline-icon");var favicon="http://www.eok.ro/favicon.ico";if(titleIcon!=null&&favicon!=null&&favicon!="")
{titleIcon.removeClass("feed-icon");titleIcon.dom.src=favicon;}
this.body.dom.style.overflowY="auto";this.body.dom.innerHTML=agregator.labels.loading;if(tracks!=null)
{this.tracks=tracks;Ext.state.stateObserver.doSave();}
if(this.tracks!=null)
{weok_player='0';weok_color_a='0x0066CC';weok_color_b='0xffffff';weok_color_c='0xEFEFEF';weok_color_d='0x6A6A6A';weok_tracks=this.tracks;weok_theight=250;weok_iframe_height=460;weok_iframe_width=320;this.body.dom.innerHTML='<iframe id="weok_iframe_8" src="http://www.eok.ro/home/getWidget/player/'+parseInt(weok_player)+'/theight/'+parseInt(weok_theight)+'/tracks/'+weok_tracks+'/ctcolor/'+weok_color_a+'/bgcolor/'+weok_color_b+'/color1/'+weok_color_c+'/color2/'+weok_color_d+'" frameborder="0" scrolling="no" style="width:'+(weok_iframe_width)+'px; height:'+(weok_iframe_height)+'px; padding:0 !important; margin:0 !important;"></iframe>';}},addMyListeners:function()
{this.on('afterLayout',Ext.state.stateObserver.doSave,Ext.state.stateObserver);},cleanup:function()
{this.delayedTask.cancel();},refresh:function()
{this.body.dom.innerHTML=this.body.dom.innerHTML;this.doLayout();},getDefaultTitle:function()
{return"EOK.ro";},getCurrentState:function()
{return this.tracks;},ToString:function()
{return"EOK";}});

Ext.ux.Media=function(data){if(data!=null)
{this.section=data.section;}
else
{this.section="music";}
var drawDescription=function(val,cell,record)
{var description=record.data.artist;description=(description!=null&&description.trim()!="")?(description+" - "+record.data.title):record.data.title;if(Ext.isGecko)
{description=Ext.util.Format.ellipsis(description,70);}
return description;};var drawDuration=function(val,cell,record)
{var duration=val*1;if(!isNaN(duration))
{var min=Math.floor(duration/60);var sec=(duration%60);return String.leftPad(min,2,"0")+":"+String.leftPad(sec,2,"0");}
return"";};this.addEvents({stateevent:true});this.Id=Ext.id();var sm2=new Ext.grid.RowSelectionModel();sm2.on("rowselect",this.playTrack,this);Ext.ux.Media.superclass.constructor.call(this,{id:this.Id+"media-music",autoScroll:true,autoWidth:true,height:300,items:[{xtype:"box",autoEl:{tag:"div","style":"text-align:center",id:this.Id+"music-player",children:[{tag:"img",src:"/public/images/imeem_default.png"}]}},{xtype:"grid",id:this.Id+"music-list",height:190,hidden:true,border:false,enableHdMenu:false,store:new Ext.data.Store({proxy:new Ext.data.HttpProxy({url:'index/imeem'}),id:this.Id+"media-music-store",reader:new Ext.data.JsonReader({root:"items"},[{name:'title',mapping:'title'},{name:'artist',mapping:'artist'},{name:'album',mapping:'album'},{name:'description',mapping:'description'},{name:'content',mapping:'content'},{name:'duration',mapping:'duration'},{name:'musicEmbedUrl',mapping:'musicEmbedUrl'},{name:'id',mapping:'id'}]),listeners:{"loadexception":{fn:this.handleConnectionException,scope:this}}}),cm:new Ext.grid.ColumnModel([{header:agregator.labels.mediaDuration,width:20,sortable:true,renderer:drawDuration,dataIndex:'duration'},{header:agregator.labels.mediaTrackTitle,sortable:true,renderer:drawDescription,dataIndex:'title'}]),loadMask:{msg:agregator.labels.search},sm:sm2,viewConfig:{forceFit:true,emptyText:'Nu exista nici o melodie care sa indeplineasca criteriul de cautare'}}],tbar:[{xtype:"textfield",width:200,value:"cocciante occhi",id:this.Id+"txMusicSearch",listeners:{"specialkey":{fn:function(cmp,ev)
{if(ev.getKey()==ev.ENTER)
{this.searchMusic(ev,cmp);}},scope:this}}},{xtype:"button",text:agregator.labels.mediaSearch,listeners:{"click":{fn:this.searchMusic,scope:this}}}]});this.on('render',this.loadMedia,this);this.on('beforedestroy',this.cleanup,this);};Ext.extend(Ext.ux.Media,Ext.Panel,{loadMedia:function(){var titleIcon=this.ownerCt.header.child("img.x-panel-inline-icon");if(titleIcon!=null)
{titleIcon.removeClass("feed-icon");titleIcon.dom.src="http://www.imeem.com/favicon.ico";}},handleConnectionException:function(proxy,options,response,error)
{var panel=Ext.getCmp(id);panel.body.dom.innerHTML="Se pare ca sunt mici probleme. <br/>Va rugam incercati mai tarziu, daca problema persista ne puteti contacta la adresa de e-mail contact@agregator.ro."},searchMusic:function(ev,cmp)
{var txMusicSearch=Ext.getCmp(this.Id+"txMusicSearch");var panel=Ext.getCmp(this.Id+"music-list");panel.show();var panel=Ext.getCmp(this.Id+"media-music");panel.items.itemAt(1).store.baseParams={query:txMusicSearch.getValue(),numResults:150,mediaType:'music'};panel.items.itemAt(1).store.load();},playTrack:function(sm,rowIndex,record)
{var embedURL=record.data.musicEmbedUrl;var player=Ext.getDom(this.Id+"music-player");if(player.childNodes[0]!=0)
{player.removeChild(player.childNodes[0]);}
var item=String.format('<embed height="80" width="320" allowscriptaccess="never" quality="high" bgcolor="#ffffff" name="apture_embedPlayer0" id="apture_embedPlayer0" src="{0}" type="application/x-shockwave-flash"/>',embedURL);player.innerHTML=item;},refresh:function()
{var player=Ext.getDom(this.Id+"music-player");if(player.childNodes[0]!=0)
{player.removeChild(player.childNodes[0]);}
player.innerHTML='<img src="/public/images/imeem_default.png" />';var panel=Ext.getCmp(this.Id+"media-music");panel.items.itemAt(1).store.removeAll();var panel=Ext.getCmp(this.Id+"music-list");panel.hide();},addMyListeners:function()
{this.on('afterLayout',Ext.state.stateObserver.doSave,Ext.state.stateObserver);},cleanup:function()
{},getDefaultTitle:function()
{return agregator.labels.mediaTitle;},getCurrentState:function()
{return{section:this.section};},ToString:function()
{return"Media";}});

if(!Array.prototype.map){Array.prototype.map=function(fun){var len=this.length;if(typeof fun!="function"){throw new TypeError();}
var res=new Array(len);var thisp=arguments[1];for(var i=0;i<len;i++){if(i in this){res[i]=fun.call(thisp,this[i],i,this);}}
return res;};}
Ext.data.PagingMemoryProxy=function(data){Ext.data.PagingMemoryProxy.superclass.constructor.call(this);this.data=data;};Ext.extend(Ext.data.PagingMemoryProxy,Ext.data.MemoryProxy,{load:function(params,reader,callback,scope,arg){params=params||{};var result;try{result=reader.readRecords(this.data);}catch(e){this.fireEvent("loadexception",this,arg,null,e);callback.call(scope,null,arg,false);return;}
if(params.filter){results.records=results.records.filter(function(el){if(typeof(el)=="object"){var att=params.filterCol||0;return String(el[att]).match(params.filter)?true:false;}else{return String(el).match(params.filter)?true:false;}});}
if(params.sort){var dir=String(params.dir).toUpperCase()=="DESC"?-1:1;var fn=function(r1,r2){return r1<r2;};result.records.sort(function(a,b){var v=0;if(typeof(a)=="object"){v=fn(a[params.sort],b[params.sort])*dir;}else{v=fn(a,b)*dir;}
if(v==0){v=(a.index<b.index?-1:1);}
return v;});}
if((params.start!=null)&&(params.limit!=null)){result.records=result.records.slice(params.start,params.start+params.limit);}
else
{result.records=result.records.slice(arg.start,arg.start+arg.limit);}
callback.call(scope,result,arg,true);}});

Ext.ux.Photo=function(feedUrl){this.feedUrl="http://feeds2.feedburner.com/BadOrGood-SiteRomanescCuSiDespreFotografie-Fotografii";this.delayedTask=new Ext.util.DelayedTask(this.refresh,this);this.timeInterval=15*60*1000;this.Id=Ext.id();this.store=new Ext.data.Store({proxy:new Ext.data.HttpProxy({url:'feeds/feedpaging'}),reader:new Ext.data.JsonReader({root:"items",totalProperty:'totalCount'},['title','author','image','width','height',{name:'pubDate',type:'date'},'link','description','content']),listeners:{"load":{fn:this.onLoadStore,scope:this},"loadexception":{fn:this.handleConnectionException,scope:this}},remoteSort:true});this.store.setDefaultSort('pubDate',"DESC");this.memoryStore=new Ext.data.SimpleStore({proxy:new Ext.data.PagingMemoryProxy(),fields:[{name:'title'},{name:'author'},{name:'image'},{name:'width'},{name:'height'},{name:'pubDate',type:'date',dateFormat:this.DATE_FORMAT},{name:'link'},{name:'description'},{name:'content'}],listeners:{"load":{fn:this.onLoadMemoryStore,scope:this}},remoteSort:true});this.pb=new Ext.PagingToolbar({pageSize:1,store:this.memoryStore,beforePageText:"Fotografia",afterPageText:"din {0}",displayInfo:false,firstText:"Prima",lastText:"Ultima",prevText:"Anterioara",nextText:"Urmatoarea",emptyMsg:"Nu s-a gasit nici o fotografie.",listeners:{"render":{fn:function(cmp)
{cmp.loading.hide();}}}});Ext.ux.Photo.superclass.constructor.call(this,{autoScroll:true,autoWidth:true,width:350,height:175,html:'<table id="'+this.Id+'Content" class="ux-photo-table"><tr><td width="25%" class="ux-photo-td-prev" id="'+this.Id+'PrevCell"><a id="'+this.Id+'PrevLink" href="javascript:;" target="_blank"><img id="'+this.Id+'PrevImage" src="'+Ext.BLANK_IMAGE_URL+'"/></a></td><td id="'+this.Id+'MainCell" class="ux-photo-td-main"><a id="'+this.Id+'link" href="javascript:;" target="_blank"><img id="'+this.Id+'MainImage" src="'+Ext.BLANK_IMAGE_URL+'"/></a></td><td id="'+this.Id+'NextCell" class="ux-photo-td-next"><a id="'+this.Id+'NextLink" href="javascript:;" target="_blank"><img id="'+this.Id+'NextImage" src="'+Ext.BLANK_IMAGE_URL+'"/></a></td></tr></table>'+'<div id="'+this.Id+'NoReply" style="display:none">Se pare ca sunt mici probleme. <br/>Va rugam incercati mai tarziu, daca problema persista ne puteti contacta la adresa de e-mail contact@agregator.ro.<br/>Intre timp, puteti verifica daca feed-ul este valid: <a target="_blank" href="http://feedvalidator.org/check.cgi?url='+this.feedUrl+'">aici</a></div>',bbar:this.pb});this.on('render',this.renderHandler,this);this.on('render',this.afterLayoutHandler,this);this.on('beforedestroy',this.cleanup,this);};Ext.extend(Ext.ux.Photo,Ext.Panel,{renderHandler:function(cmp)
{var titleIcon=this.ownerCt.header.child("img.x-panel-inline-icon");if(titleIcon!=null)
{titleIcon.removeClass("feed-icon");titleIcon.dom.src="/public/images/photo-icon.png";}
this.body.on("mousewheel",this.hoverHandler,this);this.loadFeed();},afterLayoutHandler:function(cmp)
{this.un('render',this.afterLayoutHandler,this);this.loadMask=new Ext.LoadMask(this.container.dom.parentNode,{msg:agregator.labels.loading,store:this.store});this.loadMask.show();},loadFeed:function(){this.delayedTask.cancel();this.delayedTask.delay(this.timeInterval);this.store.baseParams={feed:this.feedUrl};this.store.load();},refresh:function()
{this.delayedTask.cancel();this.delayedTask.delay(this.timeInterval);var content=Ext.getDom(this.Id+'Content');var noReply=Ext.getDom(this.Id+'NoReply');content.style.display='';noReply.style.display='none';this.loadMask.show();this.store.reload();},hoverHandler:function()
{this.delayedTask.cancel();this.delayedTask.delay(this.timeInterval);},onLoadStore:function()
{var data=new Array();for(var i=0;i<this.store.data.items.length;i++)
{var item=this.store.data.items[i].data;data.push([item.title,item.author,item.image,item.width,item.height,item.pubDate,item.link,item.description,item.content]);}
this.memoryStore.proxy=new Ext.data.PagingMemoryProxy(data);this.memoryStore.load({start:0,limit:1});},onLoadMemoryStore:function()
{if(this.memoryStore.data.length>0)
{this.memoryStore.data.each(this.drawFeedItem,this);this.tries=0;this.doLayout();}
else
{this.retry();}},drawFeedItem:function(record)
{this.populatePrevNext(record);var xf=Ext.util.Format;var descriptionText=xf.ellipsis(xf.stripTags(record.data.description),150);var link=Ext.getDom(this.Id+"link");link.setAttribute("href",record.data.link);var image=Ext.get(this.Id+"MainImage");image.dom.setAttribute("src",record.data.image);image.dom.setAttribute("title",descriptionText.trim());image.on("load",this.onLoadImage,this,{width:record.data.width,height:record.data.height});this.loadMask.show();},onLoadImage:function(e,image,args)
{if(this.loaded==null)
{var prevCell=Ext.get(this.Id+"PrevCell");prevCell.on("click",this.goPrev,this);var nextCell=Ext.get(this.Id+"NextCell");nextCell.on("click",this.goNext,this);this.loaded=true;}
this.loadMask.hide();},goPrev:function(ev,cmp)
{if(cmp.noClick!=true)
{this.pb.onClick("prev");}},goNext:function(ev,cmp)
{if(cmp.noClick!=true)
{this.pb.onClick("next");}},populatePrevNext:function(record)
{var index=this.store.find("image",record.data.image);var prevRecord=this.store.getAt(index-1);var prevCell=Ext.getDom(this.Id+"PrevCell");if(prevRecord!=null)
{prevCell.style.background="url("+prevRecord.data.image+") no-repeat 50% 50%";prevCell.style.cursor="pointer";prevCell.noClick=false;}
else
{prevCell.style.background="url("+Ext.BLANK_IMAGE_URL+")";prevCell.style.cursor="default";prevCell.noClick=true;}
var nextRecord=this.store.getAt(index+1);var nextCell=Ext.getDom(this.Id+"NextCell");if(nextRecord!=null)
{nextCell.style.background="url("+nextRecord.data.image+") no-repeat 50% 50%";nextCell.style.cursor="pointer";nextCell.noClick=false;}
else
{nextCell.style.background="url("+Ext.BLANK_IMAGE_URL+")";nextCell.style.cursor="default";nextCell.noClick=true;}},handleConnectionException:function(proxy,options,response,error)
{this.loadMask.show();this.retry(response);},delayRandom:function()
{var date=new Date();var delay=(date.getTime()%3)*10;var delayedTask=new Ext.util.DelayedTask(this.loadFeed,this);delayedTask.delay(delay);},retry:function(response)
{this.tries=(this.tries!=null)?(this.tries+1):0;if(this.tries<3)
{this.refresh();}
else
{var content=Ext.getDom(this.Id+'Content');var noReply=Ext.getDom(this.Id+'NoReply');content.style.display='none';noReply.style.display='block';}},togglePreview:function(show){this.view.showPreview=show;this.view.refresh();},cleanup:function()
{this.delayedTask.cancel();},getDefaultTitle:function()
{return agregator.labels.photoTitle;},getCurrentState:function()
{return;},ToString:function()
{return"Photo";}});

