﻿function mainlinkCounterCatchError(a){var b=new Image();b.src='http://stat.mainlink.ru/countererrorhandler.ashx?err='+encodeURIComponent(a)}function mainlinkCounterLoadScript(b){try{var sid=0;var x = document.getElementsByTagName("script");for(var i=0; i < x.length; i++){if(x[i].getAttribute("src") != null && x[i].getAttribute("src").indexOf('http://stat.mainlink.ru/js/counter.js?i=') > -1){sid=x[i].getAttribute("src").substring(x[i].getAttribute("src").indexOf('?i=') + 3);break;}}var z=function(a){return document.createElement(a)};var a=z('span');with(a){setAttribute('id','openstat' + sid);setAttribute('display','none')}document.body.insertBefore(a,document.body.firstChild);openstat={counter:sid,next:openstat,track_links:"all"};a=z('script');with(a){setAttribute('defer','defer');setAttribute('type','text/javascript');setAttribute('charset','utf-8');setAttribute('src',b+'//stat.mainlink.ru/js/actions.js?r='+Math.floor(Math.random()*10000000))}var y=document.getElementsByTagName("head")[0];document.getElementsByTagName("head")[0].insertBefore(a,y.firstChild);a=z('script');with(a){setAttribute('defer','defer');setAttribute('type','text/javascript');setAttribute('charset','utf-8');setAttribute('src',b+'//openstat.net/cnt.js')}var y=document.getElementsByTagName("head")[0];document.getElementsByTagName("head")[0].insertBefore(a,y.firstChild)}catch(e){mainlinkCounterCatchError('filename = '+e.fileName+'&name = '+e.name+'&message = '+e.message)}}if(document.location.protocol.indexOf('http')>-1){var openstat;mainlinkCounterLoadScript(document.location.protocol)}else{mainlinkCounterCatchError('protocol is '+document.location.protocol)}
