addLoadListener(popupLinkPrep);
function popupLinkPrep() {
	if (!document.getElementsByTagName) return false; 
	var popupLinks = document.getElementsByTagName("a");	
	for (var i=0; i < popupLinks.length; i++) {	// check all links on the page
		var getClass = popupLinks[i].className;
		if(getClass) { // if they have a class
			var popupType = new Array();
			popupType = getClass.split('_'); // split the link class at underscores and put in an array 
			if (popupType[0] == "popup") { // find out if the first array item is 'popup'. If yes continue
				popupLinks[i].onclick = function() {
					openPopUp(this.getAttribute("href"),this.className);	
					return false;
				} 
			}
		}		
	} 
} 

function openPopUp(linkURL,popupClass) {
	var popupType = new Array();
	popupType = popupClass.split('_'); // break up the class again to get the number at the end of the class
	var popupNumber = popupType[1];
	// popup variations called by adding classes to links eg: 'popup_1', 'popup_2', etc...
	if(popupNumber == 1) { // Default new window that opens to the users presets
		window.open(linkURL,null,'');
	} else if(popupNumber == 2) { // New window that opens to the users presets but is 400x300
		window.open(linkURL,null,'width=400,height=300');
	} else if(popupNumber == 3) { // Etc etc
		window.open(linkURL,null,'width=800,height=600,menubar=1,toolbar=1,resizable=1,scrollbars=1');
	}
}