text: /* 
   * The MIT License
   *
   * Copyright (c) 2012 James Allardice
   *
   * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), 
   * to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 
   * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
   *
   * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
   *
   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
   * THE SOFTWARE.
   */
  
  // Defines the global Placeholders object along with various utility methods
  (function (global) {
  
      "use strict";
  
      // Cross-browser DOM event binding
      function addEventListener(elem, event, fn) {
          if (elem.addEventListener) {
              return elem.addEventListener(event, fn, false);
          }
          if (elem.attachEvent) {
              return elem.attachEvent("on" + event, fn);
          }
      }
  
      // Check whether an item is in an array (we don't use Array.prototype.indexOf so we don't clobber any existing polyfills - this is a really simple alternative)
      function inArray(arr, item) {
          var i, len;
          for (i = 0, len = arr.length; i < len; i++) {
              if (arr[i] === item) {
                  return true;
              }
          }
          return false;
      }
  
      // Move the caret to the index position specified. Assumes that the element has focus
      function moveCaret(elem, index) {
          var range;
          if (elem.createTextRange) {
              range = elem.createTextRange();
              range.move("character", index);
              range.select();
          } else if (elem.selectionStart) {
              elem.focus();
              elem.setSelectionRange(index, index);
          }
      }
  
      // Attempt to change the type property of an input element
      function changeType(elem, type) {
          try {
              elem.type = type;
              return true;
          } catch (e) {
              // You can't change input type in IE8 and below
              return false;
          }
      }
  
      // Expose public methods
      global.Placeholders = {
          Utils: {
              addEventListener: addEventListener,
              inArray: inArray,
              moveCaret: moveCaret,
              changeType: changeType
          }
      };
  
  }(this));
  