function getAffiliateId()
{
    name = 'affiliateID';

    getString = document.location.search;
    returnValue = '';

    do {

        nameIndex = getString.indexOf(name + '=');

        if (nameIndex != -1) {

            getString = getString.substr(nameIndex + name.length + 1, getString.length - nameIndex);
            endOfValue = getString.indexOf('&');

            if (endOfValue != -1) {
                value = getString.substr(0, endOfValue);
            } else {
                value = getString;
            }

            if( returnValue == '' || value == '') {
                returnValue += value;
            } else {
                returnValue += ', ' + value;
            }
        }

    } while (nameIndex != -1)

    return returnValue;
}


affiliateId = getAffiliateId();

if (affiliateId != '') {

    var PHP_SCRIPT = "https://secure.partneris.pl/remote/php/3rdp_clickthrough.php5";

    params = 'sellerId=' + PARTNERIS_SELLER_ID;
    params += '&affiliateId=' + affiliateId;
    params += '&url=' + escape(document.URL);
    params += '&referrer=' + escape(parent == self ? document.referrer : top.document.referrer)
    params += '&time=' + (new Date()).getTime();
    params += '&cookieLifetime=' + PARTNERIS_COOKIE_LIFETIME;
    img = '<img src="' + PHP_SCRIPT + '?' + params + '" style="border:none; display:inline; height:0px; margin:0px; width:0px;"/>';

    document.write(img);

}
