﻿var GTrackCategoryType = {Videos : "Videos", OutboundLinks : "Outbound Links"};
var GTrackAction = {Click : "Click"};

function GTrackEvent(category, action, label, value)
{
    try
    {
        if(value)
        {
            pageTracker._trackEvent(category, action, label, value);        
        }
        else
        {
            pageTracker._trackEvent(category, action, label);        
        }   
    }
    catch(err) {} 
}

function recordOutboundLink(link, label, redirect) {
    try {
        GTrackEvent(GTrackCategoryType.OutboundLinks, GTrackAction.Click, label);
        if (!redirect) {
            return;
        }
        var target = link.target ? link.target : "";
        if (target.length == 0 || target == "_top" || target == "_parent" || target == "_self") {
            var targetLocation = 'window.location';
            switch (target) {
                case "_top": targetLocation = 'window.top.location';
                    break;
                case "_parent": targetLocation = 'window.parent.location';
                    break;

            }
            setTimeout(targetLocation + ' = "' + link.href + '"', 100);
        }
    }
    catch (err) { }
}
