var picturewindow;
var videowindow; 

window.onload = function () {
    if(!document.getElementsByTagName) {
        return;
    }
    var links,a,i;
    var xpos=(screen.width - 640)/2
    var ypos=(screen.height - 480)/2

    links = document.getElementsByTagName("a");
    for(i = 0; i < links.length; i++) {
        a = links[i];
        if(a.getAttribute("rel")) {
          switch(a.getAttribute("rel")) {
            case "external" :
               a.onclick = function() {
                   window.open(this.href);
                   return false;
               }
            break;
            case "video":
              a.onclick = function() {
                if (videowindow) videowindow.close();
                videosize = this.className;
                videowindow = window.open("/video.html?movie=" + escape(this.href) + "&title=" + escape(this.title)+"&size=" + escape(videosize), "", 
                    "scrollbars=no,status=no,toolbar=no,location=no,directories=no,resizable=no,menubar=no,width=520,height=384," +
                    "screenX="+xpos+",screenY="+ypos+",top="+ypos+",left="+xpos
                );
                return false;
              }
            break;
            case "picture" : 
               a.onclick = function() {
                 if (picturewindow) picturewindow.close();
                 picturewindow = window.open("/image.html?picture=" + escape(this.href) + "&title=" + escape(this.title), "", 
                    "scrollbars=no,status=no,toolbar=no,location=no,directories=no,resizable=no,menubar=no,width=800,height=800," +
                    "screenX="+xpos+",screenY="+ypos+",top="+ypos+",left="+xpos
                 );
                 return false;
               }
            break;
          }
        }
    }
}

function contact(domain, account, name, tld) {
  document.write('<a href=\"' + 'm' + 'ai' + 'l' + 'to' + ':' + account + '@');
  document.write(domain + "." + tld + '" title=\"'+ name +'\">' + account + '@');
  document.write(domain + "." + tld + '</a>');
}
