﻿//---------------------------------------//
//------ statistics for ynetshops -------//
//---------------------------------------//
var amPid = 173; // given by Amadesa
var isAmdesaActive = 1;

// Function of the sale details page
function GetAmadesaProductPageTag(AuctionId,
                                    ProductImg,
                                    ProductLink,
                                    ProductTitle,
                                    ProductDesc,
                                    ProductStatus,
                                    ProductDisplayPrice,
                                    ProductListPrice) {
    amPPid = 4773;

    amProductId = AuctionId;
    amProductImg = ProductImg;
    amProductLink = ProductLink;
    amProductTitle = ProductTitle;
    amProductDesc = ProductDesc;
    amProductDisplayPrice = ProductDisplayPrice;
    amProductListPrice = ProductListPrice;
    amProductStatus = ProductStatus;
    amCategory = "Main" + mainPageCategoryPath;
    
    WriteAmadesaScript();
}

// Function of the category page
function GetAmadesaCategoryPageTag(sAmParam) {

    amCategory = "Main" + mainPageCategoryPath;
    amParams = sAmParam;

    WriteAmadesaScript();
}

// Function of the login page
function GetAmadesaLoginPageTag() {}

// Function of the user fill details page
function GetAmadesaUserFillDetailsPageTag() {

    amPPid = 4697;
    amParams = '';

    WriteAmadesaScript();    
}

// Function of the protected page
function GetAmadesaProtectedPageTag() {

    amPPid = 4698;
    amParams = '';

    WriteAmadesaScript();
}

// Home page tag
function GetHomePageTag() {

    amPPid = 4980;
    amParams = '';
    amCategory = 'Homepage';

    WriteAmadesaScript();
}

// Write the amadesa script
function WriteAmadesaScript() {

    if (isAmdesaActive == 1) {
        try {
            var amHost = (("https:" == document.location.protocol) ? "https://secure-" : "http://");
            document.write("<scr" + "ipt type='text/javascript' src='" + amHost + "cache.amadesa.com/static/client_js/engine/amadesajs.js'><\/scr" + "ipt>");
        }
        catch (err) { }
    }
}

// Thank you page (win offer) tag
function GetWinOfferTag(totalOrder, orderId, auctionId, productCat, city, delPrice) {

    GetAmadesaWinOfferTag(totalOrder, orderId, auctionId, productCat, city, delPrice);
    GetAdsWinOfferTag(totalOrder, orderId, auctionId, productCat, city, delPrice);
}

// Amadesa win offer
function GetAmadesaWinOfferTag(totalOrder, orderId, auctionId, productCat, city, delPrice) {

    amPPid = '4455';
    amRevenue = 'totalOrder=' + totalOrder + '&orderId=' + orderId + '&productId=' + auctionId + '&productCat=' + productCat;

    WriteAmadesaScript();
}

// Ads win offer
function GetAdsWinOfferTag(totalOrder, orderId, auctionId, productCat, city, delPrice) {

    var stam = 'totalOrder=' + totalOrder + '&orderId=' + orderId + '&productId=' + auctionId + '&productCat=' + productCat + '&city=' + city + '&delPrice=' + delPrice;
    document.getElementById("statistic_iframe").src = "/javascripts/ynetshops/statistics.htm?amRevenue=" + stam;
}


