try {
	document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}

function findPosX(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	} else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	} else if (obj.y)
		curtop += obj.y;
	return curtop;
}

/*
USAGE:
	set					[booloan]		turn the balloon on/off
	fade				[boolean]		fade the balloon in and out.
													Will pass on to events initated by onclick and autoaccept
	message 		[string]		set the message of the balloon (text/html)
	autoaccept	[boolean]		time in millisecons what the balloon disappears. 
													If action is set, then it will also be fired.
													Ignored if set to zero.
	action			[string]		Will be attached to the onclick event of the balloon
													If autoaccept is set and the user hasn't clicked the balloon, will be fired after fading out is complete
													Only accepts javascript, but location.href=http://..?val=1 can also be used
													Ignored if the string is empty or set to zero.
													The value needs slashes to be applied
*/

var pending_hide = null;
function balloon(set,fade,message,autoaccept,action) {
	var pending_action = "";
	if(set) { clearTimeout(pending_hide); }
	var bn = document.getElementById("balloon");
	bn.style.left = findPosX(document.getElementById("header")) + 130 + "px";
	if(autoaccept && set) {
		pending_hide = setTimeout("balloon(0,"+fade+",'',0,'')",autoaccept);
		if(action) { pending_action = window.setTimeout(action,autoaccept+150); } // fading takes about 150ms
	}
	bn.getElementsByTagName("SPAN")[0].innerHTML = message;
	if(action) {
		bn["onclick"] = new Function(action + "; clearTimeout('"+pending_action+"'); balloon(0,"+fade+",'',0,'')");
	} else {
		bn["onclick"] = new Function("clearTimeout('"+pending_action+"'); balloon(0,"+fade+",'',0,'')");
	}
	if(fade) {
		if(set) {
			bn.className = "balloon_fade_20";
			bn.style.display = "block";
			for(i=2;i<=4;i++) {
				setTimeout("document.getElementById('balloon').className = 'balloon_fade_"+(i*20)+"'",i*35);
			}
			setTimeout("document.getElementById('balloon').className = ''",140);
		} else {
			bn.className = "balloon_fade_80";
			for(i=3;i>0;i--) {
				setTimeout("document.getElementById('balloon').className = 'balloon_fade_"+(i*20)+"'",(4-i)*25);
			}
			setTimeout("document.getElementById('balloon').style.display = 'none'",100);
		}
	} else {
		bn.style.display = set ? "block" : "none";
	}
}

var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height){
  	if(popUpWin){
		if(!popUpWin.closed) popUpWin.close();
	}
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function lehm() {
	setTimeout('balloon(1,1,"PIIM EI TULE POEST",5000,"");',700);
}
