function initialiseMusic(startParam) {
	containerId = profilePage.getContainerForApp(startParam);
	if(containerId) {
		var musicScroller = new MusicScrollClass();
		musicScroller.id = containerId;
		musicScroller.param = startParam;
		
		appManagerId = appManager.runApp(startParam, musicScroller);
		
		musicScroller.name = 'appManager.runningApps["' + startParam + '"]';
		appManager.runningApps[startParam].init();
	}
}

function MusicScrollClass() {
	var MusicScrollPosX;

	this.init = function() {
		this.box = document.getElementById(this.id);
		
		var output = new Object();	
		output.userId = profilePageURLName;
				
		outputString = JSONstring.make(output);

		jsonPostData('jsApi/photos/get/recentImagesForUser', escape(outputString), this.name + '.loadImagesInt');

		this.buildContainer();
	}
	
	this.loadImagesInt = function(Object) {
		var displayErrorMessage = true;
	 	var leftValue = 20;
		var imgCnt = 0;
					
		if(Object) {
			if(Object["status"] && Object["images"]) {
				if(Object["status"] == 'ok') {
					if(Object["images"].length > 0) {
						displayErrorMessage = false;
						for(imgCnt = 0; imgCnt < Object["images"].length; imgCnt++) {
							
							image = document.createElement("IMG");
							image.className = 'scrollImage';
							image.src = Object["images"][imgCnt]["ThumbnailPath"];
							
							imageContainer = document.createElement("DIV");
							imageContainer.id = this.id + 'imgCnt' + imgCnt;
							imageContainer.className = 'scrollImageContainer';
							imageContainer.style.left = leftValue + 'px';
							if(this.basePath) {
								eval("imageContainer.onclick = function() { document.location.href = '" + this.basePath + Object["images"][imgCnt]["PublicID"] + "'; };");								
							} else {
								eval("imageContainer.onclick = function() { document.location.href = '" + Object["images"][imgCnt]["URL"] + "'; };");	
							}				
							eval("imageContainer.onmouseover = function() { document.getElementById('" + this.id + "imgCnt" + imgCnt + "').className = 'scrollImageContainer hovered'; document.getElementById('" + this.id + "imageTitleContainer').innerHTML = '<b>" + Object["images"][imgCnt]["GalleryTitle"] + ":</b> " + Object["images"][imgCnt]["Title"] + "'; };");		
							eval("imageContainer.onmouseout = function() { document.getElementById('" + this.id + "imgCnt" + imgCnt + "').className = 'scrollImageContainer'; document.getElementById('" + this.id + "imageTitleContainer').innerHTML = '';};");		
																					
							imageContainer.appendChild(image);
							
							leftValue = leftValue + 135;
							document.getElementById(this.param + "innerMusicScrollContainer").appendChild(imageContainer);
						}
					}
				}
			} 
		}
		
		if(imgCnt == 0) {
			var noImagesMessage = document.createElement("DIV");
			noImagesMessage.className = 'noImagesMessage';
			noImagesMessage.innerHTML = 'Hier wurden noch keine Bilder hinzugef&uuml;gt.';
			
			document.getElementById(this.param + "innerMusicScrollContainer").appendChild(noImagesMessage);
			
			this.box.style.display = 'none';
		}
		
		if(leftValue > 500) {
			difference = 0 - leftValue + 400;
			startMoveBoxEffect(document.getElementById(this.param + "innerMusicScrollContainer"), 'left', difference, 1, this.name + ".doneScrollingLeft();");		
		}
	}
	
	this.doneScrollingLeft = function() {
		startMoveBoxEffect(document.getElementById(this.param + "innerMusicScrollContainer"), 'right', 0, 1, this.name + ".doneScrollingRight();");		
	}
	
	this.doneScrollingRight = function() {
		startMoveBoxEffect(document.getElementById(this.param + "innerMusicScrollContainer"), 'left', difference, 1, this.name + ".doneScrollingLeft();");		
	}
	
	this.buildContainer = function() {
		this.box.className = this.box.className + ' body dark small musicBox';
		
		
		var musicContent = document.createElement("DIV");
		musicContent.id = this.param + 'musicContent';
		musicContent.className = 'body';

		var header = document.createElement("DIV");
		header.className = 'title';
		header.innerHTML = '<span class="green">Meine</span> Fotos...';
		musicContent.appendChild(header);
		
		var outerMusicScrollContainer = document.createElement("DIV");
		outerMusicScrollContainer.className = 'outerMusicScrollContainer';
		
		var innerMusicScrollContainer = document.createElement("DIV");
		innerMusicScrollContainer.id = this.param + 'innerMusicScrollContainer';
		innerMusicScrollContainer.className = 'innerMusicScrollContainer';
				
		var imageTitleContainer = document.createElement("DIV");
		imageTitleContainer.id = this.id + 'imageTitleContainer';
		imageTitleContainer.className = 'imageTitleContainer';		
				
		outerMusicScrollContainer.appendChild(innerMusicScrollContainer);
		outerMusicScrollContainer.appendChild(imageTitleContainer);
		musicContent.appendChild(outerMusicScrollContainer);

		this.box.appendChild(musicContent);
	}	
}

