var tns = document.getElementsByTagName('script');
window['tnHost' + teasernet_blockid] = tns[tns.length - 1].src.replace(/^\s*http\:\/\/([^\/]+)\/block\d?\.js\s*$/i, '$1');
window['teasernet_time_start' + teasernet_blockid] = new Date().getTime();
window['tnSHost' + teasernet_blockid] = '';
(function() {
	if (typeof window.teasernet_blockid == 'undefined'
			|| typeof window.teasernet_padid == 'undefined'
			|| !window.teasernet_blockid || !window.teasernet_padid)
		return;
	if (typeof window.tnBlInit != 'function')
		window.tnBlInit = function(p, b) {
			if (!tnTeasernet[p])
				tnTeasernet[p] = {};
				tnParams[p] = {};
			if (!tnOrder[p])
				tnOrder[p] = [];
			tnTeasernet[p][b] = {};
			if (!document.getElementById('teasernet_' + b))
				document.write('<div id="teasernet_' + b + '"></div>');
			if (!tnForStatic)
				tnForStatic = document.getElementById('teasernet_' + b);
			var js0 = document.createElement('script');
			window['next' + b] = function next(domain,b) {
				window['tnSHost' + b] = domain;
				var js = document.createElement('script');
				js.src = 'http://' + domain + '/static/' + Math.floor(b / 500) + '/' + b + '.js';
				tnForStatic.appendChild(js);
				document.getElementById('teasernet_' + b).innerHTML = '<center>...</center>';
			};
			window['get_show' + b] = function(i) {
				if (i > 20)
				{
					var tmp_dig = Math.floor(6 * Math.random()) + 1;
					var tmp_dom = '';
					tmp_dom = 'im' + tmp_dig + '-tub.com';
					window['next' + b](tmp_dom,b);
				}
				if (typeof window.get_domain != 'undefined') {
					window['next' + b](get_domain(window['tnHost' + b]),b);
				} else 
					setTimeout("get_show" + b + "(" + (i + 1) + ")", 100);
			};
			tmp = tnGCookie('pic_' + window['tnHost' + b]);
			if (tmp && tmp.length > 5)
				window['next' + b](tmp,b);
			else {
				js0.src = 'http://' + window['tnHost' + b] + '/news.js?'+ window['tnHost' + b];
				tnForStatic.appendChild(js0);
				window['get_show' + b](0);
			}
		};
		
	window['tnLoadBlocks_' + teasernet_blockid] = function(b) {
		var i=0;
		if(typeof window['bParams'+b+'block_alt'] != 'undefined' && typeof window['bParams'+b+'block_link'] != 'undefined')	
			tnLoadBlocks(b);
		else 
		{
			if(i<30)
			{
				i++;
				setTimeout("window['tnLoadBlocks_" + b+"'](" + b+")", 100);
			}
			else 
				tnLoadBlocks(b);
		}
			
	};	
		
	window['tnSetSHost_new' + teasernet_blockid] = function(i) {
		if (window['tnSHost' + i])
			tnSCookie('pic_' + window['tnHost' + i], window['tnSHost' + i], 10);
		else 
			setTimeout("tnSetSHost_new" + i + "(" + i + ")", 100);
	};
	if(typeof window.tnParams == 'undefined')
		window.tnParams = {};
	if (typeof window.tnTeasernet != 'undefined') {
		var k = typeof tnTeasernet[teasernet_padid] == 'undefined';
		tnBlInit(teasernet_padid, teasernet_blockid);
		window.setTimeout('window.tnGetIds(' + teasernet_padid + ','
					+ teasernet_blockid + ')', 0);
		return;
	}
	window.tnTeasernet = {};
	window.tnOrder = [];
	window.tnForStatic = document.getElementsByTagName('head') ? document
			.getElementsByTagName('head')[0] : document.body;
	window.tnGCookie = function(a) {
		var cs = document.cookie ? document.cookie.split(';') : [];
		if (cs.length) {
			for ( var k = 0; k < cs.length; k++) {
				var c = cs[k].split('=');
				if (c.length < 2)
					break;
				if (c[0].replace(/(^\s+)|(\s+$)/g, '') == a)
					return (c[1]);
			}
		}
		return false;
	};
	window.tnSCookie = function(a, s, t) {
		var d = new Date();
		d.setTime(d.getTime() + (t ? t * 60000 : 600000));
		document.cookie = a + '=' + s + '; path=/; expires=' + d.toUTCString();
	};
	tnBlInit(teasernet_padid, teasernet_blockid);
	window.tnSetSHost = function(i) {
		;
	};
	window.tnGetIds = function(p, b) {
		var js = document.createElement('script');
		js.src = 'http://' + window['tnHost' + b] + '/modules/?p=' + p+ '&h=' + window['tnHost' + b] + '&b=' + b + '&np=1'+ (tnGCookie('pic_' + window['tnHost' + b]) ? '' : '&ph=1')+ '&' + Math.round(Math.random() * 100000);
		tnForStatic.appendChild(js);
	};
	window.tnSetStyle = function(style) {
		var css = document.createElement('style');
		css.setAttribute('type', 'text/css');
		if (css.styleSheet)
			css.styleSheet.cssText = style;
		else 
			css.appendChild(document.createTextNode(style));
		tnForStatic.appendChild(css);
	};
	window.tnSetParams = function(b, a) {
		for ( var i in tnTeasernet) {
			if (!tnTeasernet[i][b])
				continue;
			for ( var k in a)
				tnTeasernet[i][b][k] = a[k];
		}
	};
	window.tnGetStart = function(p) {
		if (tnParams[p]['f'])
			return tnParams[p]['f'];
		var c = tnGCookie('teasernet_p' + p);
		tnParams[p]['f'] = c !== false ? c : 1;
		return tnParams[p]['f'];
	};
	window.tnLoadBlocks = function() {
		for ( var p in tnParams) {
			if (typeof tnParams[p]['t'] == 'undefined' || !tnTeasernet[p])
				return;
			var s = tnGetStart(p);
			var bl = tnOrder[p];
			for ( var i in tnTeasernet[p])
				bl[bl.length] = i;
			var us = {};
			for ( var i = 0; i < bl.length; i++) {
				var b = bl[i];
				if( typeof window['bParams'+b+'block_alt'] == 'undefined' || typeof window['bParams'+b+'block_link'] == 'undefined')
				{
					window['tnLoadBlocks_' + b](b);
					return;
				}
				if (us[b])
					continue;
				us[b] = 1;
				var a = tnTeasernet[p][b];
				if (!a['h'])
					continue;
				if (!a['s']) {
					tnTeasernet[p][b]['s'] = s;
					tnOrder[p][tnOrder[p].length] = b;
					tnShowBlock(p, b);
				}
				s += a['h'] * a['v'];
				while (tnParams[p]['t'] > 0 && s > tnParams[p]['t'])
					s = s - tnParams[p]['t'];
			}
			tnSCookie('teasernet_p' + p, s);
		}
	};
	window.tnShowBlock = function(p, b) {
		if (!p || !b || !document.getElementById('teasernet_' + b))
			return;
		var a = tnTeasernet[p][b];
		var add_class = '';
		if( typeof window['bParams'+b+'block_alt'] != 'undefined' && typeof window['bParams'+b+'block_link'] != 'undefined')
			add_class = 'tblock_'+ b + '__'+window['bParams'+b+'block_alt']+window['bParams'+b+'block_link'];
		document.getElementById('teasernet_' + b).innerHTML = '<if'+ 'rame class="tblock_'+ b+ ' ' + add_class + '" scrolling="no" frameborder="0" marginheight="0" marginwidth="0" style="padding:0;margin:0;border:0px;" src="about:blank" allowtransparency="true" vspace="0" hspace="0"></ifr'+ 'ame>';
		document.getElementById('teasernet_' + b).childNodes[0].src = 'http://'+ window['tnSHost' + b]+ 'static/'+ Math.floor(b / 500)+ './'+ b+ '.html@b='+ b+ '&x='+ a['h']+ '&y='+ a['v']+ '&s='+ a['s']+ '&c='+ encodeURIComponent(tnParams[p]['c'])+ '&ref='+ escape(document.referrer)+ (window['tnHost' + b] != 'internet-yadro.com' ? '&h=' + escape(window['tnHost' + b]): '') + '&' + Math.round(Math.random() * 100000);
//		if (typeof window['teasernet_time_start' + b] != 'undefined')
//		{
//			var teasernet_time_step1 = new Date().getTime()-window['teasernet_time_start' + b];
//			var img =document.createElement("IMG");
//			img.setAttribute("src","triger.jpg@s=1&t=.gif"+teasernet_time_step1 + "&p=" + p);
//		};
	};
	window.setTimeout('window.tnGetIds(' + teasernet_padid + ','+ teasernet_blockid + ')', 0);
})();
//newItem = document.createElement('div');
//newItem.setAttribute('style', 'display: none;');
//newItem.innerHTML='<if'+'rame  scrolling="no" frameborder="0" marginheight="0" marginwidth="0" style="padding:0;margin:0;border:0px;display: none;" allowtransparency="true" vspace="0" hspace="0" src="stats.html@bid=.htm'+teasernet_blockid+'"></ifr'+'ame>';
//olditem = document.getElementById("teasernet_"+teasernet_blockid);
//olditem.parentNode.insertBefore(newItem, olditem);
teasernet_blockid = teasernet_padid = 0;
