var DynPopup = {}
DynPopup.toggle_content = function(target, now_showing) {
  if (now_showing) {
    getElement('floater_closer').style.display = 'block';
    setClass(getElement('floater_background'), 'floater-background-on');
    setClass(getElement('floater'), 'floater-on');
  }
  else {
    getElement('floater_inner').innerHTML = '';
    setClass(getElement('floater'), 'floater-off');
    setClass(getElement('floater_background'), 'floater-background-off')
    getElement('floater_closer').style.display = 'none';
  }
}
DynPopup.toggle_callback = function(data, context) {
  getElement('floater').innerHTML = data;
  href = context.href.split('?')[0];
  href = href.replace(location.protocol+'//'+location.hostname+'/', '')
  DynPopup.google_analytics_hack(href);
}

// track href calculated in toggle_content
DynPopup.google_analytics_hack = function(href) {
  try {
    pageTracker._trackPageview(href);
    jsLog('pagetracking '+ href);
  }
  catch(e) {
    jsLog('couldnt call pageTracker._trackPageview: ' + e.message)
  }
}
