	function pm_window(userid, msg_id, pm_option) {
		x = (screen.width / 2) - (300 / 2);
		y = (screen.height / 2) - (250 / 2);
		var pm = window.open("message_popup.php?id="+userid+"&msg_id="+msg_id+"&option="+pm_option,"PM_Window","width=300,height=250,left="+x+",top="+y+", scrollbars=yes, menubar=no, resizeable=no, toolbar=no");		pm.focus();
	}

	function showDiv(obj_id) {
		var edit_object = document.getElementById('edit_'+obj_id).style;
		if(document.getElementById(obj_id))
			var object = document.getElementById(obj_id).style;
		
		if(edit_object.display == "none") {
			edit_object.display = "inline";
			if(object)
				object.display = "none";
		} else {
			edit_object.display = "none";
			if(object)
				object.display = "inline";
		}
	}
	
	function playlist_print() {
		var win_width = 650;
		var win_height = 700;
		var pos_x = Math.round((screen.availWidth / 2) - (win_width / 2));
		//var pos_y = Math.round((screen.availHeight / 2) - (win_height / 2));
		var pos_y = 100;

		var newWindow = window.open("acp.php?module=playlist&action=print", "win_pop", "top="+pos_y+",left="+pos_x+",width="+win_width+",height="+win_height+",screenX=0,screenY=0,menubar=no,resizable=no,scrollbars=yes");
		newWindow.focus();
	}
	
	function confirmDelete(redirect) {
		if(confirm("Wirklich löschen?")) {
			location.href = redirect;
		}
	}
	
	function confirm_delete_form(formID) {
		if(confirm("Wirklich löschen?")) {
			$(formID).submit();
		}
	}
	
	function bbcode(URL) {
		var win_width = 350;
		var win_height = 250;
		var pos_x = Math.round((screen.availWidth / 2) - (win_width / 2));
		//var pos_y = Math.round((screen.availHeight / 2) - (win_height / 2));
		var pos_y = 250;

		var newWindow = window.open(URL, "win_pop", "top="+pos_y+",left="+pos_x+",width="+win_width+",height="+win_height+",screenX=0,screenY=0,menubar=no,resizable=no,scrollbars=yes");
		newWindow.focus();
	}

	function smiley(text) {
		var txtarea = document.guestbook.text;

		var txtarea_start = txtarea.value.substr(0, txtarea.selectionStart);
		var txtarea_end = txtarea.value.substr(txtarea.selectionEnd, txtarea.value.length);

		txtarea.value = txtarea_start + text + txtarea_end;
		txtarea.focus();
	}
	

	var images = Array();
	function selectImage(imageID, obj) {
		if(images[imageID] == "marked") {
			obj.src = "images/image_not_selected.png";
			images[imageID] = "not_marked";
		} else {
			obj.src = "images/image_selected.png";
			images[imageID] = "marked";
		}
	}
	
	function get_image_ids() {
		var ids = "";
		for(index in images) {
			if(images[index] == "marked")
				ids += index+",";
		}
		return ids.substr(0, ids.length - 1);
	}
	
	function delete_images() {
		if(confirm("Sollen die Bilder wirklich gelöscht werden?")) {
			location.href = "acp.php?module=gallery&action=delete&id=" + get_image_ids();
		}
	}
	
	function move_images() {
		var ids = get_image_ids();
		if(ids != "") {
			alert(ids);
			document.form_move.ids.value = get_image_ids();
			document.getElementById('move_images').style.display = "inline";
			document.getElementById('my_overlay').style.display = "inline";
		} else {
			alert("Keine Bilder ausgewählt");
		}
	}
	
	function gallery_image(gallery_id) {
		var ids = get_image_ids();
		if(ids != "") {
			ids = ids.split(",");
			location.href = "acp.php?module=gallery&action=gallery_image&id=" + gallery_id + "&image_id=" + ids[0];
		} else {
			alert("Es wurde kein Bild ausgewählt");
		}
	}
	
	function upload_images() {
		document.getElementById('upload_images').style.display = "inline";
		document.getElementById('my_overlay').style.display = "inline";
	}
	
	function closeDiv(obj) {
		document.getElementById(obj).style.display = "none";
		document.getElementById('my_overlay').style.display = "none";
	}
	
	function dnp_upload_complete(sid) {
		location.href = "acp.php?module=gallery&action=upload_complete&sid=" + sid;
	}
	
	function mailto(emailHash) {
		var email = Base64.decode(emailHash);
		location.href = email;
	}
	
	function showDesc(obj, shown) {
		if(shown == true) {
			Effect.Appear(obj, { duration: 0.5 });
		} else {
			$(obj).style.display = "none";
		}
	}
	
	function my_playlist(track_id, party_id) {
		new Ajax.Request("index.php?module=wishlist&do=playlist&id="+track_id+"&party_id="+party_id, {
			onSuccess: function(transport) {
				var added = "added|";
				var removed = "removed|";
				var text = transport.responseText;
				var img = $('plico'+track_id);
				
				if(text.substr(0, added.length) == added) {
					img.src = "images/playlist_remove.png";
					img.title = "Von meiner Playlist entfernen";

					$('pl'+track_id).innerHTML = text.substring(added.length, text.length);
				}
				if(text.substr(0, removed.length) == removed) {
					img.src = "images/playlist_add.png";
					img.title = "Zu meiner Playlist hinzufügen";

					$('pl'+track_id).innerHTML = text.substring(removed.length, text.length);
				}
			}
		});
	}
	
	function track_allow(track_id) {
		new Ajax.Request("index.php?module=wishlist&do=allow_track&id=" + track_id, {
			onSuccess: function(transport) {
				if(transport.responseText == "ok") {
					var obj = $('link'+track_id);
					var table_row = $('track'+track_id);
					
					obj.parentNode.removeChild(obj);
					table_row.className = "tablea";
				}
			}
		});
	}
	
	function blacklist_track(track_id) {
		new Ajax.Request("index.php?module=wishlist&do=blacklist&id=" + track_id, {
			onSuccess: function(transport) {
				if(transport.responseText == "ok") {
					var table_row = $('track'+track_id);
					
					table_row.parentNode.removeChild(table_row);
				}
			}
		});
	}
	
	function delete_track(track_id) {
		if(confirm("Wirklich löschen?")) {
			new Ajax.Request("index.php?module=wishlist&do=delete&id=" + track_id, {
				onSuccess: function(transport) {
					if(transport.responseText == "ok") {
						var table_row = $('track'+track_id);

						table_row.parentNode.removeChild(table_row);
					}
				}
			});
		}
	}
	
	Effect.BlindRight = function(element) {
	  element = $(element);
	  var elementDimensions = element.getDimensions();
	  return new Effect.Scale(element, 100, Object.extend({
		scaleContent: false,
		scaleY: false,
		scaleFrom: 0,
		scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
		restoreAfterFinish: true,
		afterSetup: function(effect) {
		  effect.element.makeClipping().setStyle({
			width: '0px',
			height: effect.dims[0] + 'px'
		  }).show();
		},
		afterFinishInternal: function(effect) {
		  effect.element.undoClipping();
		}
	  }, arguments[1] || { }));
	};