// Allows multiple functions to load

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

//addLoadEvent(displayAddToBasket);

function displayAddToBasketOld() {
	eleAddToBasket = document.getElementById("readMore");
  	eleAddToBasket.onclick =
    function() {
		eleConformation = document.getElementById("outerPopup");
		eleConformation.style.display = "block"
	}
	eleConformation = document.getElementById("outerPopup");
	eleConformationLinks = eleConformation.getElementsByTagName("a");

	for (var i=0; i < eleConformationLinks.length; i++) {
		eleConformationLinks[i].onclick =
   		function() {
   			eleConformation.style.display = "none"
   		}
	}
}

function displayPopup(pID) 
{

	// close all other popups if they are opened
	for (var i= 1; i<=4; i++)
	{
		eObject = document.getElementById("outerPopup" + i);
		if (eObject)
			eObject.style.display = "none";
	}
	
	
	eleConformation = document.getElementById("outerPopup" + pID);
	
	var winY = document.body.scrollTop;
	eleConformation.style.top = winY + 10;
	eleConformation.style.display = "block"

	eleConformation = document.getElementById("outerPopup" + pID);
	eleConformationLinks = eleConformation.getElementsByTagName("a");

	for (var i=0; i < eleConformationLinks.length; i++) {
		eleConformationLinks[i].onclick =
   		function() {
   			eleConformation.style.display = "none"
   		}
	}
}

