/*
 * Analytics.js:
 *      script file used in conjunction with Google Analytics.  The file
 *      is used to track usage history for use with Analytics and should
 *      be included on every page on the site.
 */

var VAL_UNDEF = "undefined";
var DBG_ANALYTICS = true;

writeALog("script loaded");

if ( ("localhost" != window.location.hostname) && (VAL_UNDEF != typeof(document)) && (document.location) && (document.location.protocol) ) {
    writeALog("initial checks pass");
    
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
}
else if ( VAL_UNDEF != typeof(writeLog) ) {
    writeALog("analytics not enabled");
}

/*
 * writeALog:
 *      if running with FireBug and running on local host, writes a message to the 
 *      console.  If none of these conditions are true, this method evals to a no-op
 * Params:
 *      msg - the message to write
 * Returns:
 *      true
 */
function writeALog(msg) {
    if ( (true == DBG_ANALYTICS) && (typeof(console) != VAL_UNDEF) && (null != console) && (console.log) ) {
        console.log(msg);
    }
    
    return true;
}


