function close_leaving_popupbox(){
	toggleVisibility("popup_shell","none");
}

function leaving_popup(popup_url){ 
	var link_ext=document.getElementById("link_external");
	if(link_ext==null) return;
	
	link_ext.href=popup_url;
	var div_pop=document.getElementById("popup_shell");
	moveObject(div_pop)
	toggleVisibility("popup_shell","block");	
} 

function toggleVisibility(objId,visibility)
{
    obj=document.getElementById(objId);
    if(obj!=null){obj.style.display = visibility;}
}

function moveObject( obj ) 
    {
		var offset = -25;
		var objHolder = obj;
		var windowHeight =  windowSize();
		var scrollY = getScrollXY();
		var xFactor=(screen.width<=1024?.23:.25);
		var yFactor=(screen.heigth<=768?.20:.35);
		
		var tempX = (document.body.clientWidth * xFactor);	  
		var tempY = 1 * scrollY + (windowHeight * yFactor);

		if (tempX < 0){tempX = 0}
		if (tempY < 0){tempY = 0}

		obj.style.top  = (tempY + offset) + 'px';
		obj.style.left = (tempX + offset) + 'px';
  }

  //get window height + width
  function windowSize() 
  {
	  var iWidth = 0, iHeight = 0;
	  if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		iWidth = window.innerWidth;
		iHeight = window.innerHeight;
	  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		iWidth = document.documentElement.clientWidth;
		iHeight = document.documentElement.clientHeight;
	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		iWidth = document.body.clientWidth;
		iHeight = document.body.clientHeight;
	  }
  		return  iHeight;
  }

  //gets scroll
  function getScrollXY() {
	  var scrOfX = 0, scrOfY = 0;
	  if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	  }
	 // return [ scrOfX, scrOfY ];
	  return [ scrOfY ];
  }