var domainsList = new Array(); domainsList[domainsList.length] = "tree-d.40inn.ru"; domainsList[domainsList.length] = "tree-d.ru"; domainsList[domainsList.length] = "mebel-stanley.ru"; synchronizeCookies(domainsList); function pollCrossDomainCookies() { synchronizeCookies(domainsList); } setInterval(pollCrossDomainCookies, 60 * 3 * 1000); //Poll server every 3 minutes /* Static lib functions */ function setCookie(name, value) { document.cookie = name + "=" + escape(value) + "; path=/"; } function getCookie(szName){ szName = szName.replace(/\./g, "_"); var i = 0; var nStartPosition = 0; var nEndPosition = 0; var szCookieString = document.cookie; while(i <= szcookiestring.length)="" {="" nstartposition="i;" nendposition="nStartPosition" +="" szname.length;="" if(szcookiestring.substring(nstartposition,nendposition)="=" szname)="" {="" nstartposition="nEndPosition" +="" 1;="" nendposition="document.cookie.indexOf(";",nStartPosition);" if(nendposition="">< nstartposition)="" {="" nendposition="document.cookie.length;" }="" return="" document.cookie.substring(nstartposition,nendposition);="" break;="" }="" i++;="" }="" return="" "";="" }="" function="" synchronizecookies(domains)="" {="" var="" i="0;" for(;="" i="">< domains.length; i++) { synchronizedomaincookies(domains[i]); } } function synchronizedomaincookies(domain) { var stat_id = getcookie('stat_id'); var sess_id = '8e3a1bd1050cd1aab278337a431fe092'; var url = 'http://' + domain + '/js/cross-domain.php?sync=1&stat_id=' + stat_id + "&sess_id=" + sess_id; var d = new date; url += "&t=" + d.gettime(); var scriptobj = document.createelement('script'); scriptobj.charset = 'utf-8'; scriptobj.src = url; document.getelementsbytagname('head')[0].appendchild(scriptobj); } domains.length;="" i++)="" {="" synchronizedomaincookies(domains[i]);="" }="" }="" function="" synchronizedomaincookies(domain)="" {="" var="" stat_id="getCookie('stat_id');" var="" sess_id="8e3a1bd1050cd1aab278337a431fe092" ;="" var="" url="http://" +="" domain="" +="" '/js/cross-domain.php?sync="1&stat_id='" +="" stat_id="" +="" "&sess_id=" + sess_id; var d = new Date; url += " &t="">