document.writeln('<style type="text/css" media="screen">#notifyContainer {position:absolute;bottom:0px;right:10px;display:block;overflow:hidden;z-index:9999999999999999999;}#notify {position:absolute;left:0px;width:400px;padding:12px;background-color:#4f4f4f;filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#525252, endColorstr=#0f0f0f);background: -webkit-gradient(linear, left top, left bottom, from(#525252), to(#0f0f0f));background: -moz-linear-gradient(top,  #525252,  #0f0f0f);-moz-border-radius: 16px;-webkit-border-radius: 16px;border-radius: 16px;border: 8px solid #fff;z-index:9999999999999999999;}#notify div.close {position:absolute;top:-7px;right:-7px;width:22px;height:22px;background-image: url(/js/notify/close.png);background-repeat: no-repeat;background-position: left top;cursor:pointer;z-index:9999999999999999999;}#notify #notifyButtons {background-color:#fff;color:#000;padding:5px;-moz-border-radius: 6px;-webkit-border-radius: 6px;border-radius: 6px;margin-top:12px;text-align:left;z-index:9999999999999999999;}#notify #notifyButtons .notifyButton {display:block;width:174px;height:24px;background-image: url(/js/notify/button.png);background-repeat: no-repeat;background-position: left top;cursor:pointer;outline:none;padding:0;font: bold 12px Verdana, sans-serif;line-height:24px;color: #b53717;text-decoration:none;text-shadow: #fff 0px 1px 0px;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;z-index:9999999999999999999;}#notify #notifyTitle {font: bold 12px Verdana, sans-serif;padding-left:68px;background-image: url(/js/notify/icon_default.png);background-repeat: no-repeat;background-position: 7px top;font-size:14px;font-weight:bold;text-align:left;min-height:33px;color:#fff;z-index:9999999999999999999;}#notify #notifyTitle.notifyMessage {background-image: url(/js/notify/icon_message_ani.gif);z-index:9999999999999999999;}</style>');
document.writeln('<div id="notifyContainer"><div id="notify"><div class="close" onclick="closeNotify()"></div><div id="notifyTitle" class="default">Du hast eine neue Nachricht bekommen!</div><div id="notifyButtons"><a href="#" id="notifyButton" class="notifyButton" onclick="notifyButtonClick()">&nbsp;</a></div></div></div>');


var notifyOpen = 0;
var notifyContainerObj = document.getElementById('notifyContainer');
var notifyObj = document.getElementById('notify');
var notifyTitleObj = document.getElementById('notifyTitle');
var notifyBtnObj = document.getElementById('notifyButtons');
var notifyBtnTxtObj = document.getElementById('notifyButton');
var notifyJs;
var notifyWidth = notifyObj.offsetWidth;
var notifyHeight = notifyObj.offsetHeight;
var notifyTargetPosition = 10;
var amountToMove = 3;
var notifyAutoClose;
var notifyReOpen;
var TimeToFade = 500.0;

function isIE() {
  return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent);
}

function getSize() {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	return [ myWidth, myHeight ];
}

function getScrollXY() {
	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}
	return [ scrOfX, scrOfY ];
}

function centerObj(id) {
	var obj = document.getElementById(id);
	var objWidth = obj.offsetWidth;
	var objHeight = obj.offsetHeight;
	var asize = getSize();
	var ascroll = getScrollXY();
	
	obj.style.right = ((asize[0] - objWidth) / 2) - ascroll[0] + 'px';
	obj.style.bottom = ((asize[1] - objHeight) / 2) - ascroll[1] + 'px';
}

function bottomRightObj(id) {
	var obj = document.getElementById(id);
	var objWidth = obj.offsetWidth;
	var objHeight = obj.offsetHeight;
	var asize = getSize();
	var ascroll = getScrollXY();
	
	obj.style.right = (10 - ascroll[0]) + 'px';
	obj.style.bottom = (0 - ascroll[1]) + 'px';
}

function fadeNotify(direction) {
	var element = notifyObj;
	if(element == null)
	return;
	
	if(direction == 'in') {
		element.FadeState = 2;
		element.FadeTimeLeft = TimeToFade;
		setTimeout("animateFade(" + new Date().getTime() + ")", 33);
		element.FadeState = 1;
	}
	else {
		element.FadeState = -2;
		element.FadeTimeLeft = TimeToFade;
		setTimeout("animateFade(" + new Date().getTime() + ")", 33);
		element.FadeState = -1;
	}
}

