function getElementsByClassName(className) {
	var inc=0;
	var list = new Array();
	var alltags=document.all? document.all : document.getElementsByTagName("*");
	for (i=0; i<alltags.length; i++) {
		if (alltags[i].className == className) {
			list[inc]=alltags[i];
			inc++;
		}
	}
	return list;
}

function init() {
	popups = getElementsByClassName("popup");
	
	for (i=0; i < popups.length; i++) {
		popups[i].onclick = function() {
			var height;
			var width;
			var scr;
			var href = this.getAttribute("href");
			if (href.match(".jpg") != null || href.match(".gif") != null) {
				height = "740";
				width = "740";
				scr = "0";
			} else {
				height = "650";
				width = "586";
				scr = "1";
			}
			window.open(href,'popup','height='+height+',width='+width+',scrollbars='+scr);
			return false;
		}
	}
	
	
	/*if (!document.getElementsByTagName) {
		
		return false; 
	} 
	// create an array of objects of each link in the document 
	
	var popuplinks = document.getElementsByTagName("a");
	var w_px = 400;
	var h_px = 100;
	// 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") {
				
			if (popuplinks[i].getAttribute("width") != null)
				w_px =popuplinks[i].getAttribute("width");
			if (popuplinks[i].getAttribute("height") != null)
				h_px =popuplinks[i].getAttribute("height");
			// 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"),w_px,h_px);	
			return false; 	
			} 	
		}
	}*/
	
	
	closes = getElementsByClassName("close");
	
	for (i=0; i < closes.length; i++) {
		closes[i].onclick = function() {
			window.close();
			return false;
		}
	}
}

function openPopUp(linkURL,w,h) {
window.open(linkURL,'popup','width='+w+',height='+h)
}

FastInit.addOnLoad(init);