
// usage: log('inside coolFunc', this, arguments);
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
window.log = function(){
  log.history = log.history || [];   // store logs to an array for reference
  log.history.push(arguments);
  arguments.callee = arguments.callee.caller;  
  if(this.console) console.log( Array.prototype.slice.call(arguments) );
};
// make it safe to use console.log always
(function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();)b[a]=b[a]||c})(window.console=window.console||{});


// place any jQuery/helper plugins in here, instead of separate, slower script files.

/* Animate Background Image */
(function(c){function f(a){a=a.replace(/left|top/g,"0px");a=a.replace(/right|bottom/g,"100%");a=a.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");a=a.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);return[parseFloat(a[1],10),a[2],parseFloat(a[3],10),a[4]]}if(!document.defaultView||!document.defaultView.getComputedStyle){var d=c.curCSS;c.curCSS=function(a,b,c){b==="background-position"&&(b="backgroundPosition");if(b!=="backgroundPosition"||!a.currentStyle||a.currentStyle[b])return d.apply(this, arguments);var e=a.style;if(!c&&e&&e[b])return e[b];return d(a,"backgroundPositionX",c)+" "+d(a,"backgroundPositionY",c)}}var g=c.fn.animate;c.fn.animate=function(a){if("background-position"in a)a.backgroundPosition=a["background-position"],delete a["background-position"];if("backgroundPosition"in a)a.backgroundPosition="("+a.backgroundPosition;return g.apply(this,arguments)};c.fx.step.backgroundPosition=function(a){if(!a.bgPosReady){var b=c.curCSS(a.elem,"backgroundPosition");b||(b="0px 0px");b= f(b);a.start=[b[0],b[2]];b=f(a.end);a.end=[b[0],b[2]];a.unit=[b[1],b[3]];a.bgPosReady=!0}b=[];b[0]=(a.end[0]-a.start[0])*a.pos+a.start[0]+a.unit[0];b[1]=(a.end[1]-a.start[1])*a.pos+a.start[1]+a.unit[1];a.elem.style.backgroundPosition=b[0]+" "+b[1]}})(jQuery);

var Debug = function(b, a) { if (!$("#Debug")) { $("body").append("<div id='Debug'></div>") } if (a) { $("#Debug").html($("#Debug").html() + "<br/>" + b) } else { $("#Debug").html($("#Debug").html() + b) } }; var max_ImageSwitch_Effect_ID = 0; (function(a) { a.fn.ImageSwitch = function(l, d) { var f = { Type: "FadeIn", NewImage: "", EffectOriginal: true, Speed: 1000, StartLeft: 50, StartTop: 0, StartOpacity: 0, EndLeft: -50, EndTop: 0, EndOpacity: 0, Direction: "RightLeft", Door1: "", Door2: "" }; var q = a.extend(f, l); var i = this; var h = 0; var k; var p; var o; var j = function() { i.data("imageswitch", -1) }; if (a.isFunction(d)) { j = function() { d(); i.data(i, -1) } } var c = function() { i.parent().append("<img class='GrpEffectImg' id='" + k.replace("#", "") + "'/>"); a(k).attr("src", i.attr("src")); a(k).css("position", "absolute"); a(k).css("top", i.position().top); a(k).css("left", i.position().left); a(k).css("opacity", 1); i.attr("src", q.NewImage); if (q.EffectOriginal) { i.css("opacity", q.StartOpacity); i.animate({ opacity: 1 }, q.Speed) } a(k).animate({ opacity: 0 }, q.Speed, function() { a(k).remove(); j() }) }; var g = function(r) { a("body").append("<img class='GrpEffectImg' id='" + k.replace("#", "") + "'/>"); a(k).css("position", "absolute"); if (r) { a(k).attr("src", q.NewImage); a(k).css("top", i.offset().top + q.StartTop); a(k).css("left", i.offset().left + q.StartLeft); a(k).css("opacity", q.StartOpacity); EndTop = i.offset().top; EndLeft = i.offset().left; EndOpacity = 1 } else { a(k).attr("src", i.attr("src")); i.attr("src", q.NewImage); a(k).css("top", i.offset().top); a(k).css("left", i.offset().left); a(k).css("opacity", 1); EndTop = i.offset().top + q.EndTop; EndLeft = i.offset().left + q.EndLeft; EndOpacity = q.EndOpacity } a(k).animate({ opacity: EndOpacity, top: EndTop, left: EndLeft }, q.Speed, function() { i.attr("src", q.NewImage); a(k).remove(); j() }) }; var b = function(u) { var t = i.clone(true); i.wrap("<div id='GrpViewport-" + h + "'></div>"); a("#GrpViewport-" + h).css("overflow", "hidden"); a("#GrpViewport-" + h).width(i.width()); a("#GrpViewport-" + h).height(i.height()); a("#GrpViewport-" + h).append("<img class='GrpEffectImg' id='" + k.replace("#", "") + "'/>"); a(k).css("position", "absolute"); var r = 0; var s = 0; switch (q.Direction) { case "RightLeft": s = -i.width(); break; case "LeftRight": s = i.width(); break; case "TopDown": r = -i.height(); break; case "DownTop": r = 250; break } if (u) { a(k).attr("src", q.NewImage); a(k).css("top", r); a(k).css("left", s); a(k).css("opacity", q.StartOpacity); EndTop = 0; EndLeft = 0; EndOpacity = 1 } else { a(k).attr("src", i.attr("src")); a(k).css("left", 0); a(k).css("top", 0); i.attr("src", q.NewImage); EndTop = r; EndLeft = s; EndOpacity = q.EndOpacity } if (i.css("position") != "absolute") { a("#GrpViewport-" + h).css("position", "relative"); i.css("position", "absolute") } else { a("#GrpViewport-" + h).css("position", "absolute"); a("#GrpViewport-" + h).css("left", i.css("left")); a("#GrpViewport-" + h).css("top", i.css("top")); i.css("top", 0); i.css("left", 0) } if (q.EffectOriginal && u) { i.animate({ top: -r, left: -s }, q.Speed) } a(k).animate({ opacity: EndOpacity, top: EndTop, left: EndLeft }, q.Speed, function() { t.attr("src", q.NewImage); t.removeAttr("imageswitch"); a("#GrpViewport-" + h).replaceWith(t); j() }) }; var n = function() { var t = i.clone(true); i.wrap("<div id='GrpViewport'></div>"); a("#GrpViewport").css("overflow", "hidden"); a("#GrpViewport").width(i.width()); a("#GrpViewport").height(i.height()); a("#GrpViewport").append("<div class='GrpEffectDiv' id='" + p.replace("#", "") + "'/>"); a(p).attr("src", q.NewImage); a(p).css("position", "absolute"); a(p).css("background-color", "#FFF"); if (q.Door1.length > 0) { a(p).css("background", q.Door1) } a(p).width(i.width()); a(p).height(i.height()); var r = 0; var s = 0; switch (q.Direction) { case "RightLeft": s = -i.width(); break; case "LeftRight": s = i.width(); break; case "TopDown": r = -i.height(); break; case "DownTop": r = i.height(); break } a(p).css("top", r); a(p).css("left", s); if (i.css("position") != "absolute") { a("#GrpViewport").css("position", "relative"); i.css("position", "absolute") } else { a("#GrpViewport").css("position", "absolute"); a("#GrpViewport").css("left", i.css("left")); a("#GrpViewport").css("top", i.css("top")); i.css("top", 0); i.css("left", 0) } a(p).animate({ top: 0, left: 0 }, q.Speed, function() { i.attr("src", q.NewImage); a(p).animate({ top: r, left: s }, q.Speed, function() { t.attr("src", q.NewImage); t.removeAttr("imageswitch"); a("#GrpViewport").replaceWith(t); j() }) }) }; var e = function() { var v = i.css("position"); var r = i.css("left"); var u = i.css("top"); i.wrap("<div id='GrpViewport'></div>"); a("#GrpViewport").css("overflow", "hidden"); a("#GrpViewport").width(i.width()); a("#GrpViewport").height(i.height()); a("#GrpViewport").append("<div class='GrpEffectDiv' id='" + p.replace("#", "") + "'/>"); a(p).css("position", "absolute"); a(p).css("background-color", "#FFF"); if (q.Door1.length > 0) { a(p).css("background", q.Door1) } a(p).width(i.width()); a(p).height(i.height()); a("#GrpViewport").append("<div class='GrpEffectDiv1' id='" + o.replace("#", "") + "'/>"); a(o).css("position", "absolute"); a(o).css("background-color", "#FFF"); if (q.Door2.length > 0) { a(o).css("background", q.Door2) } a(o).width(i.width()); a(o).height(i.height()); var s = 0; var t = 0; switch (q.Direction) { case "RightLeft": t = -i.width(); break; case "LeftRight": t = i.width(); break; case "TopDown": s = -i.height(); break; case "DownTop": s = i.height(); break } a(p).css("top", s); a(p).css("left", t); a(o).css("top", -s); a(o).css("left", -t); if (!q.EffectOriginal) { a(p).css("background", "#FFF url(" + q.NewImage + ") no-repeat " + -t / 2 + "px " + -s / 2 + "px"); a(o).css("background", "#FFF url(" + q.NewImage + ") no-repeat " + t / 2 + "px " + s / 2 + "px") } if (i.css("position") != "absolute") { a("#GrpViewport").css("position", "relative"); i.css("position", "absolute") } else { a("#GrpViewport").css("position", "absolute"); a("#GrpViewport").css("left", r); a("#GrpViewport").css("top", u); i.css("position", "absolute"); i.css("top", 0); i.css("left", 0) } a(p).animate({ top: s / 2, left: t / 2 }, q.Speed, function() { i.attr("src", q.NewImage); if (!q.EffectOriginal) { i.css("position", v); i.css("top", u); i.css("left", r); a("#GrpViewport").replaceWith(i) } else { a(p).animate({ top: s, left: t }, q.Speed, function() { i.css("position", v); i.css("top", u); i.css("left", r); a("#GrpViewport").replaceWith(i) }) } }); a(o).animate({ top: -s / 2, left: -t / 2 }, q.Speed, function() { i.attr("src", q.NewImage); if (!q.EffectOriginal) { j() } else { a(o).animate({ top: -s, left: -t }, q.Speed, function() { j() }) } }) }; var m = function(s) { var r = i.clone(true); if (i.css("z-index") == "auto") { i.css("z-index", 100) } if (i.css("position") != "absolute") { i.css("position", "relative") } a("body").append("<img class='GrpEffectImg'  id='" + k.replace("#", "") + "'/>"); a(k).css("position", "absolute"); a(k).css("top", i.offset().top); a(k).css("left", i.offset().left); if (s) { a(k).css("opacity", q.StartOpacity); a(k).css("z-index", i.css("z-index") - 1); a(k).attr("src", q.NewImage) } else { a(k).css("opacity", 1); a(k).css("z-index", i.css("z-index") + 1); a(k).attr("src", i.attr("src")); i.attr("src", q.NewImage) } if (Math.abs(q.EndTop) < i.height() && Math.abs(q.EndLeft) < i.width()) { EndTop = i.offset().top; EndLeft = i.offset().left + i.width() } else { EndTop = i.offset().top + q.EndTop; EndLeft = i.offset().left + q.EndLeft } EndOpacity = 1; a(k).animate({ opacity: EndOpacity, top: EndTop, left: EndLeft }, q.Speed, function() { if (s) { a(k).css("z-index", 101) } else { EndOpacity = q.EndOpacity; a(k).css("z-index", 2) } a(k).animate({ opacity: EndOpacity, top: i.offset().top, left: i.offset().left }, q.Speed, function() { r.attr("src", q.NewImage); r.removeAttr("imageswitch"); i.replaceWith(r); a(k).remove(); j() }) }) }; return this.each(function() { i = a(this); if (!i.ImageAnimating()) { h = max_ImageSwitch_Effect_ID; max_ImageSwitch_Effect_ID += 1; i.data(i, h); k = "#GrpEffectImg-" + h; p = "#GrpEffectDiv1-" + h; o = "#GrpEffectDiv2-" + h; var r = new Image(); r.src = q.NewImage; a.ImagePreload(q.NewImage, function() { switch (q.Type) { case "FadeIn": c(); break; case "FlyIn": g(true); break; case "FlyOut": g(false); break; case "FlipIn": m(true); break; case "FlipOut": m(false); break; case "ScrollIn": b(true); break; case "ScrollOut": b(false); break; case "SingleDoor": n(); break; case "DoubleDoor": e(); break } }) } }) } })(jQuery); (function(a) { a.fn.ImageAnimating = function() { if (this.data("imageswitch") > 0) { return true } else { return false } } })(jQuery); (function(a) { a.fn.ImageStop = function(c, b, d) { return this.each(function() { if (a(this).ImageAnimating()) { var e = a.data(this, "imageswitch"); a("#GrpEffectImg-" + e).stop(c, b); a("#GrpEffectDiv-" + e).stop(c, b); a("#GrpEffectDiv1-" + e).stop(c, b); a(this).stop(c, b); a("#GrpEffectImg-" + e).remove(); a("#GrpEffectDiv-" + e).remove(); a("#GrpEffectDiv1-" + e).remove(); if (a.isFunction(d)) { d() } } }) } })(jQuery); (function(a) { a.ImageStopAll = function(c, b, d) { a(".GrpEffectImg").stop(c, b); a(".GrpEffectDiv").stop(c, b); a(".GrpEffectDiv1").stop(c, b); a(this).stop(c, b); a(".GrpEffectImg").remove(); a(".GrpEffectDiv").remove(); a(".GrpEffectDiv1").remove(); a.data(this, "imageswitch", -1); if (a.isFunction(d)) { d() } } })(jQuery); (function(a) { a.ImagePreload = function(b, d) { var c = new Image(); c.src = b; if (a.isFunction(d)) { a(c).load(d()) } } })(jQuery);


/* =========================================================
 * bootstrap-modal.js v1.4.0
 * http://twitter.github.com/bootstrap/javascript.html#modal
 * =========================================================
 * Copyright 2011 Twitter, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ========================================================= */


!function( $ ){

  "use strict"

 /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
  * ======================================================= */

  var transitionEnd

  $(document).ready(function () {

    $.support.transition = (function () {
      var thisBody = document.body || document.documentElement
        , thisStyle = thisBody.style
        , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
      return support
    })()

    // set CSS transition event type
    if ( $.support.transition ) {
      transitionEnd = "TransitionEnd"
      if ( $.browser.webkit ) {
      	transitionEnd = "webkitTransitionEnd"
      } else if ( $.browser.mozilla ) {
      	transitionEnd = "transitionend"
      } else if ( $.browser.opera ) {
      	transitionEnd = "oTransitionEnd"
      }
    }

  })


 /* MODAL PUBLIC CLASS DEFINITION
  * ============================= */

  var Modal = function ( content, options ) {
    this.settings = $.extend({}, $.fn.modal.defaults, options)
    this.$element = $(content)
      .delegate('.close', 'click.modal', $.proxy(this.hide, this))

    if ( this.settings.show ) {
      this.show()
    }

    return this
  }

  Modal.prototype = {

      toggle: function () {
        return this[!this.isShown ? 'show' : 'hide']()
      }

    , show: function () {
        var that = this
        this.isShown = true
        this.$element.trigger('show')

        escape.call(this)
        backdrop.call(this, function () {
          var transition = $.support.transition && that.$element.hasClass('fade')

          that.$element
            .appendTo(document.body)
            .show()

          if (transition) {
            that.$element[0].offsetWidth // force reflow
          }

          that.$element.addClass('in')

          transition ?
            that.$element.one(transitionEnd, function () { that.$element.trigger('shown') }) :
            that.$element.trigger('shown')

        })

        return this
      }

    , hide: function (e) {
        e && e.preventDefault()

        if ( !this.isShown ) {
          return this
        }

        var that = this
        this.isShown = false

        escape.call(this)

        this.$element
          .trigger('hide')
          .removeClass('in')

        $.support.transition && this.$element.hasClass('fade') ?
          hideWithTransition.call(this) :
          hideModal.call(this)

        return this
      }

  }


 /* MODAL PRIVATE METHODS
  * ===================== */

  function hideWithTransition() {
    // firefox drops transitionEnd events :{o
    var that = this
      , timeout = setTimeout(function () {
          that.$element.unbind(transitionEnd)
          hideModal.call(that)
        }, 500)

    this.$element.one(transitionEnd, function () {
      clearTimeout(timeout)
      hideModal.call(that)
    })
  }

  function hideModal (that) {
    this.$element
      .hide()
      .trigger('hidden')

    backdrop.call(this)
  }

  function backdrop ( callback ) {
    var that = this
      , animate = this.$element.hasClass('fade') ? 'fade' : ''
    if ( this.isShown && this.settings.backdrop ) {
      var doAnimate = $.support.transition && animate

      this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
        .appendTo(document.body)

      if ( this.settings.backdrop != 'static' ) {
        this.$backdrop.click($.proxy(this.hide, this))
      }

      if ( doAnimate ) {
        this.$backdrop[0].offsetWidth // force reflow
      }

      this.$backdrop.addClass('in')

      doAnimate ?
        this.$backdrop.one(transitionEnd, callback) :
        callback()

    } else if ( !this.isShown && this.$backdrop ) {
      this.$backdrop.removeClass('in')

      $.support.transition && this.$element.hasClass('fade')?
        this.$backdrop.one(transitionEnd, $.proxy(removeBackdrop, this)) :
        removeBackdrop.call(this)

    } else if ( callback ) {
       callback()
    }
  }

  function removeBackdrop() {
    this.$backdrop.remove()
    this.$backdrop = null
  }

  function escape() {
    var that = this
    if ( this.isShown && this.settings.keyboard ) {
      $(document).bind('keyup.modal', function ( e ) {
        if ( e.which == 27 ) {
          that.hide()
        }
      })
    } else if ( !this.isShown ) {
      $(document).unbind('keyup.modal')
    }
  }


 /* MODAL PLUGIN DEFINITION
  * ======================= */

  $.fn.modal = function ( options ) {
    var modal = this.data('modal')

    if (!modal) {

      if (typeof options == 'string') {
        options = {
          show: /show|toggle/.test(options)
        }
      }

      return this.each(function () {
        $(this).data('modal', new Modal(this, options))
      })
    }

    if ( options === true ) {
      return modal
    }

    if ( typeof options == 'string' ) {
      modal[options]()
    } else if ( modal ) {
      modal.toggle()
    }

    return this
  }

  $.fn.modal.Modal = Modal

  $.fn.modal.defaults = {
    backdrop: false
  , keyboard: false
  , show: false
  }


 /* MODAL DATA- IMPLEMENTATION
  * ========================== */

  $(document).ready(function () {
    $('body').delegate('[data-controls-modal]', 'click', function (e) {
      e.preventDefault()
      var $this = $(this).data('show', true)
      $('#' + $this.attr('data-controls-modal')).modal( $this.data() )
    })
  })

}( window.jQuery || window.ender );
