var Chompy = new Object();
var _gaq = _gaq || [];

Chompy.isMSIE = /*@cc_on!@*/false;

Chompy.html5_fix = function() {
    if (!document.createElementNS) {
        document.createElement('header');
        document.createElement('footer');
        document.createElement('section');
        document.createElement('article');
        document.createElement('aside');
        document.createElement('time');
        document.createElement('nav');
    }
};

// Google insists on using document.write in their Javascript, 
// so it's necessary to rewrite it for use with XHTML.
Chompy.ga_script = function() {
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    var gaJsUrl = gaJsHost + "google-analytics.com/ga.js";
    var head = document.getElementsByTagName("head")[0];
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.src = gaJsUrl;
    script.setAttribute('async', 'true');
    script.onload = function() {
        // var pageTracker = _gat._getTracker("UA-3678757-3");
        // pageTracker._initData();
        // pageTracker._trackPageview();
        _gaq.push(['_setAccount', 'UA-3678757-3']);
        _gaq.push(['_trackPageview']);
    };
    head.appendChild(script);
};

Chompy.attach_ga_script = function() {
    if (document.addEventListener) {
        document.addEventListener('DOMContentLoaded', Chompy.ga_script, false);
    } else if (document.attachEvent) {
        document.attachEvent('onload', Chompy.ga_script);
    }
};

