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();
									});
						});
			
				Ext.select('a.videoclick').each(function(el) {

							el.on("click", function(ev) {
										
										Ext.select('div.video').each(function(el) {
											
												 Ext.get(el).setStyle({display:'none'});
										});
										
								
								
                    Ext.get(ev.target.id + '_v').setStyle({display:'block'});

									});
						});
			
						
						
						
						
						
						
				var maxHi = 0;
				Ext.select('div.indexitem').each(function(el) {

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

				});
				
				

				Ext.select('div.indexitem').each(function(el) {
							el.setStyle({
										height : (maxHi+10) + 'px'
									})

						});

			}

		});
		
		
		
			Ext.onReady(function(){
			
			    Ext.ux.extbox.register('a.lightbox', true, {
			        maxWidth: '90%',
			        maxHeight: '90%',
			        overlayOpacity: 0.8,
			        overlayDuration: 0.1
			    });
			    Ext.ux.extbox.register('a.w1', false, {
			        width: 900,
			        height: 500,
			        iframe: true
			    });
			    
			    
			    
			    if (Ext.get('images') != null) {
			    
			        new Ext.ux.Carousel('images', {
			            itemSelector: 'img',
			            interval: 6,
			            transitionDuration: 5,
			            autoPlay: true,
			            showPlayButton: false,
			            pauseOnNavigate: true,
			            freezeOnHover: true,
			            transitionType: 'blend',
			            hideNavigation: true
			        });
			    }
			    
			    new Ext.ux.Header('kopfbild');
			    new Ext.ux.Hotelauswahl('header');
			    new Ext.ux.Global();
			
			
	
			    FB.init({
			        appId: '78ff3b4a9ce6f5021754a1fc7d5ecbbe',
			        status: true, // check login status
			        cookie: true, // enable cookies to allow the server to access the session
			        xfbml: true // parse XFBML
			    });
			});

