
var mouseonmenu = '';
var openlayer = '';
var timercode = 0;
var onmenu = 0;
var setoff = 0;

function showmenu(lay) {
	setoff=1;

	if(openlayer != '' )
		document.getElementById(openlayer).style.visibility = 'hidden';

	document.getElementById(lay).style.visibility = 'visible';
	openlayer = lay;
}

function hidemenu(lay) {
	setoff=0;

	var zeit = new Date();
	timercode = zeit.getMilliseconds()*1000 +  zeit.getSeconds();

	setTimeout('resetmenu()',2000);
}

function resetmenu() {
	if(setoff==1) { setTimeout('resetmenu()',2000); return 0; }
	var current = new Date();
	current = current.getMilliseconds()*1000 +  current.getSeconds();
	if(timercode + 1900 > current) return 0;

	if(onmenu==1) {
		timercode = current;
		setTimeout('resetmenu()',2000);
		return 0;
	}
	if(openlayer!='')
		document.getElementById(openlayer).style.visibility = 'hidden';
	openlayer = '';
}

function menuover() {
	onmenu=1;
}
function menuout() {
	onmenu=0;
}

function open_window(url,windowname,w,h) {
	uw = window.open(url, windowname, 'toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=no,top=50,left=50,copyhistory=no,width='+w+',height='+h);
	uw.focus();
 	if (!uw.opener) uw.opener = self;
}

function rewriteMailto(idname) {

	if(!(obj = document.getElementById(idname))) return false;

	thelinks = obj.getElementsByTagName('a');
	for(i=0;i<thelinks.length;i++) {
		thelinks[i].innerHTML = thelinks[i].innerHTML.replace(/\[AT/g, "@");
		thelinks[i].innerHTML = thelinks[i].innerHTML.replace(/\[DT/g, ".");
		var link_href = thelinks[i].getAttribute('href');
		if(!link_href) continue;
		link_href = link_href.replace(/\[DT/g, ".");
		link_href = link_href.replace(/\[AT/g, "@");
		thelinks[i].setAttribute('href',link_href);
	}
}

function open_gamewindow(url,windowname,w,h) {
	uw = window.open(url, windowname, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,top=50,left=50,copyhistory=no,width='+w+',height='+h);
	uw.focus();
 	if (!uw.opener) uw.opener = self;
}
