function findPos(objId) 
{

	var curleft = curtop = 0;   
	
  var obj=document.getElementById(objId);
  
//If the browser supports offsetParent we proceed.

	if (obj.offsetParent) 
	{

//Every time we find a new object, we add its offsetLeft and offsetTop to curleft and curtop.

	do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;

//The tricky bit: return value of the = operator

//Now we get to the tricky bit:

		} while (obj = obj.offsetParent);

//No, this is not a syntax error. I don't want to use == to compare obj to obj.offsetParent (that doesn't make sense anyhow, since an element is never equal to its offsetParent).

//Instead, I use the = assignment operator to change the value of obj to obj.offsetParent. I explain this trick in more detail in this blog post.
//The simple bits

//The loop continues until the object currently being investigated does not have an offsetParent any more. While the offsetParent is still there, it still adds the offsetLeft of the object to curleft, and the offsetTop to curtop.

//Finally, when the while loop has quit, we return an array with the calculated coordinates to whichever script asked for it.

	return [curleft,curtop];
  } 
}

function placeBanner()
{ 
	if (! document.getElementById('bannerDiv')) return;
	
	var bannerDivTop=findPos('bannerDiv')[1];
//	var beforeBannerTop=findPos('beforeBanner')[1];
	var afterBannerTop=findPos('afterBanner')[1];
	
	var spaceSize=(afterBannerTop - bannerDivTop - 190) / 2;
	
//	var bannerTopPos=bannerDivTop + spaceSize;
	
//	var topPos=bannerDivTop - bannerTopPos;
	
	document.getElementById('bannerDiv').style.top=spaceSize - 5;
	document.getElementById('bannerDiv').style.visibility='visible';
}

function gnPopUp(main,win_width,win_height)
{
	window.open( "popUp.php?main="+main+"","Bamarom","scrollbars=1, width="+win_width+" height="+win_height+"" )
}
