/*------------------------------------------------------------------------
version: 1.1
author: andy windle
email: andy.windle@ama.uk.com
www.lambda-cal.co.uk
--------------------------------------------------------------------------*/
/* =General
--------------------------------------------------------------------------*/
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

function getPopUps() {
	// check to see that the browser supports the getElementsByTagName method
	// if not, exit the loop 
	if (!document.getElementsByTagName) return false;
	// create an array of objects of each link in the document 
	var popuplinks = document.getElementsByTagName("a");
	// loop through each of these links (anchor tags) 	
	for (var i=0; i < popuplinks.length; i++) {	
		// if the link has a class of "popup"...	
		if (popuplinks[i].className == "popup") {
			// add an onclick event on the fly to pass the href attribute	
			// of the link to our second function, openPopUp 	
			popuplinks[i].onclick = function() {	
			openPopUp(this.getAttribute("href"));	
			return false; 	
			} 	
		}
		// and for closing the popup window
		if (popuplinks[i].className == "closeWindow") {
			// add an onclick event on the fly to pass the href attribute	
			// of the link to our second function, openPopUp 	
			popuplinks[i].onclick = function() {	
			window.close(this);
			return false; 	
			} 	
		}
	} 
} 

function openPopUp(linkURL, width, height) {
	window.open(linkURL,'popup','top=5,left=5,scrollbars=1,width=617,height=550')
}
addLoadEvent(getPopUps);