function PhotoScrollClass() {
	this.init = function() {
		this.box = document.getElementById(this.id);
		
		var output = new Object();	
		output.galleryAppId = this.galleryAppId;
				
		outputString = JSONstring.make(output);

		jsonPostData('jsApi/photos/get/recentImagesForGalleryApp', escape(outputString), this.name + '.loadImagesInt');
				
		this.buildContainer();
		refreshContentContainer();	
	}
	
	this.loadImagesInt = function(Object) {
		var displayErrorMessage = true;
	 	var leftValue = 20;
		var imgCnt = 0;
					
		if(Object) {
			if(Object["status"] && Object["images"]) {
				if(Object["status"] == 'ok') {
					if(Object["images"].length > 0) {
						displayErrorMessage = false;
						for(imgCnt = 0; imgCnt < Object["images"].length; imgCnt++) {
							
							image = document.createElement("IMG");
							image.className = 'scrollImage';
							image.src = Object["images"][imgCnt]["ThumbnailPath"];
							
							imageContainer = document.createElement("DIV");
							imageContainer.id = this.id + 'imgCnt' + imgCnt;
							imageContainer.className = 'scrollImageContainer';
							imageContainer.style.left = leftValue + 'px';
							if(this.basePath) {
								eval("imageContainer.onclick = function() { document.location.href = '" + this.basePath + Object["images"][imgCnt]["PublicID"] + "'; };");								
							} else {
								eval("imageContainer.onclick = function() { document.location.href = '" + Object["images"][imgCnt]["URL"] + "'; };");	
							}	
							eval("imageContainer.onmouseover = function() { document.getElementById('" + this.id + "imgCnt" + imgCnt + "').className = 'scrollImageContainer hovered'; };");		
							eval("imageContainer.onmouseout = function() { document.getElementById('" + this.id + "imgCnt" + imgCnt + "').className = 'scrollImageContainer'; };");		
																					
							imageContainer.appendChild(image);
							
							leftValue = leftValue + 135;
							document.getElementById(this.param + "innerMusicScrollContainer").appendChild(imageContainer);
						}
					}
				}
			} 
		}
		
		if(imgCnt == 0) {
			var noImagesMessage = document.createElement("DIV");
			noImagesMessage.className = 'noImagesMessage';
			noImagesMessage.innerHTML = 'Hier wurden noch keine Bilder hinzugef&uuml;gt.';
			
			document.getElementById(this.param + "innerMusicScrollContainer").appendChild(noImagesMessage);
			
			this.box.style.display = 'none';
		}
		
		if(leftValue > 500) {
			difference = 0 - leftValue + 400;
			startMoveBoxEffect(document.getElementById(this.param + "innerMusicScrollContainer"), 'left', difference, 1, this.name + ".doneScrollingLeft();");		
		}
	}
	
	this.doneScrollingLeft = function() {
		startMoveBoxEffect(document.getElementById(this.param + "innerMusicScrollContainer"), 'right', 0, 1, this.name + ".doneScrollingRight();");		
	}
	
	this.doneScrollingRight = function() {
		startMoveBoxEffect(document.getElementById(this.param + "innerMusicScrollContainer"), 'left', difference, 1, this.name + ".doneScrollingLeft();");		
	}
	
	this.buildContainer = function() {
		this.box.className = this.box.className + ' body dark small photoScrollBox';
			
		var musicContent = document.createElement("DIV");
		musicContent.id = this.param + 'musicContent';
		musicContent.className = 'body';

		if(this.title) {
			var header = document.createElement("DIV");
			header.tite = this.id + 'title';
			header.className = 'title';
			header.innerHTML = this.title;
			
			musicContent.appendChild(header);
		}
		
		var outerMusicScrollContainer = document.createElement("DIV");
		outerMusicScrollContainer.className = 'outerPhotoScrollContainer';
		
		var innerMusicScrollContainer = document.createElement("DIV");
		innerMusicScrollContainer.id = this.param + 'innerMusicScrollContainer';
		innerMusicScrollContainer.className = 'innerPhotoScrollContainer';
				
		var imageTitleContainer = document.createElement("DIV");
		imageTitleContainer.id = this.id + 'imageTitleContainer';
		imageTitleContainer.className = 'imageTitleContainer';		
				
		outerMusicScrollContainer.appendChild(innerMusicScrollContainer);
		//outerMusicScrollContainer.appendChild(imageTitleContainer);
		musicContent.appendChild(outerMusicScrollContainer);

		this.box.appendChild(musicContent);
	}	
}
	
function photosphotoScrolljs() {}
