// 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||{});

var APP = (function($, defaults) {
    var app = {}, $el;
    app.init = function() {
        $('a[href^=http], a[href^=https]').click(openNew);
        $('a[href=#]').attr('href', 'javascript:;');
        $.ajaxSetup({ cache: false, error: function errorLog(x, e) { log(x, e); }, type: 'POST' });
        if (!Modernizr.input.placeholder) { placeholder(); }
        yepnope([{
            test:Modernizr.csstransitions,
            nope: [defaults.static, 'javascripts/app/css3.js'].join('')
        }]);
        $("a.close").click(closeParent);
    };
    function closeParent(e) {
      e.preventDefault();
      $(this).parent().effect("drop", { direction: "up" }, 300);
    }
    function openNew(e) {
        e.preventDefault();
        window.open(this.getAttribute("href"));
    }
    function placeholder() {
        var attr = 'placeholder';
        $('input[' + attr + '!=""]').each(function(idx, el){
            $el = $(el);
            var d = $el.attr(attr);
            if (d === undefined) { return; }
            $el.focus(function onFocus() {
                if (this.value === d) { this.value = ''; }
            }).blur(function onBlur() {
                if ($.trim(this.value) === '') { this.value = d; }
            });
            $el.blur();
        });
    }
    $(app.init);
    return app;
} (jQuery, window.howgood));

var _gaq = [['_setAccount', window.howgood.ga_code], ['_trackPageview'], ['_trackPageLoadTime']];
(function(d, t) {
    var g = d.createElement(t), s = d.getElementsByTagName(t)[0];
    g.async = true;
    g.src = '//www.google-analytics.com/ga.js';
    s.parentNode.insertBefore(g, s);
})(document, 'script');

