/* $Id: flashlogger_stivoro_nl.js,v 1.2 2009-09-14 09:08:44 jasper Exp $ */

WicFL = function(){
  var obj = this;
  this.gaTracker = null;
  this.debug = false;
  this.debugDiv = null;

  this.init = function(){
    if (typeof _gat == "undefined") {
      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"));
    }
  }

  this.log = function(logPath){
    logPath = logPath.replace(/^\//, "");
    if (typeof _gat != "undefined") {
      if (obj.gaTracker == null) obj.gaTracker = _gat._getTracker("UA-3207715-1");
      obj.gaTracker._trackPageview("/wicfl/"+ logPath);
    }
    if (obj.debug) obj.debugMsg(logPath);
  }

  this.version = function(){ alert("WIC Flash Logger\n$Revision: 1.2 $\n$Date: 2009-09-14 09:08:44 $"); }

  this.debugMsg = function(str){
    var now = new Date();
    obj.debugDiv.innerHTML += (
      now.getHours()
    + ":"+ (now.getMinutes() > 9 ? "" : "0") + now.getMinutes()
    + ":"+ (now.getSeconds() > 9 ? "" : "0") + now.getSeconds()
    + " &gt; "+ str +"<br>"
    );
  }

  this.setDebug = function(debug){
    try { obj.debug = new Boolean(debug); }
    catch (e) { alert("parameter must be a boolean"); }
    if (obj.debug && obj.debugDiv == null) {
      obj.debugDiv = document.createElement("div");
      with (obj.debugDiv.style) {
        overflow = "auto";
        padding = "8px";
        width = "500px";
        height = "200px";
        fontFamily = "Arial";
        fontSize = "11px";
        lineHeight = "14px";
        color = "#000";
        background = "#fff";
        border = "2px solid red";
      }
      obj.debugDiv.innerHTML = "<span style='font-weight:bold'>WIC Flash Logger</span><br>";
      document.body.insertBefore(obj.debugDiv, document.body.childNodes[0]);
    }
  }

  this.init();
}

var wicFL = new WicFL();

