var url = "http://"+window.location.host+"/";
var page = document.URL.split(url)[1];

var sectionArray = [
    ["Home", ["index.php?en", "en.phtml"], []],
    ["ProductOverview", ["products.phtml", "index.php?products"], []],
    ["Support", ["support.phtml", "quick-start-guide.phtml", "implement.phtml", "component-implement-timeline.phtml", "component-implement-actionscript.phtml", "component-purchase-details.phtml", "component-purchase-faq.phtml", "effect-component-faq.phtml", "banner-edition.phtml", "as2-as3-differences.phtml"], ["video/"]],
    ["ProductHome", ["effect-component-bundle.phtml"], ["-effect.phtml"]],
    ["ProductDownload", [], ["-effect-download.phtml"]],
    ["ProductOnlineDemo", [], ["-effect-online-demo.phtml"]],
    ["ProductImplement", [], ["-effect-implement.phtml"]],
    ["ProductTrialInfo", [], ["-effect-free-trial-version.phtml"]],
    ["ProductTrialPage", [], ["-effect-trial-page.phtml"]]
  ]


function findSection()
{
  for(var i = 0; i < sectionArray.length; i++)
  {
    var checkArray = sectionArray[i][1];
    for(var j = 0; j < checkArray.length; j++)
    {
      if(checkArray[j] == page)
      {
        return sectionArray[i][0];
      }
    } 
    var checkArray = sectionArray[i][2];
    for(var j = 0; j < checkArray.length; j++)
    {
      if(page.indexOf(checkArray[j]) != -1)
      {
        return sectionArray[i][0];
      }
    }
  }
  return "none";
}

 
var section = "none";

try
{
  section = findSection();
}
catch(err)
{
}

//section = findSection();
//console.log(page+" "+section);

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-344954-5']);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_setCustomVar', 1, 'Section', section, 3]),
_gaq.push(['_trackPageview']);

(function() {
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
