/*
	Standards Compliant Popup Script
	Author : Kevin Cannon
	http://www.multiblah.com
	Modified: Chris Owens
	http://www.twenty4.org/
	Last Edited: 05.09.2006
	Version 1.1
	
	Searches through a document for links with the class popup.
	When clicked, this link will open in a popup window.
	This means you don't have to add javascript to your code, 
	and means the links continue to work, for search engines, 
	and browsers without javascript
	
	function pickRandom and writeImg added as seperate functions
	for header image rotation
	does not relate to popup functions
*/

function initPopups() {

//alert("hello");

	if (!document.getElementById) return
	
	var aLinks = document.getElementsByTagName('a');

	for (var i = 0; i < aLinks.length; i++) {		
		// If class is popup
		if (aLinks[i].className == 'popup') {
			
			aLinks[i].onclick = function() {
				var url = this.href;
				openPopup(url);
				return false;
			}	
			// If class is popupenquiry
		} else if (aLinks[i].className == 'popupenquiry') {
			
			aLinks[i].onclick = function() {
				var url = this.href;
				openPopupEnquiry(url);
				return false;
			}	
		}
	}
}


// popupWindow function
// This is where you set your specific height & width etc... for your popups.
function openPopup(url) {	
	window.open(url, 'popupwindow', 'width=380,height=141,scrollbars,resizable'); 
	return false;
}

function openPopupEnquiry(url) {	
	window.open(url, 'popupwindow', 'width=380,height=380,scrollbars,resizable'); 
	return false;
}


// Piggy-back fucntion onto onLoad event ............................................
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

addLoadEvent(initPopups);

