function showAd(adPicSrc,w,h){
	if (document.getElementById("popupAd")) return;
	var portSize = getViewportSize();
	var parent = document.getElementById("container");
	var adbox = document.createElement("div");
	adbox.setAttribute("id","popupAd");
	adbox.setAttribute("onclick","javascript:removeWindow('popupAd')");
	adPicSrc = "http://www.melhollanddesign.com/images/photos/" + adPicSrc;
	var leftPos = 500 - (w + 20)/2;
	var topPos = (portSize[1] - (h + 20))/2;
	adbox.style.left = leftPos + "px";
	adbox.style.top = topPos + "px";
	adbox.innerHTML = "<a href=\"javascript:removeWindow('popupAd')\"><img src='" + adPicSrc + "' /></a>";
	parent.appendChild(adbox);
}

function getViewportSize()
{
  var size = [0, 0];

  if (typeof window.innerWidth != 'undefined')
  {
    size = [
        window.innerWidth,
        window.innerHeight
    ];
  }
  else if (typeof document.documentElement != 'undefined'
      && typeof document.documentElement.clientWidth != 'undefined'
      && document.documentElement.clientWidth != 0)
  {
    size = [
        document.documentElement.clientWidth,
        document.documentElement.clientHeight
    ];
  }
  else
  {
    size = [
        document.getElementsByTagName('body')[0].clientWidth,
        document.getElementsByTagName('body')[0].clientHeight
    ];
  }

  return size;
}

function removeWindow(id){
	var popup = document.getElementById(id);
	var root = document.getElementById("container");
	root.removeChild(popup);
}

