﻿var currProduct = "";

function showCTA(button, cta, bgimg) {
  document.getElementById('WorkSmarterCTA').style.display = "none";
  document.getElementById('WorkBetterCTA').style.display = "none";
  document.getElementById('ReduceRiskCTA').style.display = "none";
  document.getElementById('WorkSmarter').firstChild.className = "inactive";
  document.getElementById('WorkBetter').firstChild.className = "inactive";
  document.getElementById('ReduceRisk').firstChild.className = "inactive";

  document.getElementById('SLDownLevel').style.backgroundImage = "url(/officebusiness/ClientBin/" + bgimg + ")";
  document.getElementById(cta).style.display = "block";
  document.getElementById(button).firstChild.className = "active";
}

function buildMailString() {
  currMailto = document.getElementById('share').getAttribute('href');
  if (currProduct != "") {
    newPgURL = location.href + "?prod=" + currProduct.toString();
  } else {
    newPgURL = location.href;
  }

  msgSubj = "See how Office 2007 works for your business.";
  msgBody = "%0AYour business has unique needs. That%27s why Microsoft Office 2007 offers diverse solutions to help you reach your goals. Office 2007 products and services can help people work smarter, work better together, and work safer.%0A%0ATransform the way you do business. See how Office 2007 can help%3A " + newPgURL;
  fullMsg = "mailto:?subject=" + msgSubj + "&body=" + msgBody;

  document.getElementById('share').setAttribute('href', fullMsg);
}

function analyticsCalls(element, wtDcsid, wtDomain, wtFpc, wtAction, wtSection, wtPage, wtPlacement, wtLink) {
  analyticsContainer = document.getElementById('Analytics');
  atlasTag = document.createElement('script');
  atlasTag.setAttribute('language', 'Javascript');
  
  // Atlas tracking
  switch (element.id) {
    case 'share':
      atlasTag.setAttribute('src', 'http://view.atdmt.com/jaction/asc_msoffice_sharewithcolleague');
      analyticsContainer.appendChild(atlasTag);
      break;
    case 'VolumeLic':
      atlasTag.setAttribute('src', 'http://view.atdmt.com/jaction/asc_msoffice_learnaboutvolumelicensing');
      analyticsContainer.appendChild(atlasTag);
      break;
    case 'FindProvider':
      atlasTag.setAttribute('src', 'http://view.atdmt.com/jaction/asc_msoffice_findasolutionprovider');
      analyticsContainer.appendChild(atlasTag);
      break;
  }

  // WebTrends tracking
  dcsMultiTrack(wtDcsid, wtDomain, wtFpc, wtAction, wtSection, wtPage, wtPlacement, wtLink);
}