// window.onload = prepareGalleryAnchors;
addLoadEvent(prepareGalleryAnchors);

function prepareGalleryAnchors() {
  var links = document.getElementsByTagName("a");
  for (var j=0; j<links.length; j++) {
	var link_class = links[j].className;
	var description = "opens in new window";
	if (link_class.match("popup")) {
		links[j].setAttribute("title", description);
		links[j].onclick = function() {
		popup(this.getAttribute("href")) 
		return false;
		}
	} if (link_class.match("smallPopup")) {
		links[j].setAttribute("title", description);
		links[j].onclick = function() {
		smallPopup(this.getAttribute("href")) 
		return false; 
		}
	} if (link_class.match("bigPopup")) {
		links[j].setAttribute("title", description);
		links[j].onclick = function() {
		bigPopup(this.getAttribute("href")) 
		return false; 
		}
	} if (link_class.match("biggerPopup")) {
		links[j].setAttribute("title", description);		
		links[j].onclick = function() {
		biggerPopup(this.getAttribute("href")) 
		return false;
		}
	} if (link_class.match("look_popup")) {
		links[j].setAttribute("title", description);		
		links[j].onclick = function() {
		look_popup(this.getAttribute("href")) 
		return false;
		}
	}
  }
}

function look_popup(winURL) {
  window.open(winURL,"look_popup","width=850,height=624, top=10, left=25"); 
}
function bigPopup(winURL) {
  window.open(winURL,"bigpopup","width=740,height=640, top=10, left=25"); 
}

function smallPopup(winURL) {
  window.open(winURL,"smallpopup","width=750,height=600, top=10, left=25"); 
}

function popup(winURL) {
  window.open(winURL,"popup","width=740,height=620, top=10, left=25"); 
}

function biggerPopup(winURL) {
  window.open(winURL,"biggerpopup","width=740,height=660, top=10, left=25"); 
}

