﻿/* Function which marks purchase click to database and forwards browser to the new page. */
function PurchaseClick(url, companyId, productId, productKey, eventType, value) {
    if (value == null) {
        value = '-';
    }
    
    if (productKey == null) {
        $.ajax({
            type: 'POST',
            url: 'Ajax/PurchaseClick.aspx?CompanyId=' + companyId + '&ProductId=' + productId + '&EventType=' + eventType + '&value=' + value,
            data: 'test=Test',
            complete: function(msg) {
                location.href=url;
            }
        });       
    }
    else {
        $.ajax({
            type: 'POST',
            url: 'Ajax/PurchaseClick.aspx?CompanyId=' + companyId + '&EventType=' + eventType + '&value=' + value,
            data: 'test=Test',
            complete: function(msg) {
                location.href = url;
            }
        });   
    }

    return false;
}