var tipx = 0, tipy = 0, deltaY = new Array( 500 ), deltaX = new Array( 500 );
var ns4 = ( document.layers ) ? true : false;
var ns6 = ( document.getElementById ) ? true : false;
var ie4 = ( document.all ) ? true : false;
var ie5 = false;

if( ie4 ){
	if( ( navigator.userAgent.indexOf( 'MSIE 5' ) > 0 ) || ( navigator.userAgent.indexOf( 'MSIE 6' ) > 0 ) )ie5 = true;
	if( ns6 )ns6 = false;
}
if( ns4 || ie4 || ns6 ){
	document.onmousemove = setpos;
	if( ns4 )document.captureEvents( Event.MOUSEMOVE )
}

function setpos( evt ){
	if( ns4 || ns6 ){
		tipx = evt.pageX;
		tipy = evt.pageY;
	}
	if( ie4 ){
		tipx = event.x;
		tipy = event.y;
	}
	if( ie5 ){
		tipx = event.x + document.body.scrollLeft;
		tipy = event.y + document.body.scrollTop;
	}
	tipx += 20; tipy += 20;
}

function makeLayer( LayerName, LayerText, X, Y, Width, Height ){
	if( ie4 || ns6 || ns4 ){
		str = '<div class="tip" ID="' + LayerName + '"><table ' + ( Width ? 'width=' + Width : '' ) + ' bgcolor="#000000" cellspacing="1" cellpadding="0"><tr><td><table bgcolor="#FFFFFF" border="0" cellspacing="5" cellpadding="0"><tr><td class=text><div align=justify>' + LayerText + '</div></td></tr></table></td></tr></table></div>';
		document.write( str );
		hideLayer( LayerName );
		moveLayer( LayerName, 0, 0 );
	}
	deltaY[LayerName] = ( Y ? Y : 0 );
	deltaX[LayerName] = ( X ? X : 0 );
}

function showLayer( LayerName ){
	if( ns4 )
		document[LayerName].visibility = 'visible';
	if( ns6 )
		document.getElementById( LayerName ).style.visibility = 'visible';
	if( ie4 )
		document.all[LayerName].style.visibility = 'visible';
}

function moveLayer( LayerName, x, y ){
	if( ns4 ){
		document.layers[LayerName].left = x;
		document.layers[LayerName].top = y;
	}
	if( ns6 ){
		document.getElementById( LayerName ).style.left = x;
		document.getElementById( LayerName ).style.top = y;
	}
	if( ie4 ){
		document.all[LayerName].style.left = x;
		document.all[LayerName].style.top = y;
	}
}

function hideLayer( LayerName ){
	if( ns4 )
		document[LayerName].visibility = 'hidden';
	if( ns6 )
		document.getElementById( LayerName ).style.visibility = 'hidden';
	if( ie4 )
		document.all[LayerName].style.visibility = 'hidden';
}

function showTip( LayerName, x, y ){
	moveLayer( LayerName, 
		x ? x : tipx + ( deltaX[LayerName] != 0 ? deltaX[LayerName] : ( tipx > 400 ? -200 : 0 ) ),
		y ? y : tipy + deltaY[LayerName] );
	showLayer( LayerName );
}

function hideTip( LayerName ){
	hideLayer( LayerName );
}

function pokazmaleokno( url, w, h, x, y ){
	pop = window.open( url, 
		'maleokno','left='+( x ? x : 60 )+', top='+( y ? y : 0 )+', scrollbars=yes, height='+h+', width='+w );
	pop.focus();
}

function pokazmaleokno2( url, w, h, x, y ){
	pop = window.open( url,
		'maleokno2','left='+( x ? x : 60 )+', top='+( y ? y : 0 )+', scrollbars=yes, height='+h+', width='+w );
	pop.focus();
}

var vCzasPracy = 0;
var iCzasPracy;
function zegarCzasuPracy( CzasPracy ){

	if( CzasPracy )iCzasPracy = CzasPracy;
	vCzasPracy += 5;
	iCzasPracy.value = ',' + vCzasPracy;
	setTimeout( 'zegarCzasuPracy()', 300000 );
}

