function uferApp(theMediaUrl) {
	var mediaUrl = theMediaUrl;
	
	function MenuEntry(theId, theName, theContentArea) {
		// Attributes
		var contentArea = theContentArea;
		var name = theName;
		var id = theId;
		var element = document.getElementById(id);
		var isActive = false;
		var anim = new YAHOO.util.Anim(element);

		// Private functions
		function showName() {
			element.innerHTML = theName;
		}
		
		function hideName() {
			element.innerHTML = '';
		}
		
		function show() {
			for (var i = 0; i < buttonList.length; i++) {
				if (buttonList[i].getId() != id && !buttonList[i].isActive()) {
					buttonList[i].hide();
				}
			}
			anim.stop();
			anim.attributes.width = { to: 155 };
			anim.duration =  0.3;
			anim.method = YAHOO.util.Easing.easeIn;
			anim.animate();
			anim.onComplete.subscribe(showName);
		}
		
		function hide() {
			if(isActive) {
				return;
			}
			anim.onComplete.unsubscribe(showName);
			anim.stop();
			hideName();
			anim.attributes.width = { to: 18 };
			anim.animate();
		}
		
		function activate() {
			for (var i = 0; i < buttonList.length; i++) {
				if (buttonList[i].getId() != id & buttonList[i].isActive()) {
					buttonList[i].deactivate();
				}
			}
			isActive = true;
			
			contentArea.show();
		}
		
		function deactivate() {
			isActive = false;
			hide();
		}
		// Constructor
		YAHOO.util.Event.on(element, 'mouseover', show); 
		YAHOO.util.Event.on(element, 'mouseout', hide);
		YAHOO.util.Event.on(element, 'click', activate); 

		// Public functions
		return ({
			getName: function() {
				return name;
			},
			
			getId: function() {
				return id;
			},
			
			hide: function() {
				return hide();
			},
			
			isActive: function() {
				return isActive;
			},
			
			deactivate: function() {
				return deactivate();
			}
		});
	}
	
	function ContentArea(theId, theWidth, theHeight) {
		// private attributes
		var id = theId;
		var content_id = '' + id + '_content';
		var width = theWidth;
		var height = theHeight;
		var element = document.getElementById(id);
		var isActive = false;
		var anim = new YAHOO.util.Anim(element);
		
		function showContent() {
			document.getElementById(content_id).style.display = 'block';
		}
		
		function hideContent() {
			document.getElementById(content_id).style.display = 'none';
		}
		
		// private functions
		function show() {
			for (var i = 0; i < buttonList.length; i++) {
				if (contentAreaList[i].getId() != id) {
					contentAreaList[i].hide();
				}
			}
			anim.stop();
			anim.attributes.width = { to: width };
			anim.attributes.height = { to: height };
			anim.duration =  0.3;
			anim.method = YAHOO.util.Easing.easeIn;
			anim.animate();
			anim.onComplete.subscribe(showContent);
		}
		
		function hide() {
			artistLabel.hide();
			headlineLabel.hide();
			imageContainer.hide();
			anim.onComplete.unsubscribe(showContent);
			anim.stop();
			hideContent();
			anim.attributes.width = { to: 0 };
			anim.attributes.height = { to: 0 };
			anim.animate();
		}
		
		// Public functions
		return ({
			getId: function() {
				return id;
			},
			
			isActive: function() {
				return isActive;
			},
			
			show: function() {
				return show();
			},
			
			hide: function() {
				return hide();
			}
		});
	}
	
	function HeadlineLabel(theId, theBoxId, theType) {
		var type = theType;
		var id = theId;
		var boxId = theBoxId;
		var boxElement = document.getElementById(boxId);
		var element = document.getElementById(id);
		var user = null;
		var active = false;
		
		function toggleTextField() {
			if(active) {
				boxElement.style.display = 'none';
				active = false;
			} else {
				boxElement.style.display = 'block';
				active = true;
			}
			
			if(active) {
				getData();
			}
		}
		
		function onSuccess(theResponse) {
			boxElement.innerHTML = theResponse.responseText;
		}
		
		function onFailure() {
		
		}
		
		function getData() {
			var myPostData = 'id=' + user;
			
			var url = '';
			
			if(type==1) {
				url = '/ajax/vita/';
			} else {
				url = '/ajax/text/';
			}
            var request = YAHOO.util.Connect.asyncRequest('POST',
                                               url,
                                               {
                                                   success: onSuccess,
                                                   failure: onFailure,
                                                   argument: {}
                                               },
                                               myPostData);
		}
		
		function setContent() {
			boxElement.innerHTML = '';
		}
		
		function hide() {
			element.style.display = 'none';
			boxElement.style.display = 'none';
		}
		
		function show(theName) {
			if(active) {
				getData();
			}
			element.innerHTML = theName;
			element.style.display = 'block';
		}
		
		YAHOO.util.Event.on(element, 'click', toggleTextField); 
		
		// Public functions
		return ({
			getId: function() {
				return id;
			},
			
			hide: function() {
				return hide();
			},
			
			show: function(theId, theName) {
				user = theId;
				return show(theName);
			}
		});
	}
	
	function ImageContainer(theId) {
		var id = theId;
		var element = document.getElementById(id);
		var user = null;
				
		function onSuccess(theResponse) {
			element.innerHTML = theResponse.responseText;
		}
		
		function onFailure() {
			hide()
		}
		
		function getData(theUser, theImage) {
			var myPostData = 'user=' + theUser;
			if(theImage) {
				myPostData += '&image=' + theImage;
			}
			
			url = '/ajax/image/';

            var request = YAHOO.util.Connect.asyncRequest('POST',
                                               url,
                                               {
                                                   success: onSuccess,
                                                   failure: onFailure,
                                                   argument: {}
                                               },
                                               myPostData);
		}
		
		function hide() {
			element.style.display = 'none';
		}
		
		function show(theUser, theImage) {
			getData(theUser, theImage);
			element.style.display = 'block';
		}
		
		// Public functions
		return ({
			getId: function() {
				return id;
			},
			
			hide: function() {
				return hide();
			},
			
			show: function(theUser, theImage) {
				user = theUser;	
				return show(theUser, theImage);
			}
		});
	}
	
	function EventButton(theId, theFunction) {
		var id = theId;
		var element = document.getElementById(id);
		
		YAHOO.util.Event.on(element, 'click', theFunction); 
	}
	
	var imageContainer = new ImageContainer('image_container');
	
	var artistLabel = new HeadlineLabel('artist_label', 'vita_box', 1);
	var headlineLabel = new HeadlineLabel('text_title', 'text_box', 2);
	
	var colorChooserW = new EventButton('blockW', function() {
		document.getElementById('body').style.backgroundColor = '#fff';
		document.getElementById('main').style.backgroundImage = 'url(' + mediaUrl + 'gfx/bg_w.png)';
	});
	
	var colorChooserB = new EventButton('blockK', function() {
		document.getElementById('body').style.backgroundColor = '#000';
		document.getElementById('main').style.backgroundImage = 'url(' + mediaUrl + 'gfx/bg_b.png)';
	});
	
	var contentAreaList = [];
	
	var myContentArea1 = new ContentArea('uferpalast', 570, 400);
	var myContentArea2 = new ContentArea('info', 370, 450);
	var myContentArea3 = new ContentArea('heavyrotation', 200, 500);
	var myContentArea4 = new ContentArea('contact', 370, 450);
	
	contentAreaList.push(myContentArea1);
	contentAreaList.push(myContentArea2);
	contentAreaList.push(myContentArea3);
	contentAreaList.push(myContentArea4);
	
	var buttonList = [];
	
	var myButton1 = new MenuEntry('blockG', 'Uferpalast', myContentArea1);
	var myButton2 = new MenuEntry('blockY', 'Info', myContentArea2);
	var myButton3 = new MenuEntry('blockM', 'Heavy Rotation', myContentArea3);
	var myButton4 = new MenuEntry('blockC', 'Contact', myContentArea4);
	
	buttonList.push(myButton1);
	buttonList.push(myButton2);
	buttonList.push(myButton3);
	buttonList.push(myButton4);
	
	return ({
			getArtistLabel: function() {
				return artistLabel;
			},
			getHeadlineLabel: function() {
				return headlineLabel;
			},
			getImageContainer: function() {
				return imageContainer;
			}
		});

}