﻿// ======= JSF SafetyNet =======
var goN2Initializer = {
  aHandlers: [],
  runThisWhen: function(sWhen, fFn, sComment) {
    if ((typeof fFn != 'function') || fFn == null) return false;
    this.aHandlers[this.aHandlers.length] = { sWhen: sWhen.toLowerCase(), fFn: fFn, sComment: sComment };
    return true;
  },
  isReady: function() { return false; }
};
function n2RunThisWhen(sWhen, fFn, sComment) { return goN2Initializer.runThisWhen(sWhen, fFn, sComment); }
goN2Consts =
{
  chEOL: String.fromCharCode(0x0A),
  chSQUOTE: String.fromCharCode(0x27),
  chDQUOTE: String.fromCharCode(0x22),
  chBACKSLASH: String.fromCharCode(0x5C),
  chYEN: String.fromCharCode(0xA5)
};
var n2sRTW1 = 'onloadsuccess';
var n2sRTWTBS = 'simplepopoverloaded';

// ======= JSF Bootstrap (1) =======
var goN2LibMon = {
  aLibs: {},
  aSheets: {},
  nMONITORLOAD: -1,
  lastLibraryRendered: false,
  isJSLoaded: function() { return false; },
  monitorLoad: function(sLibID, sFeature, sUrl) {
    this.aLibs[sLibID] = { sID: sLibID, nDuration: this.nMONITORLOAD, sFeature: sFeature, sUrl: sUrl };
  },
  lastMonitorLoad: function() {
    this.lastLibraryRendered = true;
  }
}
//gsN2ImageHost = 'http://z-ecx.images-amazon.com/images/G/01/';
goN2LibMon.monitorLoad('utilities');
goN2LibMon.monitorLoad('events');
goN2LibMon.monitorLoad('simplePopover');
goN2LibMon.monitorLoad('staticPopover');
goN2LibMon.monitorLoad('search_suggest');
goN2LibMon.lastMonitorLoad();

n2RunThisWhen('lastlibraryloaded',
                  function() {
                    // --------------------------------------------------------
                    // Set up our globals and data
                    // NOTE: don't use vars
                    // --------------------------------------------------------
                    // instantiate a popover
                    goApparelPop = new N2SimplePopover();


                    // register you popup feature with the events framework
                    goN2Events.registerFeature('apparelpop', // the feature ID used in the NAME=
                                       'goApparelPop', // the object that will act upon the event
                                       'n2MouseOverHotspot', // an events helper function for MouseOver event
                                       'n2MouseOutHotspot'); // an events helper function for MouseOut event


                    goApparelPop.initialize('goSimplePopDiv', // the name for your popup DIV. any unique name will do
                                   'goApparelPop' // the object you made up above                                 
                                   );
                  },
                  'init apparel popover');
