﻿var pageTracker = _gat._getTracker("UA-5870493-8");
pageTracker._trackPageview();

function TrackSiteEvent(eventId)
{
    var SiteEventTracker = _gat._getTracker("UA-5870493-8");
    
    SiteEventTracker._trackPageview(eventId);
}

function enableTracking()
{
    $('.google-track-product').each(function(i)
    {
        if($(this).parents('#product-navigation') != '')
        {
            var trackCode = $(this).attr('rev');
            trackCode += '-' + $('input#product-id').val();
            
            $(this).attr('rev', trackCode);
        }
    });
    
    $('.google-track-recipe').each(function(i)
    {
            var trackCode = $(this).attr('rev');
            trackCode += '-' + $('input#recipe-id').val();
            
            $(this).attr('rev', trackCode);
    });
    
   $('.google-track').each(function(i)
    {
        var trackCode = $(this).attr('rev');
        
        $(this).attr('rev', trackCode);
    });
    
    $('.google-track, .google-track-product, .google-track-recipe').live('click', function(e)
    {
        var trackCode = $(this).attr('rev');
         
        TrackSiteEvent(trackCode);
    });
}

$(document).ready(function()
{
    enableTracking();
});