// www.jjam.de - Promptbox mit JavaScript - Version 20.12.2002

//Nur für IE 5+ und NN 6+

ie5=(document.getElementById&&document.all&&document.styleSheets)?1:0;

nn6=(document.getElementById&&!document.all)?1:0;


if(ie5||nn6) {

	if(ie5) cs=2,th=30;
	else cs=0,th=20;
	//wg. Layout

	document.write(
		"<div style='position:absolute;top:-500;left:0;z-index:100' id='prompt'>"+
			"<table style='border-style:outset;border-width:2;border-color:#E6E6CD;background-color:#F5F5DC' cellpadding='5' cellspacing='"+cs+"' width='"+promptWidth+"' height='"+promptHeight+"' onmousedown='getxyRelativ()' onmousemove='movePrompt()' onmouseup='moveStatus=0'>"+
				"<tr><td height='"+th+"' bgcolor='#DEDEC5'>"+promptTitle+"</td></tr>"+
				"<tr><td><br>"+promptText+"</td></tr>"+
				"<tr align='center'><td>"+
					"<br>"+
					"<form name='promptform' onsubmit='okPrompt();return false'><input style='background-color:#FFFEE4;border-width:1' type='text' size='35' value='' name='promptinput'>"+
						"<br><br><br>"+
						"<input style='background-color:#E9E9CF;border-width:1;font-weight:bold' type='button' value='&nbsp; &nbsp; OK &nbsp; &nbsp;' onclick='okPrompt()' onfocus='if(this.blur)this.blur()'>"+
						"&nbsp;&nbsp;"+
						"<input style='background-color:#E9E9CF;border-width:1;font-weight:bold' type='button' value='Abbrechen' onclick='abortPrompt()' onfocus='if(this.blur)this.blur()'>"+
					"</form>"+
				"</td></tr>"+
			"</table>"+
		"</div>"
	);

}


//Box anzeigen

function showPrompt() {

	if(ie5||nn6) {

		moveStatus=0;

		xPrompt=xPromptStart, yPrompt=yPromptStart;

		if(ie5) {

			document.getElementById("prompt").style.left=xPrompt+document.body.scrollLeft;

			document.getElementById("prompt").style.top=yPrompt+document.body.scrollTop;

		}

		else if(nn6) {

			document.getElementById("prompt").style.left=xPrompt+window.pageXOffset;

			document.getElementById("prompt").style.top=yPrompt+window.pageYOffset;

		}

		document.promptform.promptinput.focus();

	}

	else promptAlternative();

}


//Relative Mausposition ermitteln

var xRelativ, yRelativ;

function getxyRelativ() {

	moveStatus=1;

	if(ie5) {

		xRelativ=event.clientX-xPrompt;

		yRelativ=event.clientY-yPrompt;

	}

}


//Box bewegen (nur IE)

function movePrompt() {

	if(ie5&&moveStatus>0) {

		xPrompt=document.getElementById("prompt").style.left=event.clientX+document.body.scrollLeft-xRelativ;

		yPrompt=document.getElementById("prompt").style.top=event.clientY+document.body.scrollTop-yRelativ;

	}

}
