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

//Nur für IE 5+, NN6+ und Opera 5+
ie5=(document.getElementById && document.all && document.styleSheets)?1:0;
nn6=(document.getElementById && !document.all)?1:0;
op5=(document.getElementById&&document.all&&!document.styleSheets)?1:0;

// Alertbox erstellen
if(ie5||nn6||op5) {
	if(ie5) cp=5,cs=2,th=30,bh=50;
	else if(nn6) cp=2,cs=0,th=22,bh=35;
	else cp=5,cs=0,th=15,bh=20; //wg. Layout

	document.write(
		"<div style='position:absolute;top:-1000;left:0;z-index:100' id='alert'>"+
		"<table style='border-style:outset;border-width:2;border-color:#E6E6CD;background-color:#F5F5DC' cellpadding='"+cp+"' cellspacing='"+cs+"' width='"+alertWidth+"' height='"+alertHeight+"' onmousedown='getxyRelativ()' onmouseup='moveStatus=0'>"+
			"<tr><td colspan='2' height='"+th+"' bgcolor='#DEDEC5'>"+alertTitle+"</td></tr>"+
			"<tr><td width='60' align='center' valign='top'><img src='images/billboard/mfb_baer.jpg' border='1' style='width:55px;'></td><td>"+alertText+"</td></tr>"+
			"<tr align='center'><td colspan='2' height='"+bh+"'>"+
				"<input style='background-color:#E9E9CF;border-width:1;font-weight:bold' type='button' value='&nbsp; &nbsp; OK &nbsp; &nbsp;' onclick='okAlert()' onfocus='if(this.blur)this.blur()'>"+
			"</td></tr>"+
		"</table>"+
		"</div>"
	);
}

// Box anzeigen
function showAlert() {
	moveStatus=0;
	xAlert=xAlertStart, yAlert=yAlertStart;
	if(ie5) {
		document.getElementById("alert").style.left=xAlert+document.body.scrollLeft;
		document.getElementById("alert").style.top=yAlert+document.body.scrollTop;
		document.getElementById("alert").style.visibility="visible";
	}
	else if(nn6||op5) {
		document.getElementById("alert").style.left=xAlert+window.pageXOffset;
		document.getElementById("alert").style.top=yAlert+window.pageYOffset;
		document.getElementById("alert").style.visibility="visible";
	}
	else alertAlternative();
}

// Relative Mausposition ermitteln
var xRelativ, yRelativ;
function getxyRelativ() {
	moveStatus=1;
	if(ie5) {
		xRelativ=event.clientX-xAlert;
		yRelativ=event.clientY-yAlert;
	}
}

// Verschieben nur für IE
function moveAlert() {
	if(ie5&&moveStatus>0) {
		xAlert=document.getElementById("alert").style.left=event.clientX+document.body.scrollLeft-xRelativ;
		yAlert=document.getElementById("alert").style.top=event.clientY+document.body.scrollTop-yRelativ;
	}
}
