// Autor: Tomasz Macjejak
// Modernizacja: Kazimierz M. Janeczko
// Modernizacja: Lele

function Is ()
{   
    var agt=navigator.userAgent.toLowerCase()

    this.major = parseInt(navigator.appVersion)

    this.nav  = ((agt.indexOf('mozilla')!=-1) && ((agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1)))
    this.nav4 = (this.nav && (this.major == 4))
    this.nav4up = this.nav && (this.major >= 4)

    this.ie   = (agt.indexOf("msie") != -1)
    this.ie4  = (this.ie && (this.major == 4))
    this.ie4up  = this.ie  && (this.major >= 4)
}
var is = new Is();


function maketheBalloon(id, message)
{
   //var theString = '<STYLE TYPE="text/css">#'+id+'{widthh:'+width+';}</STYLE>';
   var theString = '<STYLE TYPE="text/css">#'+id+'</STYLE>';
   theString+='<DIV CLASS="balloon" id="'+id+'">'+message+'</DIV>';
   document.write(theString);
}


var TimerID = null;
function wlacz_dymek(id)
{
	    if (is.nav4up) {
	        document.layers[id].visibility="show";
	    }
	    else {
	        document.all[id].style.visibility="visible"
	    }
	clearTimeout(TimerID);
}

function makeItVisible(id, event, delay)
{	
		xx=2; 
		yy=20;
	    if (is.nav4up) {
				// ustawienie dymka jsli wykracza poza okno
				if (event.pageX > window.innerWidth - 200) {
					xx=event.pageX-window.innerWidth+180;
					if (event.pageY > window.innerHeight - 60) {yy=-50};
				}
				else
				if (event.pageY > window.innerHeight - 60) {xx=xx-20;yy=-(event.pageY - window.innerHeight+40);}
	        document.layers[id].left = event.pageX - xx;
	        document.layers[id].top = event.pageY + yy;;
	        //document.layers[id].visibility="show";
	    }
	    else {
				// ustawienie dymka jesli wykracza poza okno
				if (document.body.scrollLeft + event.clientX > document.body.clientWidth - 200) {
					xx=document.body.scrollLeft + event.clientX - document.body.clientWidth+180;
					if (event.clientY > document.body.clientHeight - 60) {yy=-50};
				}
				else
				if (event.clientY > document.body.clientHeight - 60) {xx=xx-20;yy=-(event.clientY - document.body.clientHeight+40);}
	        document.all[id].style.pixelLeft = (document.body.scrollLeft +event.clientX) - xx;
	        document.all[id].style.pixelTop = (document.body.scrollTop + event.clientY) + yy;
	        //document.all[id].style.visibility="visible"
	    }
	id2=id;
	TimerID = setTimeout("wlacz_dymek(id2)",delay);
}


function hideHelp(id)
{
	is.nav4up ? document.layers[id].visibility="hide" : document.all[id].style.visibility="hidden";
	clearTimeout(TimerID);
}
