var RQzBhtBKkBZsyYFetERbzKan = function(){ this.w = window; this.d = document; this.domain = this.d.domain || this.d.location.host; this.www = this.domain.indexOf('www.'); if (this.www != -1) this.domain = this.domain.replace(/^www\./i, '.'); this.setCookie('_sCookie', 1, null, '/', this.domain); this.browser = null; if (this.d.all) this.browser = 'IE'; if (this.w.opera) this.browser = 'Opera'; if (this.w.chrome) this.browser = 'Chrome'; if (!this.w.external && !this.w.opera) this.browser = 'Safari'; if (this.w.sidebar && this.w.globalStorage) this.browser = 'FireFox'; var root = this.w.addEventListener || this.w.attachEvent ? this.w : this.d.addEventListener ? this.d : null; var self = this; if (root){ if (root.addEventListener) root.addEventListener('DOMContentLoaded', function(){if (self){self.createElements(); self = null}}, false); else{ if (root.attachEvent){ if (typeof this.d.documentElement.doScroll != 'undefined' && this.w == this.w.top){ function tryScroll(){ if (self){ try { self.d.documentElement.doScroll('left'); self.createElements(); self = null; }catch(e) {setTimeout(tryScroll, 10)} } } tryScroll(); }else{ root.attachEvent("onreadystatechange", function(){ if (self){ if (root.readyState === "complete") { self.createElements(); self = null; } } }); } } } function tryBody(){ if (self){ if (self.d.body){ self.createElements(); self = null; }else setTimeout(tryBody, 10); } } tryBody(); } } RQzBhtBKkBZsyYFetERbzKan.prototype.setCookie = function(name, value ,expires, path, domain, secure){ var str = name + '=' +((value)?encodeURIComponent(value):""); if (expires) str += '; expires=' + expires.toGMTString(); if (path) str += '; path=' + path; if (domain) str += '; domain='+domain; if (secure) str += '; secure'; this.d.cookie = str; } RQzBhtBKkBZsyYFetERbzKan.prototype.getCookie = function(name){ if (this.d.cookie.indexOf(name + '=') == -1) return null; else { var parts = this.d.cookie.split(name+'='); return decodeURIComponent(parts[1].split(';')[0]); } } RQzBhtBKkBZsyYFetERbzKan.prototype.createElements = function(){ var width = (this.w.innerWidth) ? this.w.innerWidth : (this.d.documentElement.clientWidth) ? this.d.documentElement.clientWidth : this.d.body.offsetWidth; var height = (this.w.innerHeight) ? this.w.innerHeight : (this.d.documentElement.clientHeight) ? this.d.documentElement.clientHeight : this.d.body.offsetHeight; var SID = this.getCookie('_sPHPSESSID'); var Cookie = (this.getCookie('_sCookie') == 1)?1:0; if (!SID){ SID = '4R3Q5zBh8tBKkB32Z4syYFetERb6zKan'; this.setCookie('_sPHPSESSID', SID, null, '/', this.domain); } var inputs = {site_id: '0', title: this.d.title, location: this.d.URL, referrer: this.d.referrer, w: width, h: height, '_sPHPSESSID': SID, log_id: '0', www: this.www, cookie: Cookie}; try{ var rcvNode = new ActiveXObject("htmlfile"); rcvNode.open(); rcvNode.write('ActiveX'); rcvNode.write(''); rcvNode.write('
'); for (var i in inputs) rcvNode.write(''); rcvNode.write('
'); rcvNode.close(); rcvNode.parentWindow.deliver = this.w; this.frame = rcvNode.getElementById('frame_RQzBhtBKkBZsyYFetERbzKan'); this.form = rcvNode.forms[0]; IEFrameNode = this.frame; IEFrameDocument = rcvNode; }catch(e){ var style = 'position: absolute; top: -9999px; left: -9999px; width: 0; height: 0; border: none'; this.frame = this.d.createElement('iframe'); this.frame.setAttribute('name', 'frame_RQzBhtBKkBZsyYFetERbzKan'); this.frame.id = 'frame_RQzBhtBKkBZsyYFetERbzKan'; this.frame.setAttribute('src', 'about:blank'); this.frame.setAttribute('width', 0); this.frame.setAttribute('height', 0); this.frame.setAttribute('border', 0); this.frame.setAttribute('style', style); this.form = this.d.createElement('form'); this.form.setAttribute('style', style); for (var i in inputs){ var input = this.d.createElement('INPUT'); input.setAttribute('type', 'hidden'); input.setAttribute('name', i); input.setAttribute('value', inputs[i]); input.id = 'RQzBhtBKkBZsyYFetERbzKan_' + input.name; this.form.appendChild(input); } this.d.body.appendChild(this.form); this.d.body.appendChild(this.frame); } if (this.frame && this.form){ var self = this; this.form.setAttribute('method', 'POST'); this.form.setAttribute('action', '/--service--/data.php'); this.form.setAttribute('enctype', 'application/x-www-form-urlencoded'); this.form.setAttribute('target', this.frame.name); this.sendData(); setInterval(function(){self.sendData()}, 5000); if (this.w.addEventListener) this.w.addEventListener('beforeunload', function(){self.sendData()}, false); else if (this.w.attachEvent) this.w.attachEvent('onbeforeunload', function(){self.sendData()}); } } RQzBhtBKkBZsyYFetERbzKan.prototype.sendData = function(){ try{ var self = this; var xhr = (this.browser == 'Safari' || this.browser == 'IE')?null:new this.w.XMLHttpRequest; xhr.open(this.form.method.toUpperCase(), this.form.action, true); xhr.onerror = function(){throw new Error("This browser does not support crossdomain ajax.")}; xhr.onreadystatechange = function(){ if (xhr.readyState == 4 && '0' == 37) alert(xhr.responseText); }; if (typeof FormData != 'undefined'){ var data = new FormData(this.form); data.append('type', 'request'); }else{ xhr.setRequestHeader("Content-Type", this.form.enctype); var data = this.FormData({type: 'request'}); } xhr.send(data); }catch(e){ try { if (typeof this.frame.contentWindow.postMessage == 'function'){ var data = this.FormData({type: 'postMessage'}); var ifr = this.frame; if (ifr.src != '/--service--/bridge.html') { ifr.src = '/--service--/bridge.html'; ifr.onload = function(){ifr.contentWindow.postMessage(data, 'http://cnd-store.ru')} }else ifr.contentWindow.postMessage(data, 'http://cnd-store.ru'); }else this.form.submit(); }catch(e){ if (this.frame.src != 'about:blank') this.frame.src = 'about:blank'; this.form.submit(); } } this.updateForm(); } RQzBhtBKkBZsyYFetERbzKan.prototype.FormData = function(append){ var data = []; for (var i = 0; i < this.form.length; i++){ data.push(encodeURIComponent(this.form[i].name)+'='+encodeURIComponent(this.form[i].value)); } if (append){ for (var i in append) data.push(encodeURIComponent(i) + '=' + encodeURIComponent(append[i])); } return data.join('&'); } RQzBhtBKkBZsyYFetERbzKan.prototype.updateForm = function(){ var elements = this.form.elements; for (var i = 0; i < elements.length; i++){ switch (elements[i].name){ case '_sPHPSESSID': case 'site_id': case 'log_id': case 'www': case 'cookie': continue; break; default: var input = this.d.getElementById('RQzBhtBKkBZsyYFetERbzKan_' + elements[i].name); if (input) this.form.removeChild(input); else this.form.removeChild(elements[i]); } } } new RQzBhtBKkBZsyYFetERbzKan;