// Required includes: yui/yahoo/yahoo.js, yui/dom/dom.js
// ZAT_TODO: I think that having a namespace object per js file is a better idea - M
var zat={}; // namespace object.

// Global functions
var $ = YAHOO.util.Dom.get;

function trim(str) { return (str == null) ? '' : str.replace(/^\s+|\s+$/g, ''); }

// load these first, then if online ones aren't available, we'll still fly. 
function urchinTracker() {}
function GClientGeocoder() {}
function GOverlay() {}
function GUnload() {}
function GBrowserIsCompatible() { return false; }

// useful debugging function, found it here: http://weblogs.asp.net/skillet/archive/2006/03/23/440940.aspx
// Note: will loop for recursive objects
// Call: alert(dumpObj(ob, 'ob', '', 0));
var MAX_DUMP_DEPTH = 10;
function dumpObj(obj, name, indent, depth) {
  if (depth > MAX_DUMP_DEPTH) {
    return indent + name + ': <Maximum Depth Reached>\n';
  }
  if (typeof obj == 'object') {
    var child = null;
    var output = indent + name + '\n';
    indent += '  ';
    for (var item in obj) {
      try {
        child = obj[item];
      } catch (e) {
         child = '<Unable to Evaluate>';
      }
      if (typeof child == 'object') {
        output += dumpObj(child, item, indent, depth + 1);
      } else {
        output += indent + item + ': ' + child + '\n';
      }
    }
    return output;
  } else {
    return obj;
  }
}

/** make hover work for IE in #nav */
sfHover = function() {
  var sfEls = document.getElementById("nav").getElementsByTagName("LI");
  for (var i=0; i<sfEls.length; i++) {
    sfEls[i].onmouseover=function() {
      this.className+=" over";
    }
    sfEls[i].onmouseout=function() {
      this.className=this.className.replace(new RegExp(" over\\b"), "");
    }
  }
};
if (window.attachEvent) { window.attachEvent("onload", sfHover); }

