﻿// OMD - statistics tracking

var tracking = {}

tracking.OnPageLoad = function() {
    
    var dd  = new Date(); 
    
    var ord = Math.round(Math.abs(Math.sin(dd.getTime()))*1000000000)%10000000; 
    
    $.getScript('http://adsfac.net/pct_mx.asp?L=119046&source=js&ord=' + ord);
};

tracking.OnSubscribed = function() {
    
    var dd   = new Date();
    
    var ord  = Math.round(Math.abs(Math.sin(dd.getTime()))*1000000000)%10000000; 
    
    $.getScript('http://adsfac.net/pct_mx.asp?L=119048&source=js&ord=' + ord);


};
 
tracking.OnRecipeLink = function() {
    
    var dd   = new Date();
    
    var ord  = Math.round(Math.abs(Math.sin(dd.getTime()))*1000000000)%10000000; 
    
    $.getScript('http://adsfac.net/pct_mx.asp?L=119047&source=js&ord=' + ord);
};

// Note : the link supplied below preforms a redirect to the supplied url. This is used their end to track the request through to the url. 
// However, for consistency, i have added this method to do the request instead, however, it does mean the clients browser loads the url twice,
// once for the href on the <a> tag, and once for the ajax request via the 302 redirect. Alternitively, one can simply just use this link as 
// the href of the anchor at the expense of consistency. Codah.
tracking.OnVideoLink = function(url, callback) {

    $.getScript('http://adsfac.net/link.asp?cc=ZZZ013.109809.0&clk=1&creativeID=169318&url=' + url, function() { if(callback) callback(); });
}

