function BitField(n_bits, value)
{	this.b = new Array(n_bits);
	this.obj = function(arg)
	{	return typeof(arg)=='object' ? arg : new BitField(this.b.length, arg);
	};
	this.o_not = function()
	{	for (var i=0; i<this.b.length; i++) this.b[i] ^= 1;
		return this;
	};
	this.o_and = function(arg)
	{	for (var i=0; i<this.b.length; i++) this.b[i] &= this.obj(arg).b[i];
		return this;
	};
	/*this.o_or = function(arg)
	{	for (var i=0; i<this.b.length; i++) this.b[i] |= this.obj(arg).b[i];
		return this;
	};*/
	this.o_xor = function(arg)
	{	for (var i=0; i<this.b.length; i++) this.b[i] ^= this.obj(arg).b[i];
		return this;
	};
	this.o_shl = function(n_bits)
	{	for (var i=this.b.length-1; i>=0; i--) this.b[i] = i-n_bits>=0 ? this.b[i-n_bits] : 0;
		return this;
	};
	this.o_shr = function(n_bits)
	{	for (var i=0; i<this.b.length; i++) this.b[i] = i+n_bits<this.b.length ? this.b[i+n_bits] : 0;
		return this;
	};
	this.o_add = function(arg)
	{	for (var i=0, cr=0; i<this.b.length; i++) cr+=this.b[i]+this.obj(arg).b[i], this.b[i]=cr&1, cr>>=1;
		return this;
	};
	this.clone = function()
	{	var peer = new BitField(this.b.length, 0);
		for (var i=0; i<this.b.length; i++) peer.b[i] = this.b[i];
		return peer;
	};
	this.o_neg = function()
	{	return this.o_not().o_add(new BitField(this.b.length, 1));
	};
	this.set_value = function(number)
	{	for (var i=0; i<this.b.length; i++, number>>=1) this.b[i] = number & 1;
		return this;
	};
	this.get_value = function()
	{	if (this.b[this.b.length-1]) return -this.clone().o_neg().get_value();
		var v = 0;
		for (var i=0; i<this.b.length-1; i++) v |= this.b[i] << i;
		return v;
	};
	/*this.get_xvalue = function()
	{	var v = '';
		for (var i=0; i<this.b.length; i+=4)
		{	v = '0123456789ABCDEF'.charAt(this.b[i] + (this.b[i+1] || 0)*2 + (this.b[i+2] || 0)*4 + (this.b[i+3] || 0)*8) + v;
		}
		return v;
	};*/
	this.set_value(value);
}
_S_T =
{	uid: null,
	busy: 2, // event load in progress; 0: idle; 1: delay; 2: querying
	timer: null, // event load timeout resource
	interval: null, // tasks interval
	interval_delay: 0, // tasks are done each N secs
	html_input_state: {},
	html_input_state_changed_times: 0,
	filter_a: {}, // executed actions
	t_on_p_total: 0, // time on page total (sec) (is used by install_focus)
	t_on_p_focused: 0, // time on page in focus (sec) (is used by install_focus)
	start_time: 0, // is used by install_focus
	curr: 0, // is used by install_focus
	focused: 1,
	occured_queue: [],
	page_groups: [], // array of group ids; which groups current location.href matches to?
	conds: {}, // e.g. {c1:0, c2:0, c10:'foobar'} - only keys matter. conditions matched on this page. only conditions that appear in containers or sticky are listed
	//was_loaded: 0, //window not loaded;
	_aa: {}, //"js_actions"
	_redir: {}, //"redirect actions"
	a_timers: [], //"action timeouts"
	_doc: document,
	_window: window,
	_html_changed_in:{}, //"was put_image or put_html"
	_containers_initialized:0,
	_containers_e:[],
	_queue:[], //"images not in container"
	_queue_o:{}, //"images not in container"
	_a_click_in: false, //on-off a-click-event with inner href
	_a_click_out: false, //on-off a-click-event with outer href
	isIE: /*@cc_on!@*/false,
	get_win_4_evt: function(evt) {
		if ((evt == 'mouseup' || evt == 'keyup') && _S_T.isIE) {
			return _S_T._doc.body;
		}
		return _S_T._window;
	},
	get_left_btn: function() {
		return _S_T.isIE ? 1 : 0;
	},
	add_to_queue: function(rid, a) {
		var key = rid+","+a;
		if (key in _S_T._queue_o) return;
		_S_T._queue_o[key] = 1;
		_S_T._queue.push([rid,a]);
	},
	remove_from_queue: function(rid, a) {
		var key = rid+","+a;
		if (!(key in _S_T._queue_o)) return;
		delete _S_T._queue_o[key];
		for (var i=_S_T._queue.length-1;i>=0;--i) {
			var o = _S_T._queue[i];
			if (o[0] == rid && o[1] == a) {
				_S_T._queue.splice(i,1);
				return;
			}
		}
	},
	id: function(id)
	{	var elem=document.getElementById(id);
		if (elem) return elem;
		if (document.getElementsByName)
		{	var byname = document.getElementsByName(id);
			return byname && byname.length ? byname[0] : null;
		}
		var all = document.getElementsByTagName('*');
		for (var i=all.length-1; i>=0; i--)
		{	if (all[i].name == id) return all[i];
		}
	},
	/**	Get or set single cookie that stores serialized object (initially {}). If cookie name starts with '_', the cookie will be a session cookie (without "expires").
		@param {String} Cookie name
		@param {Object} If specified, will store this object to cookie (if not specified will only return stored object).
		@param {bool} If false (default) properties of specified object (new_value) will be added to properties of previously stored object. If true, will override stored object with new_value.
		@return {Object}
	 **/
	cookie_obj: function(name, new_value, set_new_value) {
		var set_cookie = function(c) {document.cookie = c;}
		var get_cookie = function() {return document.cookie;}
		name = encodeURIComponent(name);
		var _obj = {};
		var func = function(a, k, v) {_obj[decodeURIComponent(k)] = decodeURIComponent(v)};
		decodeURIComponent((get_cookie().match(new RegExp('\\b'+name+'=([^;]+)')) || ['', ''])[1]).replace(/([^&=]+)=([^&]*)/g, func);
		if (new_value)
		{	if (set_new_value) _obj = {};
			for (var i in new_value) _obj[i] = new_value[i];

			var vals = [], for_send = name.charAt(0)=='_';
			for (var i in _obj) if (_obj[i] !== null) vals.push(encodeURIComponent(i) + '=' + encodeURIComponent(_obj[i]));
			var exp = name.charAt(0)=='_' ? '' : ';expires='+new Date(2100,1,1).toGMTString();
			var c = name+'='+encodeURIComponent(vals.join('&'))+';path=/'+exp;
			if (!for_send || _S_T.bytes(c) <= 4096) {
				set_cookie(c);
			} else {
				var vals2 = [];
				while(_S_T.bytes(c) > 4096) {
					var v = vals.pop();
					if (!vals.length) return null;
					vals2.push(v);
					c = name+'='+encodeURIComponent(vals.join('&'))+';path=/counter.websolize.com'+exp;
				}
				set_cookie(c);
				_S_T.iframe.call(_S_T);
				c = name+'='+encodeURIComponent(vals2.join('&'))+';path=/counter.websolize.com'+exp;
				set_cookie(c);
			}
		}
		return _obj;
	},
	bytes: function(str) {
		return (unescape(encodeURIComponent(str))).length;
	},
	add_cont_event: function(elem, event, f, html_id) {
		_S_T._containers_e.push([event, html_id, _S_T.add_event(elem, event, f)]);
	},
	add_event: function(elem, event, f) {
		return _S_T.add_e(elem, 'on'+event, f);
		//var old = elem['on'+event];
		//elem['on'+event] = function(e) {f(e || window.event); return old && old(e)};
	},
	__get_disp: function() {
		return function(){
			var ap=Array.prototype, c=arguments.callee, ls=c._listeners, t=c.target;
			if (c.caller) return;//must be top level function for events
			var r = t && t.apply(this, arguments);
			var lls = [].concat(ls);
			for(var i in lls){
				if(!(i in ap)){
					lls[i].apply(this, arguments);
				}
			}
			return r;
		}
	},
	add_e: function(source, method, listener) {
		var f = source[method];
		if(!f||!f._listeners){
			var d = _S_T.__get_disp();
			d.target = f;
			d._listeners = [];
			f = source[method] = d;
		}
		return f._listeners.push(listener);
	},
	remove_e: function(source, method, handle){
		var f = source[method];
		if(f && f._listeners && handle--){
			delete f._listeners[handle];
		}
	},
	reg_onready: function(func) {
		var p = 'reg_onready_156403';
		var loaded = function() {return ('uninitialized|loading'/*@cc_on+'|interactive'@*/).indexOf(document.readyState) == -1};
		if (window[p+'_called'] || loaded()) {
			return func();
		}
		if (!window[p])
		{	window[p] = function() {window[p+'_called']=true; window[p]=function() {}};
			var prev_onload = window.onload;
			window.onload = function() {prev_onload && prev_onload(); window[p]()};
			if (document.addEventListener)
			{	document.addEventListener('DOMContentLoaded', function() {window[p]()}, false);
			}
			else
			{	(window[p+'_t'] = function() {loaded() ? window[p]() : setTimeout(window[p+'_t'], 600)})();
			}
		}
		var orig = window[p];
		window[p] = function() {orig(); func()};
	},
	fire_actions: function(a, not_get_chains) {
		if (a) for (var i=0; i<a.length; i++) for (var j=1; j<a[i].length; j++) {
			var aid = a[i][j], rid = a[i][0];
			if ((''+aid) in _S_T.filter_a) continue;
			if (_S_T._redir[''+aid]) {
				_S_T.fire_action(aid, rid, 0);
				return;
			}
			var at = _S_T.get_atime(aid);
			if (!not_get_chains) {
				var chs = _S_T.get_chains(aid);
				if (!chs) {
					_S_T.fire_action(aid, rid, at);
				} else {
					(function() {
						var _chs = chs;
						var callback = function() {
							for(var k=0, lenk=_chs.length; k<lenk; ++k) {
								_chs[k].start=1;
								_S_T.fire_from_chain(_chs[k], rid, at);
							}
						};
						_S_T.reg_onready(callback);
					})();
				}
			} else {
				_S_T.fire_action(aid, rid, at);
			}
		}
		this.reg_onready (
			function() {
				//_S_T.was_loaded = 1;
				_S_T.init_containers();
			}
		);
	},
	fire_from_chain: function(ch, rid, at) {
		if (ch.i==0 && ch.delay>0) {
			ch.timer=setTimeout(function() {
				ch.delay=0;
				_S_T.fire_from_chain.call(_S_T, ch, rid, at);
			}, Math.floor(ch.delay*1000))
			return;
		}
		if (ch.i > 0) at=0;
		if (ch.cycle && ch.i>=ch.chain.length) {
			delete ch.start;
			ch.i=0;
		}
		var j = ch.i-1;
		if (j<0 && !ch.start) j = ch.chain.length-1;
		_S_T.stop_in_chain(ch,j);
		var as = ch.chain[ch.i];
		if (!as) return;
		var t = as[as.length-2];
		var is_o = typeof as[0] == 'object';
		if (as[0].sum === undefined) {
			var n=0;
			for(var k=0,endk=as.length-2;k<endk;++k) {
				var o = as[k];
				if (o.w>0) {
					o.w1 = n;
					n = o.w2 = n + o.w;
				}
			}
			as[0].sum = n;
		}
		var rand = -1;
		if (is_o && as[0].sum > 0) {
			rand = Math.floor(Math.random()*as[0].sum);
		}
		for(var k=0,endk=as.length-2;k<endk;++k) {
			var o = as[k], a = is_o ? o.a : o;
			if (is_o) {
				o.e = 0;
				if (rand >= 0 && o.w>0 && (rand<o.w1 || rand>=o.w2)) continue;
				if (o.w && o.c > 0) --o.c;
				if (!o.c || !o.w) continue;
				o.e = 1;
			}
			_S_T.fire_action(a, rid, at);
		}
		_S_T.init_containers();
		++ch.i;
		if (t>0) ch.timer=setTimeout(function(){_S_T.fire_from_chain(ch, rid, at);}, Math.floor(t*1000));
	},
	stop_in_chain: function(ch, j) {
		if (j>=0) {
			var as = ch.chain[j], do_stop=as[as.length-1];
			for(var k=0,endk=as.length-2;k<endk;++k) {
				var o = as[k], is_o = typeof o == 'object', a = is_o ? o.a : o;
				if (!o.c) o.e = 0;
				if (do_stop && !is_o || is_o && o.e && (do_stop || o.s)) {
					if (is_o) o.e = 0;
					_S_T.stop_a(a);
				}
			}

		}
	},
	stop_a: function(a) {
		try{clearTimeout(_S_T.a_timers[a]); _S_T.close_action(a);} catch(e) {}
	},
	init_containers: function() {
		if (_S_T._containers_initialized && !_S_T._html_changed_in.FOUND) return;
		var c = _S_T.containers;
		for (var html_id in c) {
			try {
				// c[html_id] is {id:container_id, tp:container_types, ac:action_ids, em:style_override_empty, oc:style_override_occupied, ud:units_direction, uc:units_count_max, udf:user_data_field, ghm:grab_html_mask_regexp, cn:[1,2,-3], a:placed_action_id, rid:record_id, html:html} // a, rid and html are assigned when action is put
				this.init_container(html_id, c[html_id], this.id(html_id));
			}
			catch (e)
			{	window.console && console.log(e.message); // e.description is usually null
			}
		}
		_S_T._containers_initialized=1;
		//_S_T._html_changed_in={};
	},
	init_container: function(html_id, c, elem, noraise) {
		var tp = c.tp;
		if (_S_T._containers_initialized) {
			if (!(html_id in _S_T._html_changed_in)) return;
			tp &= 1; // leave only a placeholder type
		}
		if (c.cn.length)
		{	var ok=0, found=0;
			for (var i=c.cn.length-1; i>=0; i--)
			{	if (c.cn[i] < 0)
				{	if (('c'+(-c.cn[i])) in _S_T.conds) return; // don't use container if condition matches
				}
				else
				{	found = 1; // if there were no positive containers - that means ok
					if (('c'+c.cn[i]) in _S_T.conds) ok = 1; // use container if condition matches
				}
			}
			if (found && !ok) return;
		}
		if (html_id=='-3') {
			if (((tp) & 2048))
			{	this.add_cont_event
				(	_S_T.get_win_4_evt('mouseup'), 'mouseup', function(e)
					{	var evt=_S_T._window.event || e;
						if (evt.button==_S_T.get_left_btn()) _S_T.occured(html_id, 1, 2, 2048, 0, 0);
					},
					null
				);
			}
			if (((tp) & 4096))
			{	this.add_cont_event
				(	_S_T.get_win_4_evt('mouseup'), 'mouseup', function(e)
					{	var evt=_S_T._window.event || e;
						if (evt.button==2) _S_T.occured(html_id, 1, 2, 4096, 0, 0);
					},
					null
				);
			}
			if (((tp) & 8192))
			{	this.add_cont_event
				(	_S_T.get_win_4_evt('keyup'), 'keyup', function()
					{	_S_T.occured(html_id, 1, 2, 8192, 0, 0)
					},
					null
				);
			}
			if (((tp) & 16384))
			{	this.add_cont_event
				(	_S_T._window, 'scroll', function()
					{	var c = arguments.callee;
						if (!c._scroll_timeout)
						{	_S_T.occured(html_id, 1, 2, 16384, 0, 0);
							c._scroll_timeout=1;
							setTimeout(function() {delete c._scroll_timeout}, 1000);
						}
					},
					null
				);
			}
		}
		else {
			if (elem)
			{	if (((tp) & 1)) {
					if (elem.value == null) // can't use input/select/textarea as a placeholder
					{	var style = c.a==null ? c.em : c.oc;
						for (var s in style)
						{	if (typeof(style[s]) != 'function')
							{	var s2 = s.toLowerCase().replace(/-(\w)/g, function(a, m) {return m.toUpperCase()});
								try {elem.style[s2] = style[s]} catch (e) {}
							}
						}
						if (!c._stop && c.a != null) {
							if (c.ud == 'bt' || c.ud == 'rl') c.html.reverse();
							try {
								elem.innerHTML = c.html.join(' ');
								var e = c.a.join();
								c._stop = 1; // avoiding this will cause actions be reported many times
								if (!noraise) {
									this.occured(html_id, e, 3, 1, c.rid, 1);
								}
							} catch(e) {}
						}
					}
				}
				if (((tp) & 6))
				{	if (elem.value != null)
					{	var f = function() {_S_T.occured(html_id, (_S_T.id(html_id).value||'').substr(0, 50), 1, tp & 6, 0, 0)}
						this.add_cont_event(document, 'keyup', f, html_id);
						this.add_cont_event(document, 'mouseup', f, html_id);
					}
				}
				if (((tp) & 8))
				{	this.add_cont_event(elem, 'click', function() {_S_T.occured(html_id, 1, 2, 8, 0, 0)}, html_id);
				}
				if (((tp) & 16))
				{	this.add_cont_event(elem, 'click', function() {_S_T.filter_a={}; _S_T.occured(html_id, '', 0, 16, 0, 2)}, html_id);
				}
				if (((tp) & 32))
				{	this.add_cont_event(elem, 'mouseover', function() {_S_T.occured(html_id, 1, 2, 32, 0, 0)}, html_id);
				}
				if (((tp) & 64))
				{	this.grab_html(html_id);
				}
				if (((tp) & 512))
				{	var obj = this.id(html_id);
					if (obj)
					{	var v = this.get_prop(c.udf);
						obj.value!=null ? obj.value=v : obj.innerHTML=this.escape_html(v);
					}
				}
			}
			// container doesn't have to exist at page load
			if (((tp) & 128))
			{	this.grab_html(html_id);
				this.start_tasks(6000);
				this.add_cont_event(_S_T._window, 'unload', function() {_S_T.grab_html.call(_S_T, html_id);}, null);
			}
			if (((tp) & 256))
			{	this.grab_html(html_id);
				this.start_tasks(1000);
				this.add_cont_event(_S_T._window, 'unload', function() {_S_T.grab_html.call(_S_T, html_id);}, null);
			}
		}
	},
	clean_up_containers: function() {
		clearInterval(_S_T.interval);
		delete _S_T.interval;
		var _e = _S_T._containers_e;
		if (_e) {
			for (var i=_e.length-1;i>=0;--i) {//"_e[i]=[e, html_id, handler]"
				var elem=_e[i][1]!=null ? _S_T.id(_e[i][1]) : _S_T.get_win_4_evt(_e[i][0]);
				if (elem) _S_T.remove_e(elem, 'on'+_e[i][0], _e[i][2]);
			}
			_e.length=0;
		}
	},
	start_tasks: function(delay)
	{	if (!_S_T.interval)
		{	_S_T.interval = setInterval(function(){_S_T.task()}, delay);
			_S_T.interval_delay = delay;
		}
		else if (_S_T.interval_delay > delay) // want frequently
		{	clearInterval(_S_T.interval);
			_S_T.interval = null;
			_S_T.start_tasks(delay); // restart with shorter delay
		}
	},
	task: function()
	{	// 1. Monitor changes of html in container of type "grab html"
		var c = _S_T.containers;
		for (var html_id in c)
		{	if (c[html_id].tp & 384)
			{	_S_T.grab_html(html_id);
			}
		}
	},
	grab_html: function(html_id) {
		var c = _S_T.containers;
		var obj = this.id(html_id);
		var s = _S_T.apply_ghm(_S_T.inner_text(obj), c[html_id].ghm).substr(0, 50);
		if (!s) return; // if no content, return
		if (s != this.html_input_state[html_id]) { // if content is changed...
			if (_S_T.html_input_state_changed_times++ >= 100) return;
			this.html_input_state[html_id] = s;
			this.occured(html_id, s, ((c[html_id].tp) & 256) ? 0 : 1, c[html_id].tp & 448, 0, 1);
		}
	},
	apply_ghm: function(text, regexp) // Apply "grab_html_mask_regexp" on text. Will catch first reference, e.g., if applying "\s*(.*?)\s*" on " foobar " will return "foobar"
	{	if (!text) text = '';
		if (!regexp) return text;
		var m = text.match(new RegExp(regexp));
		return !m || m[1]==null ? '' : m[1];
	},
	inner_text: function(elem)
	{	if (!elem) return '';
		if (_S_T.isIE) return elem.innerText;
		return (elem.innerHTML || '').replace(/<script[^>]*>[\S\s]*?<\/script>/ig, '')
			.replace(/<style[^>]*>[\S\s]*?<\/style>/ig, '').replace(/<[^>]*>/g, '').replace(/&nbsp;/ig, ' ').replace(/&lt;/ig, '<')
			.replace(/&gt;/ig, '>').replace(/&quot;/ig, '"').replace(/&amp;/ig, '&').replace(/\s+/g, ' ')
			.replace(/^\s+/, '').replace(/\s+$/, '');
	},
	escape_html: function(text)
	{	return (''+text).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;');
	},
	put_img: function(a, rid, w, h, url, stop){
		this.put_html(a, rid, w, h, '<img src="'+this.escape_html(url)+'"/>', stop, 'image')
	},
	put_html: function(a, rid, w, h, html, stop, a_type){
		this.add_to_queue(rid, a);
		if (!a_type) a_type='html';
		var cc = this.containers;
		for (var html_id in cc){
			var c = cc[html_id];
			if (c && ((c.tp) & 1) && c.uc > 0){
				if (c.__w === undefined) {c.__w = c.w; c.__h = c.h;}
				var a_ids = c.ac;
				var vert = c.ud == 'bt' || c.ud == 'tb';
				var tag = vert ? 'div' : 'span';
				var display = vert ? 'block' : 'inline-block';
				// personal click reporting for each action inside container
				html = '<'+tag+' style="display:'+display+' !important" onclick="_S_T.occured(\''+html_id+'\', '+(a-0)+', 3, 1, '+(-rid)+', 1)">'+html+'</'+tag+'>';
				for (var i=0; i<a_ids.length; ++i){
					if (a_ids[i]==a) {
						var hasnt = 1;
						if (c.a) {
							for (var k=c.a.length;k>=0;--k) {
								if (c.a[k]==a) {hasnt=0;break;}
							}
						}
						if (hasnt && (vert ? (c.h < 0 || h <= 0 || h <= c.h) : (c.w < 0 || w <= 0 || w <= c.w))) {
							if (!c.html) c.html = [];
							c.html.push(html);
							if (!c.a) c.a = []; c.a.push(a);
							if (!c.wh) c.wh = []; c.wh.push([w,h]);
							if (vert) {
								if (c.h >= 0 && h > 0) {
									c.h -= h;
									if (c.h < 0) c.h = 0;
								}
							} else {
								if (c.w >= 0 && w > 0) {
									c.w -= w;
									if (c.w < 0) c.w = 0;
								}
							}
							c.rid = rid;
							--c.uc;
							delete c._stop;
							var at = parseInt(stop);
							if (!isNaN(at) && at) setTimeout(function() {_S_T.del_html.call(_S_T, a, a_type);}, at*1000);
							this.remove_from_queue(rid, a);
							_S_T._html_changed_in.FOUND=1;
							_S_T._html_changed_in[html_id]=1;
							return 1;
						}
					}
				}
			}
		}
		this.action_no_place(a);
	},
	del_html: function(a, a_type) {
		var cc = this.containers, found=0;
		for (var html_id in cc){
			var c = cc[html_id];
			if (c && ((c.tp) & 1) && c.a && c.a.splice && c.html && c.html.splice && c.wh && c.wh.splice) {
				for (var i=c.a.length-1; i>=0; --i) {
					if (c.a[i] == a) {
						c.a.splice(i, 1);
						c.html.splice(i, 1);
						c.wh.splice(i, 1);
						++c.uc;
						this.recalc_c_wh(c);
						delete c._stop;
						this.init_container(html_id, c, this.id(html_id), 1);
						found=1;
					}
				}
			}
		}
		if (found) _S_T.a_closed(a, a_type);
	},
	recalc_c_wh: function(c) {
		var vert = c.ud == 'bt' || c.ud == 'tb';
		var wh = 'w', j = 0;
		if (vert) {
			var wh = 'h', j = 1;
		}
		c.w = c.__w; c.h = c.__h;
		for (var k=0, kk=c.wh.length; k<kk; ++k) {
			if (c[wh] >= 0 && c.wh[k][j] > 0) {
				c[wh] -= c.wh[k][j];
				if (c[wh] < 0) c[wh] = 0;
			}
		}
	},
	action_no_place: function(a)
	{
	},
	custom_event: function(html_id, value)
	{	this.occured(html_id, value||'', 0, 1024, 0, 0);
	},
	occured: function(html_id, value, replace_add, container_mask, rid, mode) { // if rid is specified then report about occupied container (negative rid means personal report for single action inside shared container), otherwise initiate event
		if (!this.get_record_id()) // before we got response from iframe (ld=1)
		{	_S_T.occured_queue.push([html_id, value, replace_add, container_mask, rid, mode]);
			return;
		}
		if (html_id==-1 || ((container_mask) & 1)) {
			var aids = (''+value).split(/,/);
			for (var n=aids.length-1;n>=0;--n) _S_T.filter_a[aids[n]]=true;
		}
		if (html_id=='sid' || html_id=='inew' || html_id=='ls' || html_id=='lurl' || html_id=='la') throw new Error('Text input used by Stat Track cannot be named "sid", "inew", "ls", "lurl" or "la"');
		rid = parseInt(rid) || ('e'+_S_T.get_record_id());
		var m = _S_T.cookie_obj('_stat_track_s_id');
		var reset = 1;
		// if rid < 0 then replace_add must be 3, and value must be single integer
		if (replace_add)
		{	for (var i in m)
			{	var prefix = '_'+container_mask+'_'+rid+'_';
				var prefix_neg = '_'+container_mask+'_'+(-rid)+'_';
				if ((''+i).substring((''+i).lastIndexOf(prefix)+prefix.length) == html_id)
				{	// found
					if (replace_add == -1)
					{	if (m[i] == value) reset = 0;
					}
					if (replace_add == 2)
					{	value = (value-0) + (m[i]-0);
					}
					if (replace_add == 3)
					{	var a1 = m[i].split(',').concat((value+'').split(',')), a2=[], old;
						a1.sort(function(a, b) {return a-b});
						for (var j=a1.length; j>=0; --j)
						{	if (old != a1[j])
							{	old = a1[j];
								a2.push(old);
							}
						}
						m[i] = a2.join();
						_S_T.cookie_obj('_stat_track_s_id', m, 1);
						reset = 0;
					}
					if (reset) delete m[i];
				}
				if (rid<0 && (''+i).substring((''+i).lastIndexOf(prefix_neg)+prefix_neg.length)==html_id)
				{	// if personal report is to be sent, so no need to send also shared report
					m[i] = (','+m[i]+',').replace(','+value+',', ',').substring(1).replace(/,$/, '');
					if (!m[i]) delete m[i];
					_S_T.cookie_obj('_stat_track_s_id', m, 1);
				}
			}
		}
		if (reset) {
			m[(this.secs() - m.sid + (replace_add?0:1))+'_'+container_mask+'_'+rid+'_'+html_id] = value; // make "replace events" be earlier
			_S_T.cookie_obj('_stat_track_s_id', m, 1);
		}
		// mode == 0: no send, only save to cookie
		if (mode == 1)
		{	_S_T.iframe_delayed(); // send with delay
		}
		if (mode == 2)
		{	_S_T.iframe(); // send immediately
		}
		else if (mode == 3)
		{	_S_T.iframe(0, 1); // send immediately + use javascript instead of iframe
		}
	},
	events_to_str: function(obj) {
		var n_html_ids = [];
		for (var n_html_id in obj) n_html_ids[n_html_ids.length] = n_html_id;
		try {n_html_ids.sort()} catch (e) {}
		var str='', delim='';
		// event format: "{$session_time}_{$record_id}_{$container_id}_{$container_mask}_{$value}"
		var c = this.containers;
		for (var i=0; i<n_html_ids.length; i++) {
			// m[1]: time offset since session start; m[2]: container_mask; m[3]: rid (record id); m[4]: html_id
			var m = n_html_ids[i].match(/^(\d+)_(\d+)_(e?-?\d*)_(.*)/);
			if
			(	m && (c[m[4]] || m[4]==-1 || m[4]==-2 ||
				m[4]==-4 || m[4]==-5 || m[4]==-6)
				// filter empty "text input", "text input search", "grab static html", "grab html", "grab volatile html"
				&& !(c[m[4]] && ((c[m[4]].tp) & 454) && obj[n_html_ids[i]]=='')
			)
			{	/* {$session_time}_{$record_id}_{$container_id}_{$container_mask}_{$value} */
				var _cid = c[m[4]] && c[m[4]].id || m[4];
				str += delim+m[1]+'_'+m[3]+'_'+_cid+'_'+m[2]+'_'+encodeURIComponent(obj[n_html_ids[i]]);
				delim = '&';
			}
		}
		return str;
	},
	iframe_delayed: function()
	{	// delay to give to events chance to accumulate, so we do less queries to the remote server
		if (this.busy == 1) clearTimeout(this.timer);
		if (this.busy <= 1)
		{	this.busy = 1;
			this.timer = setTimeout('_S_T.iframe()', 6000);
		}
	},
	iframe: function(write, as_script) {
		var props = this.get_props(0, write);
		if (!props || !write && !props.ev) return;
		var params='', delim='?';
		for (var i in props)
		{	params += delim+i+'='+encodeURIComponent(props[i]);
			delim = '&';
		}
		if (!write && as_script)
		{	_S_T.reg_onready
			(	function()
				{	var script = document.createElement('script');
					script.type = "text/javascript";
					script.src = "\/\/websolize.com\/stat-track-log-visit.js.php"+params;
					document.documentElement.appendChild(script); // document.body is undefined sometimes
				}
			);
		}
		else
		{	var src = as_script ? 'about:blank' : "javascript:'<body onload=&quot;setTimeout(function() {parent._S_T.loaded()}, 1)&quot;><script src=&quot;"+encodeURIComponent("\/\/websolize.com\/stat-track-log-visit.js.php"+params)+"&quot;></script></body>'";
			var html = '<div style="display:none; position:absolute"><iframe width="0" height="0" frameborder="0" id="-ST-IF" src="'+src+'"></iframe></div>';
			if (as_script) html += '<script src="'+"\/\/websolize.com\/stat-track-log-visit.js.php"+params+'"></script>';
			this.busy = 2;
			if (write) return document.write(html);
			this.iframe_html(html);
		}
	},
	iframe_html: function(html)
	{	_S_T.reg_onready
		(	function()
			{	var elem = _S_T.id('-ST-IF');
				if (elem)
				{	var new_elem = document.createElement('div');
					new_elem.innerHTML = html;
					elem.parentNode.replaceChild(new_elem.firstChild, elem);
				}
			}
		);
	},
	loaded: function()
	{	//this.id('-ST-IF').src = 'about:blank';
		this.iframe_html('<div id="-ST-IF" style="display:none; position:absolute"></div>');
		this.busy = 0;
		this.iframe_delayed(); // if there are events pending, so call them; otherwise just do nothing
	},
	secs: function() // client's local time offset
	{	return Math.floor((new Date().getTime() - new Date(1970, 0, 1).getTime()) / 1000);
	},
	hash: function(str)
	{	var h = new BitField(32);
		for (var i=0; i<str.length; i++)
		{	var x = new BitField(32, str.charCodeAt(i));
			x = h.clone().o_shr(7).o_xor(x).o_and(0xFF);
			x.o_xor(x.clone().o_shr(4));
			h.o_shl(8).o_xor(x.clone().o_shl(12)).o_xor(x.clone().o_shl(5)).o_xor(x);
		}
		return h.get_value();
	},
	get_props: function(is_short, is_load)
	{	var d=document, s=screen, n=navigator;
		var make_id = function(is_load)
		{	var uid=_S_T.cookie_obj('stat_track_u_id'), sid=_S_T.cookie_obj('_stat_track_s_id'), f=uid.f, st=uid.st||0, sy=uid.sy, uls=uid.ls||_S_T.secs(), ls=sid.ls;
			sid = uid.uid && parseInt(sid.la)+1800>_S_T.secs() && parseInt(sid.sid)+18000>_S_T.secs() ? [sid.sid, sid.inew*2] : [_S_T.secs(), 1];
			uid = uid.uid ? [uid.uid, 0] : [(Math.random()+'').substring(2) & 0xFFFFFFFF, 1];
			if (sid[1] == 1)
			{	if (!is_load) return null; // request that came before page load (maybe false request that is noticed in FF) or that came after user erased his cookies but before he refreshed the page
				_S_T.cookie_obj('_stat_track_s_id', {sid: sid[0], inew: uid[1], ls:uls, lurl:''}, 1);
				st++; // session counter (how many times i have been started a new session)
				ls = uls; // last session time (when i had been ended a session last time)
			}
			_S_T.cookie_obj('stat_track_u_id', {uid:uid[0], f:f, st:st, sy:sy, ls:ls}, 1);
			var ev=_S_T.cookie_obj('_stat_track_s_id'), ev2={sid:ev.sid, inew:ev.inew, ls:ev.ls, lurl:ev.lurl, la:_S_T.secs()}, is_refresh=0;
			delete ev.sid;
			delete ev.inew;
			delete ev.ls;
			delete ev.lurl;
			delete ev.la; // last activity
			if (is_load)
			{	var h = _S_T.hash(location.href);
				if (ev2.lurl == h) is_refresh = 1;
				ev2.lurl = h;
			}
			_S_T.cookie_obj('_stat_track_s_id', ev2, 1);
			var sy = '';
			if (sid[1] == 1)
			{	sy = _S_T.set_sticky_conds(0, 1).replace(/(\d+):\d+/g, '$1');
			}
			return {
				id: uid[0], // user_id
				ss: sid[0], // session_id
				nw: (sid[1] + uid[1]*2) & 3, // is_new: is_new&1 means new session, is_new&2 means new user
				st: st, // session_counter
				ls: ls, // last_session_time
				rs: is_refresh, // is_refresh
				sy: sy, // sticky conditions
				events: ev // events
			};
		};
		var has_activex = function(name)
		{	if (window.ActiveXObject)
			{	try
				{	var a = new ActiveXObject(name);
					delete a;
					return 1;
				}
				catch (e)
				{
				}
			}
			return 0;
		};
		var plugin = function(n, name)
		{	if (n.plugins)
			{	var r = new RegExp(name+'\\s*(?:Plug-In|)\\s*([\\d\\.]*)', 'i');
				for (var i=0; n.plugins[i]; i++)
				{	var m = n.plugins[i].description.match(r) || n.plugins[i].name.match(r);
					if (m) return m[1] ? m[1] : 0;
				}
				if (n.plugins[name]) return 0;
			}
			return -1;
		};

		var ajax_enabled = function()
		{	if (window.XMLHttpRequest) return 'y';
			var name = ['MSXML3.XMLHTTP', 'MSXML2.XMLHTTP.3.0', 'Msxml2.XMLHTTP', 'Microsoft.XMLHTTP'];
			for (var i=0; i<name.length; i++)
			{	if (has_activex(name[i])) return 'y';
			}
			return 'n';
		}
		var sl_version_f = function(cur, sl)
		{	for (var p=25; sl.isVersionSupported && p>=1; p--)
			{	if (sl.isVersionSupported(p+'.0')) return p;
			}
			return cur;
		};
		var has_canvas = function() {
			return !!document.createElement('canvas').getContext;
		};
		var yn = function(v) {return v===false ? 'n' : v===true ? 'y' : '?'};
		// props
		var id = make_id(is_load);
		if (!id) return null;
		this.uid = id.id;
//if((this.server_id==1 || this.server_id==2) && !window.st_no){window.st_no=1; setTimeout('document.title = "u'+id.id+(id.nw&2 ? 'y' : 'n')+' / s'+id.ss+(id.nw&1 ? 'y' : 'n')+'"', 2000);}
		var props = {
			fr: this.get_f(),
			sr: this.server_id,
			ld: is_load?1:0,
			ur: location.href,
			rf: d.referrer,
			id: id.id,
			ss: id.ss,
			nw: id.nw,
			st: id.st,
			ls: id.ls,
			rs: id.rs,
			sy: id.sy,
			ev: this.events_to_str(id.events),
			tm: this.secs(),
			pl: n.platform + (n.cpuClass && n.platform.indexOf(n.cpuClass)==-1 ? ' '+n.cpuClass : ''), // important to send platform regardless to is_short
			sc: s.width+'x'+s.height+'x'+s.colorDepth,
			th: this.hash(d.title),
			ck: '?',
			aj: '?',
			jv: '?',
			fl: -1,
			sl: -1,
			mp: -1,
			cn: '?',
			vl: -1,
			qt: -1
		};
		var get_versions = function() {
			var a = {
				"QuickTime": {
					progID: ["QuickTime.QuickTime", "QuickTimeCheckObject.QuickTimeCheck.1"],
					classID: "02BF25D5-8C17-4B23-BC80-D3488ABDDC6B",
					getAXVInfo: function(obj) {
						var v = (obj && obj.QuickTimeVersion) ? obj.QuickTimeVersion.toString(16) : -1;
						return v == -1 ? -1 : v.substring(0,1);
					}
				},
				"VLC": {
					progID: [],//["VideoLAN.VLCPlugin"], popup alert in IE>=7 - do not use!
					classID: ""
				},
				"Windows Media": {
					progID: ["WMPlayer.OCX", "MediaPlayer.MediaPlayer.1"],
					classID: "22D6f312-B0F6-11D0-94AB-0080C74C7E95", // WMP6 -> semms to work a lot better, don't know why
					getAXVInfo: function(obj) {
						var v = (obj && obj.versionInfo) ? obj.versionInfo : "";
						v = parseInt(v);
						return isNaN(v) ? -1 : v;
					}
				},
				"Silverlight": {
					progID: ["AgControl.AgControl"],
					classID: ""
				},
				"Flash": {
					progID: ["ShockwaveFlash.ShockwaveFlash"],
					classID: "D27CDB6E-AE6D-11CF-96B8-444553540000"
				}
			};
			var f=a["Flash"].progID;
			var f0=f[0];
			for(var i=15;i>2;--i) {
				f[15-i]=f0+'.'+i;
			}

			var getInfo = function(name) {
				var version = -1;
				var getVersionFromPlugin = function(plugin) {
					if (!plugin.name) plugin = { name: plugin, description: name };
					var matches = /[\d][\d\.]*/.exec(plugin.name);
					if (matches && plugin.name.indexOf("Java") == -1) return matches[0];
					matches = /[\d\.]+/.exec(plugin.description);
					return matches ? matches[0] : "";
				};
				if (navigator.plugins && navigator.plugins.length) {
					for(var i=0;i<navigator.plugins.length;++i) {
						try
						{	var plugin = navigator.plugins[i];
							if (plugin.name.indexOf(name) != -1) {
								version = parseInt(getVersionFromPlugin(plugin));
								if (isNaN(version)) version = -1;
								break;
							}
						}
						catch (e)
						{
						}
					}
				} else {
					var getProgIdForAX = function(progID) {
						if (!progID) return null;
						for (var i=0; i<progID.length; i++) {
							try {
								var obj = new ActiveXObject(progID[i]);
								return [progID[i], obj];
							}
							catch(e) {}
						}
						return null;
					};
					var progID_obj = getProgIdForAX(a[name] && a[name].progID);
					if (progID_obj) {
						if (a[name].getAXVInfo) {
							version = a[name].getAXVInfo(progID_obj[1]);
						} else {
							version = getVersionFromPlugin(progID_obj[0]);
						}
					} else {
						version = -1;
					}
				}
				return version;
			};
			var names = ['QuickTime', 'VLC', 'Windows Media', 'Silverlight', 'Flash'];
			var res = [];
			for(var i=0; i<names.length; ++i) {
				res[i] = getInfo(names[i]);
			}
			return res;
		};
		if (!is_short) {
			var vv = get_versions();
			var props_ex = {
				ck: yn(n.cookieEnabled),
				aj: ajax_enabled(),
				jv: typeof(n.javaEnabled)!='function' ? '?' : yn(n.javaEnabled()),
				fl: vv[4],
				sl: vv[3],
				mp: vv[2],
				cn: yn(has_canvas()),
				vl: vv[1],
				qt: vv[0]
			};
			for (var i in props_ex) props[i] = props_ex[i];
		}
		return props;
	},
	get_prop: function(prop)
	{	if (prop == 'rd') return this.get_record_id();
		var p = this.get_props(1)[prop];
		if (p == null) p = this.get_props()[prop];
		return p;
	},
	is_url_in: function(u) {
		if (u.charAt(0) == '#') return true;
		u = u.toLowerCase();
		var mailto = 'mailto:';
		var javascript = 'javascript:';
		if (u.substr(0, javascript.length) == javascript) return true;
		if (u.substr(0, mailto.length) == mailto) return true;
		var m = u.match(/^(?:(?:(?:http|ftp)s?\:)?\/\/)?(?:www.)?([^/]+)/);
		if (m) {
			var h = m[1];
			var a = h.split(/\:/);
			if (a.length>1 && a[1] == '80') h = a[0];
			if (!(h in _S_T.domains)) return false;
		}
		return true;
	},
	install_a: function() {
		var set_flag=function() {
			if (_S_T._a_click_in || _S_T._a_click_out) {
				var is_in = _S_T.is_url_in(this.href);
				if (is_in && _S_T._a_click_in || !is_in && _S_T._a_click_out) {
					var s = _S_T.inner_text(this).substr(0, 50);
					if (s == '') s = this.href.substr(0, 50);
					_S_T.occured(is_in ? '-5' : '-6', s, 0, 0, '', (is_in ? 1 : 3));
				}
			}
			clearTimeout(_S_T._a_flag_timeout);
			_S_T._a_flag = 1;
			_S_T._a_flag_timeout=setTimeout('_S_T._a_flag=0', 1000);
			return true;
		};
		this.reg_onready(function() {
			setTimeout(function() {
				var hls = document.getElementsByTagName('A');
				for (var i=0, len=hls.length; i<len; ++i) {
					_S_T.add_event(hls[i], 'click', set_flag);
				}
			}, 10);
		});
		var unload = function() {
			if (_S_T.cookie_obj('stat_track_u_id').uid && !_S_T._a_flag) _S_T.raise_event_focus(1);
		}
		this.add_event(window, 'unload', unload);
	},
	raise_event_focus: function(immed)
	{	var rid = _S_T.get_record_id();
		if (rid) _S_T.occured(-2, Math.floor(_S_T.t_on_p_focused/1000)+'/'+Math.floor(_S_T.t_on_p_total/1000), 1, 0, rid, immed ? 3 : 0);
	},
	install_focus: function() {
		this.start_time = new Date().getTime(); // presicion of 1 sec is not enough; 1.9+1.9+1.9 sec != 3 sec
		this.curr = new Date().getTime();
		_S_T.add_event(window, 'focus', function() {
			if (!_S_T.focused) {
				_S_T.focused = 1;
				_S_T.curr = new Date().getTime();
			}
		});
		var blurf = function() {
			if (_S_T.focused) {
				_S_T.focused = 0;
				_S_T.t_on_p_focused += new Date().getTime() - _S_T.curr;
				_S_T.t_on_p_total = new Date().getTime() - _S_T.start_time;
				_S_T.raise_event_focus();
			}
		};
		_S_T.add_event(window, 'blur', blurf);
		_S_T.add_event(window, 'unload', blurf);
	},
	set_conts: function(containers, domains) {
		_S_T._containers_initialized=0;
		_S_T._html_changed_in={};
		_S_T.containers = containers;
		if (domains == '') {
			domains = location.host.toLowerCase();
			if (domains.substr(0,4) == 'www.') domains = domains.substr(4);
		}
		domains = domains.split(/\s+/);
		var ds = {};
		for (var i=domains.length-1; i>=0; --i) {
			ds[domains[i]] = 1;
		}
		_S_T.domains = ds;
		_S_T._a_click_in = false;
		_S_T._a_click_out = false;
		if ('-5' in _S_T.containers) {
			delete _S_T.containers['-5'];
			_S_T._a_click_in = true;
		}
		if ('-6' in _S_T.containers) {
			delete _S_T.containers['-6'];
			_S_T._a_click_out = true;
		}
		if (_S_T.get_record_id()) _S_T.reg_onready(function(){_S_T.init_containers()});
	},
	set_updated: function() {
		_S_T.filter_a={};
		_S_T.clean_up_containers();
	},
	pre_init_containers: function()
	{	/* hide initial content of containers and try to set style before containers become visible on page */
		var stylesheet='', stylesheet_hide='';
		for (var html_id in _S_T.containers)
		{	var c = _S_T.containers[html_id];
			if (((c.tp) & 1))
			{	var style = c.a==null ? c.em : c.oc;
				for (var s in style)
				{	if (typeof(style[s]) != 'function')
					{	stylesheet += '#'+html_id+' {'+s+':'+style[s]+' !important}\n';
					}
				}
				stylesheet_hide += '#'+html_id+' {display:none !important}\n';
			}
		}
		document.write('<style>'+stylesheet+'</style><style title="-S-T-H">'+stylesheet_hide+'</style>');
		_S_T.reg_onready
		(	function()
			{	for (var i=0; i<document.styleSheets.length; i++)
				{	if (document.styleSheets[i].title == '-S-T-H')
					{	document.styleSheets[i].disabled = true;
					}
				}
			}
		);
	},
	install: function(new_f, server_id, containers, domains, chains, fire_action, close_action, blocking) {
		var post_set_factor = _S_T.cookie_obj('stat_track_u_id').f;
		if (post_set_factor && new_f!=post_set_factor)
		{	blocking = 1;
		}
		this.set_f(new_f);
		this.install_focus();
		this.set_conts(containers, domains);
		this.set_chains(chains);
		this.fire_action = fire_action;
		this.close_action = close_action;
		this.server_id = server_id;
		this.iframe(1, blocking);
		this.install_a();
		if (blocking)
		{	document.write('<script>_S_T.pre_init_containers()</script>'); // iframe() emitted "<script>...fire_actions()...</script>". When that script will be executed by browser, containers will get .a property set. After that i want to execute pre_init_containers()
		}
	},
	get_f: function() {
		return _S_T.cookie_obj('stat_track_u_id').f || 0;
	},
	set_f: function(f) {
		_S_T.cookie_obj('stat_track_u_id', {f:f});
	},
	set_rid: function(rid) {
		_S_T._rid = rid;
		_S_T.reg_onready(function(){_S_T.init_containers()});
		for (var i=0; i<_S_T.occured_queue.length; i++)
		{	var q = _S_T.occured_queue[i];
			_S_T.occured.apply(_S_T, q);
		}
		_S_T.occured_queue = null;
	},
	get_record_id: function() {
		return _S_T._rid || 0;
	},
	set_page_groups: function(gs)
	{	_S_T.page_groups = gs;
	},
	page_in_group: function(g)
	{	for (var i=0; i<_S_T.page_groups.length; i++) if (_S_T.page_groups[i] == g) return true;
		return false;
	},
	get_sticky_conds: function(conds)
	{	var sy = _S_T.cookie_obj('stat_track_u_id').sy || '';
		var obj = {};
		sy.replace(/(\d+):(\d+)/g, function($0, $1, $2) {obj['c'+$1] = $2});
		return obj;
	},
	set_sticky_conds: function(obj, dec) // dec - decrement all counters (practical when starting a new session)
	{	if (!obj) obj = this.get_sticky_conds();
		var sy = '';
		for (var i in obj)
		{	if (dec && obj[i]!=0 && !--obj[i]) continue; // nonzero counter reached zero
			if (!/^c\d+$/.test(i)) sy += i.substring(1)+':'+obj[i]+',';
		}
		sy = sy.replace(/,$/, '');
		_S_T.cookie_obj('stat_track_u_id', {sy:sy});
		return sy;
	},
	set_meaningful_conds: function(conds)
	{	this.conds = conds;
		// add sticky conditions
		var obj = this.get_sticky_conds();
		for (var i in conds)
		{	if (conds[i] && !(i in obj) || conds[i][1])
			{	obj[i] = conds[i][0];
			}
		}
		this.set_sticky_conds(obj);
	},
	get_conditions: function() // function that other scripts on page can call; returns occured condition IDs - not all, but only that for which there is a container that depends on them, or a page refresh interval, or for which send_to_client is set to true
	{	var conds = [];
		for (var i in this.conds)
		{	conds.push(parseInt(i.substring(1)));
		}
		return conds;
	},
	set_period: function(p) {
		clearInterval(_S_T._period_timer);
		_S_T._period = p * 1000;
		if (p > 0) _S_T._period_timer = setInterval(function() {_S_T.occured('-4', '', 0, 0, '', 2);}, _S_T._period);
	},
	set_atimes: function(atimes) {
		_S_T._atimes = atimes;
	},
	get_atime: function(a) {
		var _at = this._atimes;
		if (_at) {
			for (var i=_at.length-1; i>=0; --i) {
				if (_at[i][0] == a) return _at[i][1];
			}
		}
		return 0;
	},
	set_chains: function(chains) {
		if (_S_T._chains) {//cleanup
			var _ch = _S_T._chains;
			for (var i=0, len=_ch.length; i<len; ++i) {
				var ch=_ch[i];
				clearTimeout(ch.timer);
				var j = ch.i-1;
				if (j<0 && !ch.start) j = ch.chain.length-1;
				_S_T.stop_in_chain.call(_S_T,ch,j);
			}
		}
		_S_T._chains = chains;
	},
	get_chains: function(a) {
		var _ch = _S_T._chains;
		if (_ch) {
			var arr = [];
			for (var i=0, len=_ch.length; i<len; ++i) {
				if (_ch[i].a == a) arr.push(_ch[i]);
			}
			return arr.length ? arr : null;
		}
		return null;
	},
	a_closed: function(a, a_type) {
		if (a_type=='image' || a_type=='html') {
			setTimeout(function() {_S_T.retry_html_from_queue.call(_S_T)}, 10);
		}
	},
	retry_html_from_queue: function() {
		var _a = [];
		for (var i=0,len=_S_T._queue.length;i<len;++i) {
			_a[i] = [_S_T._queue[i][0],_S_T._queue[i][1]];
		}
		_S_T.fire_actions.call(_S_T, _a, 1);
	},
	add_script: function(scr, srv, tps) {
		_S_T.__scr = scr;
		_S_T.__srv = srv;
		_S_T.__tps = tps;
		var s = document.createElement('script');
		s.src = scr + '?' + Math.random();
		var head = document.getElementsByTagName('head')[0];
		head.appendChild(s);
	},
	setup: function(server_id)
	{	var factor = this.get_f();
		document.write('<script type="text/javascript" src="//websolize.com/stat-track.js.php?sr=', server_id, '&fr=', factor, '"><\/script>');
	}
}
