﻿// Array.indexof - initialization for IE
//This prototype is provided by the Mozilla foundation and
//is distributed under the MIT license.
//http://www.ibiblio.org/pub/Linux/LICENSES/mit.license
if (!Array.prototype.indexOf)
{
  Array.prototype.indexOf = function(elt /*, from*/)
  {
    var len = this.length;
    var from = Number(arguments[1]) || 0;
    from = (from < 0) ? Math.ceil(from) : Math.floor(from);
    if (from < 0)
      from += len;

    for (; from < len; from++)
    {
      if (from in this &&
          this[from] === elt)
        return from;
    }
    return -1;
  };
}

/*  addHandler - adds an event handler to an object in a browser-compatible fashion.  
*           Multiple events can be assigned using subsequent calls to this function.
*
*   Parameters:
*       obj : object to register an event for
*       eventName : the event to be registered (ie. "click" or "blur")
*       handler : a pointer to the function to be executed when the event is triggered
*   Returns: void
*/
function addHandler(targetObj,eventName,handler)
{
    if (targetObj.addEventListener)   //for all other browsers
        targetObj.addEventListener(eventName, handler, false);
    else if (targetObj.attachEvent)   // IE Hack
        targetObj.attachEvent("on" + eventName, handler);
}
