function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}
function findPopups () {
  if (!document.getElementsByTagName || !document.getElementById ) return false;
  var lnks = document.getElementsByTagName("a");
  for (var i=0; i<lnks.length; i++) {
    if ((lnks[i].getAttribute("className") == "popup") || (lnks[i].getAttribute("class") == "popup")) {
      lnks[i].onclick = function() {
        popUp(this.getAttribute("href"));
        return false;
      }
    }
  }
}

function popUp(winURL) {
  window.open(winURL,"popup","width=600,height=500,scrollbars=1");
}

function checkTC() {
  if (!document.getElementById ) return false;
  var checkBox = document.getElementById("terms");
  var isChecked = checkBox.checked;
  if (isChecked == false) {
	alert("Please accept the terms and condition in order to participate in the Clearasil.co.uk may cause confidence competition.")
	return false;
  }
}

addLoadEvent(findPopups);