_heatmap_document_clicks = 0;
function heatmapDocumentClick(e)
{
    // limit clicks
    if (_heatmap_document_clicks >= 5) {
        return;
    }

    // get event and target
    var e = e || window.event;
    var t = e.target || e.srcElement;

    // loop up to the box
    while (t && t.id != "heatmap-controls" && t.tagName != "BODY") {
        t = t.parentNode;
    }

    // don't record clicks on the controls
    if (!t || t.id == "heatmap-controls"){
        return;
    }

    _heatmap_document_clicks++;

    if (navigator.appName == "Microsoft Internet Explorer") {
      http = new ActiveXObject("Microsoft.XMLHTTP");
    } else {
      http = new XMLHttpRequest();
    }

    http.open("GET", "/yk-module-views/heatmap-click-recorder?opt=store_click&x=" + Yak.pointerXY(e).x +"&y=" + Yak.pointerXY(e).y + "&w="+Yak.winXY().x+"&h=" + Yak.winXY().y + "&loc=" + window.location, true);
    http.send(null);
}

Yak.addEvent(document,"click",function(e) { heatmapDocumentClick(e); });