var animations = {

	// Config ////////////////////////////////////////////////

	config : {
	
		target: '#pagecontent',
		targetHeight: 0,
		currrentPageID: 0,
		
		mouseX: 0,
		mouseY: 0,
		
		navigation : {
			id : '#navigation',
			active : 'nav_active'
		},
		
		animation : {
			speed : 1500,
			loaderSpeed: 300
		},
		
		content : {
			id : '.maincontent',
			width: 850,
			exist: false,
			toggled: false,
			height: 0,
			ready: false,
			hasContent: false
		},
		
		content_info : {
			id: '.content_info'
		},
		
		content_meta : {
			id: '.content_meta'
		},
		
		subcontent : {
			id : '#subcontent'
		},
		
		weather: {
			id: '.weather'
		},
		
		platznavi: {
			id: '#platznavi'
		},
		
		images: {
			cur: 0,
			count: false,
			holder: new Array(),
			preHolder: new Array(),
			loaded:true,
			elements: new Array(),
			slideshow: {
				pageID: false,
				images: new Array(),
				claims: new Array(),
				enabled: false,
				timer: 8000,
				cur: 0,
				timeout: false
			}
		},
		
		//aktuell angezeigte elemente der website
		current : {
			navigation : false,				//subnavi
			subcontent : false,				//unterer contentbereich unter der subnavi
			elements : {					//elemente im hauptbereich über dem großen hintergrundbild
				maincontent : false,				//hauptcontent im hellen DIV
				weather: false,						//wetterbox auf startseite
				platznavi: false,
				flynavi: false					// Schwebende Navi für Platzklasse
			}
		}
	},
	
	// Contencontainer ///////////////////////////////////////
	
	resizeContainer : function(sub) {
		tools.log('subcontent:' + this.config.current.subcontent);
		tools.log('navi:' + this.config.current.navigation);
		
		var window = background.returnWindowSize().height;
		var pageContent_size = 0;
		var mainContent_size = 0;
		var subtra = 0;
		
		//abzüge für #pagecontent berechnen
		if(this.config.current.subcontent) 	subtra += 190;
		if(this.config.current.navigation) 	subtra += 30;
											subtra += 60;		

		this.config.targetHeight = background.returnWindowSize().height - subtra;
		this.config.content.height = this.config.targetHeight - 60;
		
		//höhe von #pagecontent setzen
		$(this.config.target).stop().animate(
			{height: animations.config.targetHeight}, 
			this.config.animation.speed, 
			'swing',
			function() {
				animations.resizeMainContent();
			}
		);
	},
	
	resizeMainContent: function() {
		//scrollpanes entfernen
		

		
			animations.removeScrollpanes();
			
			var left_height = $('.left').outerHeight(true);
			var right_height = $('.right').outerHeight(true);
			var contentInnerHeight = $('.content_info_inner').outerHeight(true);
			
			tools.log('left: '+left_height);
			tools.log('right: '+right_height);
			tools.log('total: '+contentInnerHeight);
			
			if(contentInnerHeight < left_height) contentInnerHeight = left_height;
			if(contentInnerHeight < right_height) contentInnerHeight = right_height;
			
			//abzüge für .maincontent berechnen
			var subtra = 30;		//höhe .maincontent .content_head
			
			var metaElement = jQuery(animations.config.content.id+' '+animations.config.content_meta.id);
			
			tools.log(metaElement);
	
			if (metaElement.length > 0) {
				var metaHeight = metaElement.outerHeight(true);
				subtra += metaHeight;
			}
			
			var mainContent_size = animations.config.content.height - subtra;
			
			tools.log('targetHeight:' + animations.config.targetHeight);
			tools.log('mainContent:' + mainContent_size);
			
			//höhe von .maincontent setzen
			/*$(this.config.content.id+' '+this.config.content_info.id).stop().animate({
				height: mainContent_size
			}, this.config.animation.speed, 'swing', function() { animations.initScrollpanes(); });*/
			
			var mainContent_paddingTop = parseInt($(animations.config.content_info.id).css('paddingTop'));
			var mainContent_paddingBottom = parseInt($(animations.config.content_info.id).css('paddingBottom'));		
			var padding = mainContent_paddingTop + mainContent_paddingBottom;
			
			mainContent_size = mainContent_size - padding;		
			
			tools.log('contentInnerHeight: '+contentInnerHeight);
			tools.log('mainContent_size: '+mainContent_size);
					
			if(contentInnerHeight > mainContent_size) {
				$(animations.config.content.id+' '+animations.config.content_info.id).stop().animate(
					{height: (mainContent_size) + 'px'},
					animations.config.animation.speed, 
					'swing', 
					function() { 
					
						if((contentInnerHeight-30) > mainContent_size) {
							animations.initScrollpanes();
						}
					}
				);
			} else {
				$(animations.config.content.id+' '+animations.config.content_info.id).stop().animate(
					{height: contentInnerHeight + 'px'}
				);
			}

	},
	
	initScrollpanes: function() {
		tools.log('animations.initScrollpanes()');
		
		jQuery('.scrollpane').jScrollPane({
			scrollbarMargin: 30,
			scrollbarWidth: 10,
			topCapHeight: 15,
			bottomCapHeight: 15
		});
	},	
	
	removeScrollpanes: function() {
		tools.log('animations.removeScrollpanes()');
		
		jQuery('.scrollpane').jScrollPaneRemove();
	},	

	// Loader ////////////////////////////////////////////////
	
	showLoader : function() {
		$('.loader').animate({
			left: 0
		},this.config.animation.loaderSpeed);		
	},	
	
	hideLoader : function() {
		if(this.config.images.loaded) {
			$('.loader').animate({
				left: -103
			}, this.config.animation.loaderSpeed);
		}
	},
	
	// Subnavigation ////////////////////////////////////////
	
	showSubnavi: function(id) {
	
		// fahre die Navi hoch
		$('#navigation').animate({
			height: 60,
			top: -60
		}, this.config.animation.speed);
		
		// blende die Navi ein
		$('li.'+id+' ul').fadeIn(this.config.animation.speed);
		
	},
	
	hideSubnavi: function() {
	
			//fahre die navi runter (subnavi wird versteckt)
			$('#navigation').animate({
				height: 30,
				top: -30
			}, this.config.animation.speed);
			
			//blende die subnavi aus
			$('li.'+this.config.current.navigation+' ul').fadeOut(this.config.animation.speed);
	
	},
	
	fadeSubnavi: function(id) {
		tools.log('subnav fade');
		
		$('li.'+this.config.current+' ul').css({display:'none'});
		$('li.'+id+' ul').css({display:'block'});
		// Blende alte Subnavi aus
		/*$('li.'+this.config.current+' ul').fadeOut(this.config.animation.speed, function() {
			//und blende die neue subnavi ein
			$('li.'+id+' ul').fadeIn(animations.config.animation.speed);
		});*/
	},
	
	toggleSubnav: function(id) {
		
		//wenn es unterseiten gibt
		if($('li.'+id).children('ul').size() > 0) {		
			
			//wenn die subnavi bereits sichtbar ist
			if(this.config.current.navigation) {
				
				this.fadeSubnavi(id);
								
			} else {
				
				this.showSubnavi(id);
			}
			
			//aktuelle subnavi merken
			this.config.current.navigation = id;
		
		// wenn ich mich auf Unterseite befinde		
		} else if($('li.'+id).parent('ul').hasClass('sub')) {
			tools.log('hier is subnav');
			
			if(!this.config.current.navigation) {
				var parent_id = parseInt($('li.'+id).parent('ul').parent('li').attr('class'));
				this.showSubnavi(parent_id);
				this.config.current.navigation = id;
			}			
			
		// wenn es keine Unterseiten gibt
		} else {
			
			this.hideSubnavi();
			
			// aktuelle Subnavi zurücksetzen
			this.config.current.navigation = false;		
		}
		
		this.resizeContainer();		
	},
	
	// Bilderwechsel ////////////////////////////////////////
	
	attachImage: function(imgObject) {
	
		$('#background').append(imgObject);
		tools.log('append to body ('+(imgObject)+')');
		
	},
	
	fadeOutImage: function(id) {
		$('.bg_img:not(.page'+id+')').fadeOut(this.config.animation.speed, function() { $(this).remove(); });
		//tools.log('Image fadeOut');
	},
	
	fadeInImage: function(id) {
		$('.bg_img.page'+id).fadeIn(this.config.animation.speed);
		//tools.log('Image fadeIn');
	},
	
	processImageReplace: function() {
	
		// Die geladenen Bilder zum DOM hinzufügen
		for(var i in animations.config.images.holder) {
			animations.attachImage(animations.config.images.holder[i]);
		}
					
		//blende alle hintergründe aus, die nicht zur aktuellen seite passen
		animations.fadeOutImage(animations.config.currentPageID);
		
		//blende alle hintergründe der aktuellen seite ein
		animations.fadeInImage(animations.config.currentPageID);
		
		//berechne die größen der hintergründe (für scrolling)
		background.setSize();
		
		// Wenn Slideshow enabled starte Slideshow
		if(animations.config.images.slideshow.enabled) {
			tools.log('starte Slideshow');
			animations.config.images.slideshow.cur = 0;
			animations.config.images.slideshow.timeout = setTimeout(function() {
				animations.changeImage();
			}, animations.config.images.slideshow.timer);
		} else {
			tools.log('stoppe Slideshow');
		}	
		
	},
	
	toggleImage: function(obj, id, autoSlideshow) {
		
		// default vars zurücksetzen
		this.config.images.cur = 0;
		this.config.images.loaded = false;
		this.config.images.holder = new Array();
		this.config.images.elements = new Array();
		this.config.images.preHolder = new Array();
		this.config.images.slideshow.cur = 0;
		this.config.images.slideshow.images = new Array();
		clearTimeout(this.config.images.slideshow.timeout);
		
		animations.removeClaim();
				
		var imageCount = obj.length;
		
		// alle imageObjects registrieren
		for(var i=0; i<imageCount; i++) {
			animations.config.images.elements.push(obj[i]);	
			animations.config.images.preHolder.push(window.location.protocol+'//'+window.location.host+obj[i].resizedImage);
		}
		
		// Request PageID speichern für das ausblenden alter Bilder
		animations.config.currentPageID = id;	
		
		// das erste imageObject laden und anzeigen		
		var defaultImageObject = obj[0];
		
		// Anzahl der aufeinmal zu ladenden Bildern
		if(defaultImageObject.claimImage != false) {
			this.config.images.count = 2;
		} else {
			this.config.images.count = 1;
		}		
		
		// Prüfen ob Bild nicht bereits vorhanden ist
		//if($("img[class*='"+defaultImageObject.layer+"']#"+defaultImageObject.imageID).size() < 1) {		
			animations.loadImage(defaultImageObject);								
		//}
		
		// Preload Claim Grafik wenn vorhanden
		if(defaultImageObject.claimImage != false) {
			animations.loadClaim(defaultImageObject.claimImage);
		}
			
		
		// wenn gestetzt, automatische Slideshow aktivieren
		if(autoSlideshow) {
		
			animations.config.images.slideshow.enabled = true;
				
			animations.imageObjectTimeout();
			//animations.config.images.loaded = true;
			//animations.hideLoader();
		} else {
			animations.config.images.slideshow.enabled = false;
			clearTimeout(animations.config.images.slideshow.timeout);
		}
		
		// Prüfen ob ein Claim vorhanden ist		
		
		
		//durchlaufe alle hintergrundebenen		
		/*for(var key in obj) {
			
			if(obj[key] != '') {
				
				// Wenn in e2 mehre Bilder dann aktiviere eine Slideshow
				if(key == 'e2' && tools.is_array(obj[key])) {
									
					animations.config.images.slideshow.enabled = false;
					animations.config.images.slideshow.pageID = id;
					
					// Slideshow Bilder im Array speichern
					var imgArray = obj[key];
					for(var i in imgArray) {
						animations.config.images.slideshow.images.push(imgArray[i]);
						animations.config.images.preHolder.push(window.location.protocol+'//'+window.location.host+imgArray[i].path);
					}
					
					pageID = id;
					imgLayer = key;
					imgPath = imgArray[0].path;
					imgID = imgArray[0].id;
				
				// Wenn nur ein Bild dann deaktiviere Slideshow
				} else {
					
					if(key == 'e2') {				
						// Slideshow deaktivieren
						animations.config.images.slideshow.enabled = false;
						animations.config.images.slideshow.images = new Array();
					}
					
					animations.config.images.preHolder.push(window.location.protocol+'//'+window.location.host+obj[key].path);
				
					pageID = id;
					imgLayer = key;
					imgPath = obj[key].path;
					imgID = obj[key].id;
				};
			
				//pics[obj.key] = new Object();
							
				
				// Prüfen ob Bild schon vorhanden ist
				if($("img[class*='"+imgLayer+"']#"+imgID).size() < 1) {
				
					// Wenn nein, erstelle ein neues Img-Object
					//newPic = new Image();
					img = new Image();
					img.id = imgID;
					$(img).css({display: 'none'});
					$(img).addClass('bg_img');
					$(img).addClass(imgLayer);
					$(img).addClass('page'+pageID);					
					//newPic = animations.createImage(imgPath, imgLayer, pageID, imgID);
					img.onload = function() {
						tools.log('img.path: '+this.src);
						if(tools.in_array(animations.config.images.preHolder, this.src)) { // Prüfen ob das zu ladende Bild noch aktuell ist
							animations.imgLoaded(this)
						}
					};
					
					img.src = imgPath;
										
				} else {
					if(animations.config.images.slideshow.images.length > 0) {
						animations.config.images.slideshow.timeout = setTimeout(function() {
							animations.changeImage();
						}, animations.config.images.slideshow.timer);
					}
					animations.config.images.loaded = true;
					animations.hideLoader();
				}
									
			}
		}*/
	},
	
	imgLoaded: function(image, index) {		
		
		if(image) {
		
			// Festlegen des Bildverhaltnisses
			if($(image).hasClass('e2')) {
				background.img.ratio = (image.height / image.width).toPrecision(4);
			};
				
			// Das Image-Object im Array halten
			animations.config.images.holder.push(image);
			
		}		
		
		// Wenn alle Bilder geladen sind, dann die Animationen ausführen
		if(animations.config.images.cur == (animations.config.images.count-1)) {
			animations.processImageReplace();
			animations.config.images.loaded = true;
			animations.config.images.count = false;
			animations.config.images.cur = 0;
			animations.config.images.holder = new Array();
			animations.hideLoader();			
			
			return true;
		}
		
		animations.config.images.cur++;
		tools.log('img.loaded '+(animations.config.images.cur+1)+'/'+animations.config.images.count);
	},
	
	loadImage: function(imageObject) {		
		
		var img = new Image();
			img.id = imageObject.imageID;
			
			$(img).css({display: 'none'});
			$(img).addClass('bg_img');
			$(img).addClass(imageObject.layer);
			$(img).addClass('page'+imageObject.pageID);	
			
			img.onload = function() {
				
				if(typeof(console) != 'undefined') {
					console.log(this);
					console.log(animations.config.images.elements.indexOf(imageObject));					
				}
				
				tools.log('bild geladen');
				//if(tools.in_array(animations.config.images.preHolder, this.src)) { // Prüfen ob das zu ladende Bild noch aktuell ist
					animations.imgLoaded(this, animations.config.images.elements.indexOf(imageObject));
				//}
			}
			
			img.src = imageObject.resizedImage;		
	},
	
	loadClaim: function(path) {
		var claim = new Image();
			claim.onload = function() {
				animations.imgLoaded();
			}
			claim.src = path;			
	},
	
	createImage: function(imageObject, callback) {
		img = new Image();
		img.id = imageObject.imageID;
		$(img).css({display: 'none'});
		$(img).addClass('bg_img');
		$(img).addClass(imageObject.layer);
		$(img).addClass('page'+imageObject.pageID);		

		/*img.onload = function() {animations.imgLoaded(img)};*/
		/*} else {*/
			img.onload = function() {	
							
				animations.config.images.loaded = true;
				animations.hideLoader();
				animations.attachImage(this);
				$(this).fadeIn(animations.config.animation.speed);
				//$(this).css({display: 'block'});
				background.setSize();
				
				$('.bg_img.e2:not(#'+this.id+')').each(function() {
					$(this).fadeOut(animations.config.animation.speed, function() {
						$(this).remove();
					});
				});
				
				if(imageObject.claimImage != false) {
					//animations.showClaim(imageObject.claimMarkup, imageObject.claimID);
					xajax_fetchClaim(imageObject.claimID);
				} else {
					animations.removeClaim();
				}
				
				// Wenn automatische Slideshow aktiviert, führe Slideshow fort
				if(animations.config.images.slideshow.enabled) {
					animations.imageObjectTimeout();
				}
			}
		/*}*/
		img.src = imageObject.resizedImage;
		
		return img;
	},
	
	// SLIDESHOW
	
	createImageNavigation: function(start) {
		
		if(start) {
			$(this.config.target).append('<div id="imagebrowser" class="startseite"><a title="vorheriges Bild" class="prev button"></a><a title="nächstes Bild" class="next button"></a></div>');
		} else {
			$(this.config.target).append('<div id="imagebrowser"><a title="vorheriges Bild" class="prev button"></a><a title="nächstes Bild" class="next button"></a></div>');
		}	
		this.bindImageNavigation();
	},
	
	bindImageNavigation: function() {
		$('#imagebrowser .prev').bind('click', function() {
		
			// Wenn automatische Slideshow aktiviert, halte slideshow an
			if(animations.config.images.slideshow.enabled) {
				clearTimeout(animations.config.images.slideshow.timeout);
				animations.config.images.slideshow.timeout = false;
			}		
		
			animations.changeImage('prev');
			animations.showImage();
		});
		
		$('#imagebrowser .next').bind('click', function() {
		
			// Wenn automatische Slideshow aktiviert, halte slideshow an
			if(animations.config.images.slideshow.enabled) {
				clearTimeout(animations.config.images.slideshow.timeout);
				animations.config.images.slideshow.timeout = false;
			}
		
			animations.changeImage('next');
			animations.showImage();
		});
	},
	
	unbindImageNavigation: function() {
		$('#imagebrowser .prev').unbind('click');		
		$('#imagebrowser .next').bind('click');
	},
	
	changeImage: function(direction) {
	
		animations.showLoader();
	
		//clearTimeout(animations.config.images.slideshow.timeout);
	
		var count = animations.config.images.elements.length;
		
		if(direction == 'next') {
			if(animations.config.images.slideshow.cur < count-1) {
				animations.config.images.slideshow.cur++;
			} else {
				animations.config.images.slideshow.cur = 0;
			}
		} else if(direction == 'prev') {
			if(animations.config.images.slideshow.cur >= 1) {
				animations.config.images.slideshow.cur--;
			} else {
				animations.config.images.slideshow.cur = count-1;
			}
		}
		
		var pic = animations.config.images.elements[animations.config.images.slideshow.cur];
		
		var newPic = animations.createImage(pic);
			/*newPic.onload = function() {
				animations.hideLoader();
				animations.attachImage(this);
				
				$('.bg_img.e2:not(#'+this.id+')').each(function() {
					$(this).fadeOut(animations.config.animation.speed, function() {
						$(this).remove();
					});
				});
				
				$(this).fadeIn(animations.config.animation.speed);
				
				background.setSize();
				
				if(animations.config.images.slideshow.enabled) {
					animations.config.images.slideshow.timeout = setTimeout(function() {
						animations.changeImage('next');
					}, animations.config.images.slideshow.timer);
				}
			};*/
			
			
		if(animations.config.images.slideshow.enabled) {
			animations.imageObjectTimeout();
		}
	},
	
	imageObjectTimeout: function() {
	
		clearTimeout(animations.config.images.slideshow.timeout);
		
		if(animations.config.images.elements.length > 0) {
			animations.config.images.slideshow.timeout = setTimeout(function() {
				animations.changeImage('next');
			}, animations.config.images.slideshow.timer);
		}
	},
	
	showClaim:function(markup, id) {
	
		$('.claim:not(#claim_'+id+')').fadeOut('slow', function() {
			$(this).remove();
		});	
		var claim = $('#claim_container').append(markup);
		$('#claim_'+id).fadeIn('slow', function() {
			animations.fadeOutClaimReadMore();
		});
		
	},
	
	removeClaim: function() {
		$('.claim').fadeOut('slow', function() {
			$(this).remove();
		});
	}, 
	
	contentReset: function() {
		this.hidePlatzNavi();
		this.hideFlyNavi();
		this.hidePlatzNotes();
		this.hidePageInfo();
	},
	
	// CONTENT HANDLING
	
	contenthandler: function(obj) {
		// checken ob Maincontent verfügbar
		
		animations.config.content.ready = false;
		
		if($(this.config.content.id).size() > 0) {
			this.config.content.exist = true;
		} else {
			this.config.content.exist = false;
		}
		
		tools.log(this.config.content.exist);
		this.removeHoleTooltip();
		// standard reset bei neuem Request
		//this.contentReset();
		
		
		//anhand von klassennamen entscheiden, was passiert
		switch (obj.className) {
			case 'PRESSE':
			case 'JOB':	
			case 'NEWS':
				obj.hasContent = true;
			case 'SEITE':
					
					/*if (this.config.current.elements.maincontent && obj.hasContent) {
						//wenn bereits maincontent angezeigt wird, diesen versteckeb					
						this.hideMainContent(function() {
							$(animations.config.content.id).remove();
							$(animations.config.target).append(obj.content);
							animations.showMainContent();
						});
					}
					else if(!this.config.current.elements.maincontent && obj.hasContent) {
	
						//wir haben noch keinen maincontent angezeigt aber Maincontent ist vorhanden
						$(this.config.target).append(obj.content);
						this.showMainContent();
						
					} else {
						if(this.config.content.exist) {
							this.hideMainContent(function(){
								$(animations.config.content.id).remove();
								$(animations.config.target).append(obj.content);
		
							});
						} else {
							$(animations.config.target).append(obj.content);
						}
					}*/
					this.hideMainContent(function() {
					
						$(animations.config.content.id).remove();
						$(animations.config.target).html(obj.content);
						
						animations.config.content.ready = true;
						
						if(obj.hasContent) {
							animations.config.content.hasContent = true;
							animations.showMainContent();
							tabs._init();
							if(obj.tab) {
								tabs.config.cur = obj.tab;
								tabs.setActive();
								tabs.swapTab();
							}
						} else {
							animations.config.content.hasContent = false;
						}
						
						// Wenn Slideshow enabled erstelle Bildernavigation							
						tools.log('images:'+animations.config.images.elements);
							
						if(animations.config.images.elements.length > 1) {
							animations.createImageNavigation((obj.obj_id == 2 ? true : false));
						} else {
							animations.unbindImageNavigation();
						}
						
						// Claim anzeigen falls vorhanden
						var imgObj = animations.config.images.elements[0];
			
						if(typeof(imgObj) != 'undefined' && imgObj.claimImage != false) {
							xajax_fetchClaim(imgObj.claimID);
						}
						
					});

					
			break;
			case 'PLATZ':
				/*if(this.config.content.exist) {
					this.hideMainContent(function() {
						$(animations.config.content.id).remove();
						$(animations.config.target).append(obj.content);
						plus.setPosition('.platzinfo');
					});	
				} else {
					$(animations.config.target).append(obj.content);
					plus.setPosition('.platzinfo');
				}*/
				this.hideMainContent(function() {
					animations.config.content.hasContent = true;
					$(animations.config.content.id).remove();
					$(animations.config.target).html(obj.content);
					animations.showMainContent();
					plus.setPosition('.platzinfo');
					animations.togglePlatzInfo();
				});
								
			break;			
			case 'LOCH':
				if(this.config.content.exist) {
					this.hideMainContent(function() {
						animations.config.content.hasContent = true;
						$(animations.config.content.id).remove();
						$(animations.config.target).html(obj.content);
					});	
				} else {
					$(animations.config.target).append(obj.content);
					this.showMainContent();
				}
								
			break;
		}
		
		/*tools.log('bäng');
		animations.resizeContainer();*/
	},
	
	// Hauptcontent /////////////////////////////////////////
	
	hideMainContent: function(callback) {
		//maincontent verstecken		
		animations.config.current.elements.maincontent = false;
		
		$(this.config.content.id).animate(
			{right : -this.config.content.width},
			animations.config.animation.speed,
			'swing',
			function() {				
				// Wenn Callback angegeben, fürhe diese aus
				if(typeof(callback) == 'function') {
					callback();
				}
			}
			
		);
	},
	
	showMainContent: function(content, hasContent) {
		//maincontent anzeigen
				
		animations.config.current.elements.maincontent = true;
		animations.config.content.toggled = false;
		
		$(this.config.content.id).animate(
			{right: 0},
			this.config.animation.speed
		);		
	},
	
	toggleMainContent: function() {
		if(this.config.current.elements.maincontent) {
			this.hideMainContent();
		} else {
			this.showMainContent();
		}
	},
	
	showImage: function() {
		$(this.config.content.id + ' .viewToggle').addClass('active');
		if(animations.config.content.hasContent) {
			$(this.config.content.id).animate({
				right : -(this.config.content.width-30),
				opacity: 0.5
			},animations.config.animation.speed);
			animations.config.content.toggled = true;
		}
	},
	
	showContent: function() {
		$(this.config.content.id + ' .viewToggle').removeClass('active');
		$(this.config.content.id).animate({
			right : 0,
			opacity: 1
		},animations.config.animation.speed);
		animations.config.content.toggled = false;
	},
	
	toggleView: function() {
		
		if(animations.config.content.toggled) {
			
			animations.showContent();
			
		} else {
			
			animations.showImage();
			
		}
	},
	
	// Pageinfo //////////////////////////////////////////////
	
	hidePageInfo: function() {
		$('.pageinfo').remove();
	},
	
	// Elemente für Klasse Platz /////////////////////////////
	
	togglePlatzDetails:function() {
		this.toggleView();
		this.togglePlatzInfo();
	},
	
	togglePlatzInfo:function() {
		if(!animations.config.content.toggled) {
			$('.platzinfo').fadeOut();
		} else {
			$('.platzinfo').fadeIn();
		}
	},
	
	toggleLochDetails:function() {
		this.toggleView();
		this.toggleLochButtonStatus();		
	},
	
	toggleLochButtonStatus: function() {
		if(!animations.config.content.toggled) {
			$('.toggleHole').removeClass('lochansicht');
			$('.toggleHole').addClass('lochdetails');
			//$('.toggleHole').parent().children('.buttontooltip').html('Lochansicht')
		} else {			
			$('.toggleHole').addClass('lochansicht');
			$('.toggleHole').removeClass('lochdetails');
			//$('.toggleHole').parent().children('.buttontooltip').html('Lochdetails')
		}
	},
	
	// Schwebende Navi
	showFlyNavi: function() {
		
	},
	
	hideFlyNavi: function() {
		$('#flying_navi').remove();
	},
	
	toggleFlyNavi: function() {
		
	},
	
	// Pluszeichen
	showPlatzNotes: function() {
		
	},
	
	hidePlatzNotes: function() {
		$('.platzinfo').remove();
	},
	
	togglePlatzNotes: function() {
		
	},

	
	// Wetter ////////////////////////////////////////////////
	showWeather: function(content) {
		$(this.config.weather.id).html(content).animate(
			{left: 0},
			this.config.animation.speed,
			'swing',
			function() {
				animations.config.current.elements.weather = true;
			}
		);
	},
	
	hideWeather: function() {
		$(this.config.weather.id).animate(
			{left: -200},
			this.config.animation.speed,
			'swing',
			function() {
				animations.config.current.elements.weather = false;
			}
		);
	},
	
	// Platznavi ////////////////////////////////////////////////
	showPlatzNavi: function() {
		$(this.config.platznavi.id).fadeIn(
			this.config.animation.speed,
			function() {
				animations.config.current.elements.platznavi = true;
			}
		);
	},
	
	hidePlatzNavi: function() {
		$(this.config.platznavi.id).fadeOut(
			this.config.animation.speed,
			function() {
				animations.config.current.elements.platznavi = false;
				$(animations.config.platznavi.id).remove();
			}
		);
	},
	
	// Subcontent ////////////////////////////////////////////
	
	showSubContent: function() {
		this.config.current.subcontent = true;		
		$(this.config.subcontent.id).slideDown(this.config.animation.speed);
		
		//background.moveUp();
	},
	
	hideSubContent : function() {
		this.config.current.subcontent = false;	
		$(this.config.subcontent.id).slideUp(this.config.animation.speed);
		
		//background.moveDown();
	},
	
	fadeSubContent: function(content) {
		$(this.config.subcontent.id).children().fadeOut(this.config.animation.speed, function() {
			$(animations.config.subcontent.id).html(content);
			$(animations.config.subcontent.id).children().fadeIn(animations.config.animation.speed);
		});				
	},
	
	toggleSubContent: function(obj) {
		if(obj.content != '') {
			if(this.config.current.subcontent) {
				this.fadeSubContent(obj.content);
			} else {
				$(this.config.subcontent.id).html(obj.content);
				this.showSubContent();
				this.resizeContainer(true);
			}
		} else {
			this.hideSubContent();
			this.resizeContainer(false);
		}
	},
	
	// Tooltips /////////////////////////////////////////////
	
	toggleTooltip: function(obj) {
		$('.tooltip.active').fadeOut('slow');
		$('.tooltip.active').removeClass('active');
		if($(obj).hasClass('active')) {
			this.hideTooltip(obj);
		} else {
			this.showTooltip(obj);
		}
	}, 
	
	showTooltip: function(obj) {
		$(obj).addClass('active');
		$(obj).fadeIn(this.config.animation.speed);
		
	},
	
	hideTooltip: function(obj) {
		$(obj).removeClass('active');
		$(obj).fadeOut(this.config.animation.speed);
	},
	
	showHoleTooltip: function(params) {
		$('#tooltip_'+params.id).css({
			top: animations.config.mouseY - 100,
			left: animations.config.mouseX + 20
		});
		
		$('#tooltip_'+params.id).fadeIn();
	},
	
	hideHoleTooltip: function(params) {
		$('#tooltip_'+params.id).fadeOut('slow', function() {
			$(this).css({
				top: -300,
				left: -300
			});
		});
	},
	
	removeHoleTooltip: function() {
		$('.lochtooltip').each(function() {
			$(this).remove();
		});
	},
	
	showButtonTooltip: function(obj) {
		$(obj).parent().children('.buttontooltip').fadeIn();
	},
	
	hideButtonTooltip: function(obj) {
		$(obj).parent().children('.buttontooltip').fadeOut();
	},
	
	hideButtonTooltipAll: function(obj) {
		$('.buttontooltip').fadeOut();
	},
	
	// Ansprechpartner ////////////////////////////////////////////

	toggleAnsprechpartner: function(id) {
		$('.ansprechpartner_name'+'#'+id).addClass('active');
		$('.ansprechpartner_name:not(#'+id+')').removeClass('active');
		$('.ansprechpartner_details.'+id).show();
		$('.ansprechpartner_details:not(.'+id+')').hide();
		animations.resizeMainContent();
		
	},
	
	hideAnsprechpartner: function() {
	
	},
	
	showAnsprechpartner: function() {
	
	},
	
	// MouseOver Funktionen /////////////////////////////////
	
	colorFade: function(target, code, callback) {
		$(target).stop().animate({
			  color : code
		}, this.config.animation.speed, 'swing', callback);
	},
	
	bgFade: function(target, code, callback) {
		$(target).stop().animate({
			  bgColor : code
		}, this.config.animation.speed, 'swing', callback);
	},
	
	// PopUp ///////////////////////////////////////////////
	
	pop: function(params) {
		var url = params.url;
		if(params.width) {
			var width = params.width;
		} else {
			var width = 400;
		}
		if(params.height) {
			var height = params.height;
		} else {
			var height = 500;
		}
		
		window.open(url,'','width='+width+', height='+height+',resziable');
	},
	
	// Claims ///////////////////////////////////////////////
	
	toggleClaimText: function(id) {
		var claimID = parseInt(id);		
		$('#claim_text_'+claimID).slideToggle('fast');		
	},
	
	fadeOutClaimReadMore: function() {
		$('.claim_readmore').animate({
			opacity: 0.2
		}, 1000, 'swing', function() {
			animations.fadeInClaimReadMore();
		});
	},
	
	fadeInClaimReadMore: function() {
		$('.claim_readmore').animate({
			opacity: 0.9
		}, 1000, 'swing', function() {
			animations.fadeOutClaimReadMore();
		});
	},
	
	pulseClaimReadMore: function() {
		
	}
	
};
