﻿var query=window.location.search.substring(1);
if (window.location.href.indexOf("#")!= -1) {
  query = window.location.href.split("#")[1];
}

var urlParams = {};
(function () {
    var e,
        a = /\+/g,  // Regex for replacing addition symbol with a space
        r = /([^&=]+)=?([^&]*)/g,
        d = function (s) { return decodeURIComponent(s.replace(a, " ")); },
        q = query;

    while (e = r.exec(q))
        urlParams[d(e[1])] = d(e[2]);
})();

if (window.location.href.indexOf("#")!= -1) {
  querystring = "#" + window.location.href.split("#")[1];
}

// Post affiliate pro
if ("a_aid" in urlParams) {
    PostAffTracker.setAccountId('default1');
    try {
        PostAffTracker.track();
    } catch (err) { }

    var papId = getCookie("PAPVisitorId");
    document.write('<img border=0 alt="" src="https://secure.shop033.com/CookieWriter.aspx?CookieDays=60&AffiliateSource=1&AffiliateId=' + papId + '&PAPVisitorId=' + papId + '" style="width: 1px; height=1px">');
}

// ShareASale
if ("SSAID" in urlParams) {
    var sasId = urlParams["SSAID"];
    document.write('<img border=0 alt="" src="https://secure.shop033.com/CookieWriter.aspx?CookieDays=60&AffiliateSource=2&AffiliateId=' + sasId + '" style="width: 1px; height=1px">');
}

// Commision Junction
if ("CJAID" in urlParams && "CJPID" in urlParams) {
    var cjId = urlParams["CJPID"];
    document.write('<img border=0 alt="" src="https://secure.shop033.com/CookieWriter.aspx?CookieDays=60&AffiliateSource=3&AffiliateId=' + cjId + '" style="width: 1px; height=1px">');
}


