﻿function AddActivity(action, description, cb) {
  if (location.href.indexOf('localhost') !== -1) return cb ? cb(true) : null;
  var browsers = ['IE', 'Chrome', 'Safari', 'Firefox', 'Opera', 'Other']; 
  DA.createQuery(enums.dbOperation.exec, enums.commandType.text, "INSERT WebActivity(Action, Description, Page, Language, Browser, Version , OS) " +
     "VALUES('" + action + "','" + description + "','"
            + location.href.substr(location.href.lastIndexOf('/') + 1) + "','" + app.bi.lang + "','"
            + browsers[app.bi.browser] + "','" + app.bi.version + "','" + window.navigator.platform + "')",
     function(rv) { return cb ? cb(true) : null }, function(err) { return cb ? cb(err) : null }).exec();
}
function displayItem(itemid, listid) {
  var imgid = itemid.firstChild
  var lid = document.getElementById(listid)
  if (imgid.src.indexOf("Right") !== -1) {
    lid.style.display = 'block'
    imgid.src = "images/DownArrow.gif"
  } else {
    lid.style.display = 'none'
    imgid.src = "images/RightArrow.gif"
  }
}