function animateFade(lastTick) {  
	var curTick = new Date().getTime();
	var elapsedTicks = curTick - lastTick;

	var element = notifyObj;

	if(element.FadeTimeLeft <= elapsedTicks)
	{
		element.style.opacity = element.FadeState == 1 ? '1' : '0';
		element.style.filter = 'alpha(opacity = ' 
		+ (element.FadeState == 1 ? '100' : '0') + ')';
		element.FadeState = element.FadeState == 1 ? 2 : -2;
		
		if(element.FadeState == -2) {
			notifyContainerObj.style.display = 'none';
			notifyContainerObj.style.visibility = 'hidden';
			notifyObj.style.bottom = notifyHeight * (-1) +'px';
		}
		return;
	}

	element.FadeTimeLeft -= elapsedTicks;
	var newOpVal = element.FadeTimeLeft/TimeToFade;
	if(element.FadeState == 1)
	newOpVal = 1 - newOpVal;

	element.style.opacity = newOpVal;
	element.style.filter = 'alpha(opacity = ' + (newOpVal*100) + ')';

	setTimeout("animateFade(" + curTick + ")", 33);
}

function initNotify() {
	notifyObj.style.opacity = 0;
	notifyObj.style.filter = 'alpha(opacity=0)';
	notifyContainerObj.style.width = notifyWidth + 'px';
	notifyContainerObj.style.height = (notifyHeight * 1.5) + 'px';
	notifyContainerObj.style.display = 'none';
	notifyContainerObj.style.visibility = 'hidden';
	notifyObj.style.bottom = notifyHeight * (-1) +'px';
}

function closeNotify() {
	fadeNotify('out');
	notifyOpen = 0;
	window.clearInterval(notifyAutoClose);
}

function notifyButtonClick() {
	closeNotify();
	if(notifyJs) {
		return eval(notifyJs);
	}
}

function scrollNotify() {
	// set container pos
	bottomRightObj('notifyContainer');
	// scroll notify window 
	var currentPosition = parseFloat(notifyObj.style.bottom);
	if(currentPosition < notifyTargetPosition) {
		notifyObj.style.bottom = currentPosition + amountToMove + "px";
		setTimeout("scrollNotify()", 5);
	}
}

function centerNotify() {
	// set container pos
	centerObj('notifyContainer');
	// fade in notify window
	notifyObj.style.bottom = notifyTargetPosition + 'px';		
}

function showNotify(pos) {
	notifyContainerObj.style.display = 'block';
	notifyContainerObj.style.visibility = 'visible';
	
	switch (pos) {
		case "center":
		centerNotify();
		fadeNotify('in');
		break;
	
		default:
		fadeNotify('in');
		scrollNotify();
		break;
	}
	notifyOpen = 1;
}

function pmeNotify(msg, targetJs, btnTxt, pos, icon, autoClose) {
	window.clearInterval(notifyReOpen);
	targetJs = unescape(targetJs);
	if(notifyOpen == 0) {
		
		// set message
		notifyTitleObj.innerHTML = msg;
		
		// set icon
		switch(icon) {
			case "message":
			document.getElementById('notifyTitle').className = 'notifyMessage';
			break;

			default:
			document.getElementById('notifyTitle').className = 'default';
			break;
		}

		// display button and set button text
		if(btnTxt == false || btnTxt == 'false') {
			notifyBtnObj.style.display = 'none';
			notifyBtnObj.style.visibility = 'hidden';
		}
		else {
			notifyBtnObj.style.display = 'block';
			notifyBtnObj.style.visibility = 'visible';
			notifyBtnTxtObj.innerHTML = btnTxt;
		}

		// set autoclose
		if(typeof(autoClose) == 'number') {
			notifyAutoClose = window.setInterval("closeNotify()", autoClose);
		}
		
		// set target
		notifyJs = targetJs;
		
		// show it
		showNotify(pos);
	}
	else {
		// if window is already open: close it and open a new one after a short delay
		closeNotify();
		//notifyReOpen = window.setInterval("alert('"+msg+"')", TimeToFade*1.5);
		escTargetJs = escape(targetJs);
		notifyReOpen = window.setInterval("pmeNotify('"+msg+"', '"+escTargetJs+"', '"+btnTxt+"', '"+pos+"', '"+icon+"', "+autoClose+")", TimeToFade*1.5);
	}
}

initNotify();
