/*
  teamworks AddOnPack v 1.01 2004/10/15 08:15:00 sk
  
  teamworks AddOn, Design and Code Modifications
  Copyright (c) 2004 teamworks - Sebastian Krupp
  mail: s.krupp@teamworks4d.de
*/

//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=22,bh=50;
	else if(nn6) cp=2,cs=2,th=22,bh=35;
	else cp=2,cs=2,th=22,bh=35; //wg. Layout

	document.write(
		"<div style='position:absolute;top:-500;left:0;z-index:1000' id='alert'>"+
		"<table style='border-style:outset;border-width:1;border-color:#E6E6CD;background-color:#CCCCCC' cellpadding='"+cp+"' cellspacing='"+cs+"' width='"+alertWidth+"' height='"+alertHeight+"' onmousedown='getxyRelativ()' onmousemove='moveAlert()' onmouseup='moveStatus=0'>"+
			"<tr><td height='"+th+"' bgcolor='#F3F3F3' style='border: 1px; border-style: solid; border-color: #CC0000;'>"+alertTitle+"</td></tr>"+
			"<tr><td>"+alertText+"</td></tr>"+
			"<tr align='center'><td height='"+bh+"'>"+
				"<input style='background-color:#F3F3F3;border-width:1;' type='button' value=' OK ' onclick='okAlert()' onfocus='if(this.blur)this.blur()'>"+
			"</td></tr>"+
		"</table>"+
		"</div>"
	);
}

// Box anzeigen
function showAlert() {
	moveStatus=0;

if(nn6||op5) {	
	var l = (window.innerWidth - 365) / 2;
	var t = (window.innerHeight - 220) / 2;	
}

if(ie5) {
	var l = (document.body.offsetWidth - 365) / 2;
	var t = (document.body.offsetHeight - 220) / 2;
}

/*	
	var l = (screen.availWidth - 350) / 2;
    var t = (screen.availHeight - 350) / 2;
*/

	xAlert=l, yAlert=t;
	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;
	}
}
