Ext.ns('Ext.ux');

Ext.ux.Global = Ext.extend(Ext.util.Observable, {

			constructor : function() {

				if (Ext.get('img-subline') != null) {
					Ext.get('img-subline').setOpacity(0.7);
				}

				Ext.select("a.imgmover").each(function(el) {
					el.on("mouseover", function(e) {
								if (Ext.get(e.target).up("a")) {
									Ext.get(e.target).up("a")
											.addClass('imgmoverh');
								}
							});
				});

				Ext.select("a.imgmover").each(function(el) {
					el.on("mouseout", function(e) {
								if (Ext.get(e.target).up("a")) {

									Ext.get(e.target).up("a")
											.removeClass('imgmoverh');
								}
							});
				});

				Ext.select('a').each(function(el) {

							el.on("focus", function(e) {

										Ext.get(e.target).blur();
									});
						});

				var maxHi = 0;
				Ext.select('div.matrixelement-content').each(function(el) {

					maxHi = el.getHeight() > maxHi
							? maxHi = el.getHeight()
							: maxHi = maxHi;

				});

				Ext.select('.index div.matrixelement-content').each(
						function(el) {
							el.setStyle({
										height : (maxHi - 10) + 'px'
									})

						});

				var versatzt = 0;
				Ext.select(".mainnav ul ul li a").each(function(el) {
							el.hide();

							versatzt = versatzt + 1;
							el.fadeIn({
										duration : versatzt
									});
						});
			}
		});
		
		
		Ext.ux.RemainingChars = Ext.extend(Ext.util.Observable, {

			constructor : function(el, elo, maxchars, text) {
				

				this.el = Ext.get(el);
				this.elo = Ext.get(elo);
				this.maxchars = parseInt(maxchars);
				this.text = text;
				
				
				this.el.update(String.format(this.text,this.maxchars-this.elo.getValue().length));
				
				
				Ext.get(elo).on("keyup", function(ev) {

					if (this.elo.getValue().length > this.maxchars) {
						this.elo.dom.value = this.elo.getValue().substring(0,
								this.maxchars);
					
					}
					this.el.update(String.format(this.text,this.maxchars-this.elo.getValue().length));
						

				}, this);
			}

		});

