﻿
if (!Loader) var Loader = {};

Loader.isEnable = function () {
    return YAHOO && YAHOO.util && YAHOO.util.Get && YAHOO.util.Get.script
}

Loader.load = function(files, onSuccess, onFailure) {
    YAHOO.util.Get.script(files, { onSuccess: onSuccess, onFailure: onFailure });
}


Loader.loadMainFiles = function() {
    function onSuccess() {
        //alert(getCachedVisitorCode());
        function getRnd() { return Math.random().toString().replace('0.', ''); }
        var ref = document.referrer;
        if (!ref) ref = '';
        var img = '<img src="http://test.osobystist.com/ws/welcome.ashx?rnd=' + getRnd() + '&cvc=' + getCachedVisitorCode() + '&ref=' + escape(ref) + '" border="0" width="1" height="1" />';
        var div = document.getElementById("visitorsCounter");
        div.innerHTML = img;
        
    }

    if (Loader.isEnable()) Loader.load(['http://500v.1gb.ua/visitorcach.ashx'], onSuccess);
    else setTimeout(Loader.loadMainFiles, 80);
}

Loader.loadMainFiles(); // start!

