// запишем в глобальную переменную название браузера
var brouser = 'explorer';
if ( navigator.userAgent.indexOf( 'Opera' ) != -1 ) brouser = 'opera';
if ( navigator.userAgent.indexOf( 'Firefox' ) != -1 ) brouser = 'firefox';

function showDiv( obj, event )
{
	obj=document.getElementById('di'+obj.id);
	if (event) {

		obj.style.display="block";
		
		var x = document.all ? window.event.x + document.body.scrollLeft : e.pageX;
                var y = document.all ? window.event.y + document.body.scrollTop  : e.pageY;
		var docWidth = document.all ? document.body.clientWidth : window.innerWidth;
		var docHeight = document.all ? document.body.clientHeight : window.innerHeight;

		if ( ( obj.offsetWidth + x + 20 ) > docWidth ) {
			obj.style.left = docWidth - obj.offsetWidth - 8;
		}
		else obj.style.left = x + 10;

		if ( ( obj.offsetHeight + window.event.y + 20 ) > docHeight ) {
			obj.style.top = y - obj.offsetHeight - 15;
		}
		else obj.style.top = y + 10;
	}
	else obj.style.display = "none";
}

function moveDiv( obj )
{
	obj=document.getElementById('di'+obj.id);

	var x = document.all ? window.event.x + document.body.scrollLeft : e.pageX;
	var y = document.all ? window.event.y + document.body.scrollTop  : e.pageY;
	var docWidth = document.all ? document.body.clientWidth : window.innerWidth;
	var docHeight = document.all ? document.body.clientHeight : window.innerHeight;

	if ( ( obj.offsetWidth + x + 20 ) > docWidth ) {
		obj.style.left = docWidth - obj.offsetWidth - 8;
	}
	else obj.style.left = x + 10;

	if ( ( obj.offsetHeight + window.event.y + 20 ) > docHeight ) {
		obj.style.top = y - obj.offsetHeight - 15;
	}
	else obj.style.top = y + 10;
}

function linkDiv( id )
{
	var x = document.all ? window.screenLeft : window.screenX;
	var y = document.all ? window.screenTop  : window.screenY;
	
	window.open('/adm/dictionary.php?word='+id,targetWindow,'alwaysRaised=1,dependent=1,fullscreen=0,height=400,width=350,location=0,menubar=0,resizeable=0,left='+(targetWindow=='Dictionary'?0:(x+30)+',top='+(y+30))+',screenX=0,toolbar=0,scrollbars=1');
}

var targetWindow='Dictionary';
