function pausecomp(millis)
{
	date = new Date();
	var curDate = null;

	do { var curDate = new Date(); }
	while(curDate-date < millis);
}

function Is ()
{   
     var agt=navigator.userAgent.toLowerCase()
     this.major = parseInt(navigator.appVersion)
     this.minor = parseFloat(navigator.appVersion)
     this.nav  = ((agt.indexOf('mozilla')!=-1) && ((agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1)))
     this.nav2 = (this.nav && (this.major == 2))
     this.nav3 = (this.nav && (this.major == 3))
     this.nav4 = (this.nav && (this.major == 4))
     this.ie   = (agt.indexOf("msie") != -1)
     this.ie3  = (this.ie && (this.major == 2))
     this.ie4  = (this.ie && (this.major == 4))
     this.opera = (agt.indexOf("opera") != -1)
     this.nav4up = this.nav && (this.major >= 4)
     this.ie4up  = this.ie  && (this.major >= 4)
}

Is = new Is();
imgopen = new Image();
imgopen.src = "grafika/show.gif";
imgclose = new Image();
imgclose.src = "grafika/hide.gif";
var opened = new Array();
var toclose = "";
var waittofinish = 0;

function Menuclose(id) {
		waittofinish=1;
		if (Is.ie4up && 0)  {
			eval('document.all.menu_content_'+id+'.style.overflow = \'hidden\'');
		} else
		eval('suma=0; for (i=0;i<document.getElementById("menu_content_'+id+'").childNodes.length;i++)	{ if (document.getElementById(\'menu_content_'+id+'\').childNodes.item(i).offsetHeight) { suma=suma+document.getElementById(\'menu_content_'+id+'\').childNodes.item(i).offsetHeight;  }} zwin(\''+id+'\',suma,\'init\'); ');
		opened[id] = 0;
}
function zwin(id,height,nextval) {
	if(nextval=='init') nextval=height-1;
//	clearTimeout(timeoutz);
	if (nextval>1) {
		eval('document.getElementById(\'menu_content_'+id+'\').style.height='+nextval);
		nextval=nextval-4;
		setTimeout('zwin(\''+id+'\','+height+','+nextval+')',3);
	} else {
		eval('document.getElementById(\'menu_content_'+id+'\').style.height=1');
		waittofinish=0;
	}
}
function rozwin(id,height,nextval) {
	if(nextval=='init') nextval=1;
//	clearTimeout(timeoutr);
	if (nextval<height) {
		eval('document.getElementById(\'menu_content_'+id+'\').style.height='+nextval);
		nextval=nextval+4;
		setTimeout('rozwin(\''+id+'\','+height+','+nextval+')',3);
	} else {
		eval('document.getElementById(\'menu_content_'+id+'\').style.height='+height);
		waittofinish=0;
	}
}

function Menuopen(id) {
		waittofinish=1;
		if (Is.ie4up && 0)  {
			eval('document.all.menu_content_'+id+'.style.overflow = \'visible\'');
		} else
		   {
			eval('suma=0; for (i=0;i<document.getElementById("menu_content_'+id+'").childNodes.length;i++)	{ if (document.getElementById(\'menu_content_'+id+'\').childNodes.item(i).offsetHeight) { suma=suma+document.getElementById(\'menu_content_'+id+'\').childNodes.item(i).offsetHeight;  }} rozwin(\''+id+'\',suma,\'init\'); ');
			}
		opened[id] = 1;
}


function poolmenu(id) {
	if (toclose != id && opened[toclose]==1) {
		Menuclose(toclose);
	}
	toclose=id;
	if (opened[id] == 1)
		Menuclose(id);
	else
		Menuopen(id);
}

