var IE = document.all?true:false


function openDisplayLink(num, e, link, displayflag){

  // Close any open popups
  var i=0;
  for (i=0; i<4; i++) {
	closeDisplay(i);
  }
  
  var popup = document.getElementById("popup" + num);
  var mX = 0
  var mY = 0

  if (IE) {
	var arrScrollXY = getScrollXY();
    mX = event.clientX + arrScrollXY[0]
    mY = event.clientY + arrScrollXY[1]
  } else {  
    mX = e.pageX
    mY = e.pageY
  }  

  if (mX < 0){mX = 0}
  if (mY < 0){mY = 0}  
  
  if (displayflag)
  {
      //document.getElementById("edulink"+num).innerHTML = '<b>To register, click here for <a href="https://www.registeredu.com/?eventid='+link+'">Workshop Registration </a></b>';
      document.getElementById("edulink"+num).innerHTML = '<b>To register, please contact your Biosense Webster representative, or call the Registration Department at 877-477-6333.</b>';
      document.getElementById("contactlink"+num).style.display = 'none';
  }
  else {
      document.getElementById("edulink"+num).innerHTML = '';
      document.getElementById("contactlink"+num).style.display = 'none';
  }
  // Find left edge of containing div and add to that to center the popup
  var leftEdge = findPos(document.getElementById("contentMiddle"))[0];
  popup.style.left = (leftEdge + 31) + "px";
    
  //popup.style.left = (mX - 600) + "px";
  popup.style.top = (mY - 135) + "px";
  
  // Show the popup
  popup.style.display = "inline";
}



function openDisplay(num, e){

  // Close any open popups
  var i=0;
  for (i=0; i<4; i++) {
	closeDisplay(i);
  }
  
  var popup = document.getElementById("popup" + num);
  var mX = 0
  var mY = 0

  if (IE) {
	var arrScrollXY = getScrollXY();
    mX = event.clientX + arrScrollXY[0]
    mY = event.clientY + arrScrollXY[1]
  } else {  
    mX = e.pageX
    mY = e.pageY
  }  

  if (mX < 0){mX = 0}
  if (mY < 0){mY = 0}  


  // Find left edge of containing div and add to that to center the popup
  var leftEdge = findPos(document.getElementById("contentMiddle"))[0];
  popup.style.left = (leftEdge + 31) + "px";
    
  //popup.style.left = (mX - 600) + "px";
  popup.style.top = (mY - 135) + "px";
  
  // Show the popup
  popup.style.display = "inline";
}

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 ];
}

function closeDisplay(num){
  var popup = document.getElementById("popup" + num);
  popup.style.display = "none";
}

// Find the x,y coordinates of an element
// http://www.quirksmode.org/js/findpos.html
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];
}

