function doPopup(layer,obj) {
	  
	  if (!document.getElementsByTagName) return false; 
	  var helpTextDiv = layer;
  	  if(helpTextDiv.style.display == "block"){
			helpTextDiv.style.display = 'none';
	}else{
					/* display popup */
						helpTextDiv.style.zIndex = '10';
						helpTextDiv.style.display = 'block';
						helpTextDiv.style.position = 'absolute';
						//helpTextDiv.style.right = right;
						var coors = findPos(obj);
						coors[0] -= helpTextDiv.offsetWidth;
						coors[1] += 20;
						helpTextDiv.style.top = coors[1] + 'px';
						helpTextDiv.style.left = coors[0] + 'px';
						helpTextDiv.focus();
					} 
	 
}


function closePopups(layer){
		ThisPopup = document.getElementById(layer);						
		if(ThisPopup.style.display == "block"){
			ThisPopup.style.display = 'none';
		}
}




function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

function findPos(obj)
{
	
	var curleft = curtop = 0;
	
	if (obj.offsetParent) {
	
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}


