// JavaScript Document

function popups() {

  if (!document.getElementsByTagName) return false;
  var links = document.getElementsByTagName("a");
  for (var i=0; i < links.length; i++) {
    if (links[i].className.match("popup")) {
		
     x = links[i].getAttribute("rel");
     var rel = new Array();
     rel = x.split(" ");	
     if (rel[2]) {
      //with controls
      links[i].onclick = function() { window.open(this.getAttribute("href"), "popup1","width="+rel[0]+",height="+rel[1]+",toolbar=yes, directories=yes, location=yes, status=yes, menubar=yes, resizable=yes, scrollbars=yes"); return false; };			
     } else {
       //no controls
       links[i].onclick = function() { window.open(this.getAttribute("href"), "popup1","width="+rel[0]+",height="+rel[1]+",resizable=yes, status=yes"); return false; };
     }//end control check
    } else if (links[i].className.match("video")) {
      links[i].onclick = function() { window.open("popup-video.html?file="+this.getAttribute("file")+"&caption="+this.getAttribute("caption"), "popup1","width=500, height=450, status=yes, resizable=yes, scrollbars=yes"); return false; };			
    }
  }
	
}//END

window.onload = popups;