function kasuj(elmnt)
{
	elmnt.value="";
}

function on(elmnt)
{
	elmnt.style.background = "#ABCDAD";
	elmnt.firstChild.style.color = "#355737";
}

function off(elmnt)
{
	elmnt.style.background = "#8BB38D";
	elmnt.firstChild.style.color = "white";
}
function showSubMenu(id,id2)
{
	document.getElementById(id).style.visibility="visible";
	id2.style.background = "#ABCDAD";
	id2.firstChild.style.color = "#355737";
}

function hideSubMenu(id,id2)
{
	document.getElementById(id).style.visibility="hidden";
	id2.style.background = "#8BB38D";
	id2.firstChild.style.color = "white";
}

function pokazUkryj(id,b) {
	if(b)
   	document.getElementById(id).style.display = "block";
	else
   	document.getElementById(id).style.display = "none";
	return false;
}


function pokaz(elmnt,event) 
{
	divy = document.getElementsByTagName("div");
	for(var i=0; i < divy.length; i++)
	{
		if(divy[i]==elmnt)
		{
		 	i += 2;

      przesun(elmnt,event);
			divy[i].style.top = pozycjaTop + "px";
      divy[i].style.left = pozycjaLeft + "px";
			divy[i].style.display = "block";
		}
	}
}

function ukryj(elmnt) 
{
	divy = document.getElementsByTagName("div");
	for(var i=0; i < divy.length; i++)
	{
		if(divy[i]==elmnt)
		{
		 	i += 2;		
			divy[i].style.display = "none";
		}
	}
}

function popup(elmnt)
{
	window.open(elmnt.getAttribute('href'), "", "width=750, location=no, menubar=no, resizable=no, scrollbars=no, status=no, height=430");
}
function popupbig(elmnt)
{
	window.open(elmnt.getAttribute('href'), "", "width=900, location=no, menubar=no, resizable=no, scrollbars=no, status=no, height=580");
}
function popup2(a,w,h)
{
	window.open(a, "", "width="+w+", location=no, menubar=no, resizable=no, scrollbars=no, status=no, height="+h);
  return false;
}

function popupImg(elmnt)
{
	window.open(elmnt.getAttribute('href'), "", "width=750, location=no, menubar=no, resizable=no, scrollbars=no, status=no, height=430");
}

function przesun(elmnt,event)
{
	divy = document.getElementsByTagName("div");

	przesuniecieX= 0;
	przesuniecieY= 0;
	
  if(document.documentElement && (document.documentElement.scrollTop || document.documentElement.scrollLeft)) {
	 	przesuniecieX = document.documentElement.scrollLeft;
	 	przesuniecieY = document.documentElement.scrollTop;
    wymiarX = document.documentElement.offsetWidth;		
    wymiarY = document.documentElement.offsetHeight;		
	}
  else if(document.body)
	{
	 	przesuniecieX = document.body.scrollLeft;
	 	przesuniecieY = document.body.scrollTop;
    wymiarX = document.body.offsetWidth;		
    wymiarY = document.body.offsetHeight;		
	}
	else
	{
	 	przesuniecieX = window.pageXOffset;
	 	przesuniecieY = window.pageYOffset;
  }
  	
	for(var i=0; i < divy.length; i++)
	{
		if(divy[i]==elmnt)
		{
			i+=2;

			pozycjaTop = event.clientY + przesuniecieY + 15;
		 	pozycjaLeft = event.clientX + przesuniecieX + 15;
      
      if(wymiarX - 245 < pozycjaLeft) {
			  pozycjaTop = pozycjaTop + (pozycjaLeft - wymiarX + 245)/3;
			  pozycjaLeft = wymiarX - 245;
			}

			divy[i].style.top = pozycjaTop + "px";
			divy[i].style.left = pozycjaLeft + "px";
			/*window.status="pozycjaLeft: " + pozycjaLeft + "pozycjaTop: " +pozycjaTop+  " computedStyle.left: " + window.getComputedStyle(divy[i], null).position;*/
		}
	}
}

function checkQuery(ifThis,thenShow) {
	query = document.getElementById('wyszPole').value;
  if (query == ifThis) {
    alert (thenShow);
    return false;
  }
  if(query == "")
    return false;
  return true;
}


