rightClickWarning = "All photos are © Austin Brodfuhrer. All rights reserved. Unauthorized use is prohibited."

addEvent(window, "load", changeCategoryInfo);



lbSingleImage = false; //set this to true to open singleImage url's in lightbox.

force1337Box();  //for fastest execution put this at the top of your script section.


function force1337Box() {
  var re = /(https?:\/\/\S+\/)(\d+)\/(Small|Medium|Large|Original)$/;
  var re1 = /(https?:\/\/\S+\/)(\d+)\?(Small|Medium|Large|Original)$/;

  if (typeof(lbSingleImage) == "undefined" || typeof(lbSingleImage) != "boolean")
    lbSingleImage= false;

  if (lbSingleImage) {
    if (re.test(window.location.href)) {
      re.exec(window.location.href);
      window.location.replace(RegExp.$1 + RegExp.$2 + "?" + RegExp.$3);
    }
    else if ((document.referrer == "" || re.test(document.referrer)) && re1.test(window.location.href)) {
      re1.exec(window.location.href);
      doLB("$1337Box(" + RegExp.$2 + ",'" + RegExp.$3 + "', '');");
    }
  }

  addEvent(window, 'load', force1337BoxThumbs);
}


function doLB(sF) {
  var oLb = document.getElementById("lightBoxStage");

  if (oLb)
    eval(sF);
  else
    window.setTimeout("doLB(\"" + sF + "\");", 100);
}


function force1337BoxThumbs() {
  if (isClass("filmstrip") || isClass("slideshow")) {
    var p = isClass("filmstrip") ? document.getElementById("mainPhoto") : document.getElementById("slide");
    p.style.cursor = "pointer";
    addEvent(p, 'click', force1337BoxSpecific);
  }
  else {
    var p = isClass("journal") ? document.getElementById("journal") : document.getElementById("photos");
    var photos = p.getElementsByTagName('a');
    var re = /https?:\/\/\S+\/(\d+)\/(Small|Medium|Large|Original)$/;

    for (var i = 0; i < photos.length; i++) {
      if (/(photo)[\s]?/.test(photos[i].parentNode.className)) {
        re.exec(photos[i].href);
        
        if (RegExp.$1 && RegExp.$2)
          photos[i].href = "javascript: $1337Box(" + RegExp.$1 + ", '" + RegExp.$2 + "','');";
        else
          photos[i].href = photos[i].href.replace(/openLB/, "$1337Box");
      }
    }
  }
}


function force1337BoxSpecific(e) {
  var p = window.event ? event.srcElement : e.target;
  var re = /\/photos\/(\d+)-\S+\.[\w]{3}/;
  var c = getCookie("DefaultSize");

  re.exec(re.test(p.style.backgroundImage) ? p.style.backgroundImage : p.src);

  $1337Box(RegExp.$1, c == null ? "Medium" : c, '');
}



function $1337Box(imgId, reqSize, setSize) {
  openLB(imgId, reqSize, setSize, '', '');
}


function isClass(sClass) {
  sClassName = document.body.className;

  re = new RegExp(sClass + "( |$)") 

  if (!sClassName)
    return false;
  return re.test(sClassName);
}


function getCookie(name) {
  var start = document.cookie.indexOf(name + "=");
  var len = start + name.length + 1;
  
  if ((!start) && (name != document.cookie.substring(0, name.length)))
    return null;

  if (start == -1)
    return null;

  var end = document.cookie.indexOf(";", len);

  if (end == -1)
    end = document.cookie.length;

  return unescape(document.cookie.substring(len, end));
}