//	owad.js

/*	(c) 2001 Winfried Huslik, winfried@huslik.de
	version 2001-06-29
*/


// submit on /*return or*/ enter (c)Huslik:
document.onkeypress=function k(evt){
	var k=document.all?window.event.keyCode:evt.which;
	if(k==3 /*||k==13*/){	// not on return
		document.forms[0].submit();
		return false;
	} else {
		if (ofs) smile();
	}
}






function resetTimer() {
	clearTimeout(timerID);
	timerID = null;
}

function pup(cap,tx,sd) {
	resetTimer();
	sw = 500;
	if (window.innerWidth)  sw = window.innerWidth;
	else if (self.innerWidth) sw = self.innerWidth; 
	else if (document.body) sw = document.body.clientWidth;
	w = 250;
	w = Math.min(w,sw-5);
	w1 = 25;
	w2 = w-w1;
	x = Math.max(5,Math.min(x+w1/2,sw-w-5));
	snd = sd;
	ht1 = '<a href="JavaScript:doSound(snd)" onmouseover="doSound(snd)" onmouseout="pof()">' +
		'<img class="popSp" src="img/_speaker.gif" width=16 height=16 alt="" border=0></a>';
	htm = '<table width='+ (w1+w2) +' border=0 cellspacing=0 cellpadding=0>' +
		'<tr><td class="popSp" width='+ w1 +' rowspan=2>'+ ht1 +'</td>' + 
			'<td class="popCp" width='+ w2 +'>'+ cap +'</td></tr>' +
		'<tr><td class="popTx">'+ tx +'</td></tr></table>\r\n';
	if (document.getElementById) {
		px = document.all ? 'px' : '';
		document.getElementById('popDiv').innerHTML = htm;
		document.getElementById('popDiv').style.left = x + px;
		document.getElementById('popDiv').style.top = y + px;
		document.getElementById('popDiv').style.visibility = "visible";
	} else if (document.all) {
		document.all["popDiv"].innerHTML = htm; 
		document.all["popDiv"].style.left = x + 'px';
		document.all["popDiv"].style.top  = y + 'px';
		document.all["popDiv"].style.visibility = "visible";
	} else if (document.layers) { 
		document.popDiv.document.write(htm);
		document.popDiv.document.close();
		document.popDiv.left = x;
		document.popDiv.top  = y;
		document.popDiv.visibility = "show";
	}
}

function doSound(snd) {
	resetTimer();
	if (document.layers) { // see JavaScript Client Guide pages 273 ff
		url='http://www.owad.de/wav/'+snd+'.wav'
		neuesFenster = open(url,"soundfenster","height=50,width=200");
	} else if (document.all) {
		document.all.sndDiv.innerHTML = 
			'<embed src="http://www.owad.de/wav/'+snd+'.wav" hidden=true>\n';
	} else if (document.getElementById) {
		document.getElementById('sndDiv').innerHTML = 
			'<object data="http://www.owad.de/wav/'+snd+'.wav" type="audio/x-wav" width=0 height=0></object>\n';
	}
}

function mm(e) {
	if (document.layers) {	// only NS4
		x = e.layerX;
		y = e.layerY;
	} else if (window.Event) {	// NS6=ok, not NS4
		x = e.pageX ;
		y = e.pageY;
	} else if (document.getElementById) {	// IE=ok, Opera=ok, not NS4, not iCAP
		x = event.x + document.body.scrollLeft;
		y = event.y + document.body.scrollTop;
	} else if (document.all) {	// IE=ok, Opera=funny, not iCAB, not NS4
		x = event.x;
		y = event.y;
	}
}


var timerID = null;

