function titleDialog(filename, oldtitle, olddesc) {
	openDialog('Bildtext ändern', '\
		<input id="imgtitle" type="text" name="title" style="margin: 5px 5px 5px 20px; width: 400px; padding: 2px;" value="' + (oldtitle == "" ? 'Titel' : oldtitle) + '" maxlength="100" onclick="if(this.value == \'Titel\') this.value = \'\'; this.onclick = \'\';" /><br />\
		<textarea id="imgdesc" name="desc" style="margin: 5px 5px 5px 20px; width: 400px; height: 2.5em; padding: 2px; font-family: Verdana, sans-serif; font-size: 0.9em;" maxlength="250" onclick="if(this.innerHTML == \'Beschreibung\')this.innerHTML = \'\'; this.onclick = \'\';">' + (olddesc == "" ? 'Beschreibung' : olddesc) + '</textarea><br />\
		<button onclick="\
			var call = \'/calls/imageAction.php?action=text&img=' + filename + '&title=\' + encodeURIComponent($(\'#imgtitle\').val()) + \'&amp;desc=\' + encodeURIComponent($(\'#imgdesc\').val());\
			if(document.location.href.match(/images\\\.php/) || document.location.href.match(/gallery\\\.php/)) {\
				document.location.href = \'http://www.abload.de\' + call + \'&next=\' + (document.location.pathname + document.location.search);\
			}\
			if(document.location.href.match(/uploadComplete\\\.php/)) {\
				$.get(call);\
				$(\'#title_' + filename.replace('.', '_') + '\').text(\'Titel: \' + $(\'#imgtitle\').val());\
				if(typeof(htmlLinksAltTitle) != \'undefined\') {\
					$.get(\'/calls/getLinks.php?img=' + filename + '\', function(data, status) { $(\'#image_' + filename.replace('.', '_') + '\').replaceWith(data); } ); \
					var files = \'\';\
					var imgs = $(\'img[src^=http://www.abload.de/thumb/][display!=none]\');\
					for(var i = 0; i < imgs.length; i++) {\
					files += \';\' + imgs[i].src.substring(27);\
					}\
					files = files.substring(1);\
					$(\'#multipleLinks\').load(\'/calls/getLinks.php?imgs=\' + files);\
				}\
			}\
			closeDialog();\
			return false;"\
		style="display: block; text-align: center; margin: 2px auto;">ändern</button>\
	');
	resizeDialog(500);
}

function titleDialogGet(filename) {
	openDialog('Lade Informationen...', '');
	$.get("/calls/getImageText.php?img=" + filename,
		function(data) {
			closeDialog();
			var text = eval('(' + data + ')');
			titleDialog(filename, text.title, text.desc);
		}
	);
}