﻿function PageName()
{
    //var sPath = window.location.pathname;
    var sPath = document.location.pathname;
    var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
    return(sPage);
}

function TopOfPage() {
    //alert("TopOfPage! Page:" + document.URL);
    //alert("TopOfPage! Page:" + PageName());
    switch (PageName())
    {
        case "FGDWWaitPage.htm":
            return;
        case "FGDWErrorPage.aspx":
            ReportToGogleAnalytics();
            break;
    }
}

function BottomOfPage() {
    //alert("BottomOfPage!");
    switch (PageName()) {
        case "FGDWWaitPage.htm":
        case "FGDWErrorPage.aspx": //Reported at top of page in case of an error!
            return;
    }
    ReportToGogleAnalytics();

}

//function ReportToGogleAnalytics() { }
function ReportToGogleAnalytics()
{
    //prevent when debugging
    if (document.URL.indexOf("localhost") > 0)
        return;
    //alert("ReportToGogleAnalytics!");        
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    try {
    var pageTracker = _gat._getTracker("UA-12107579-1");
    pageTracker._trackPageview();
    } catch(err) {}
}
/* */