javascript:(function(){

function kolyaj_getRefBlock() {
	var allblocks = document.getElementsByTagName('div');
	var ev;
	var refblock = document.createElement('div');
	for (var i = 0; i< allblocks.length; i++) {
		var cblock = allblocks[i];
		if (cblock.className == 'ev') {
			document.body.insertBefore(refblock,cblock);
			break;
		}
		else if (cblock.className == 'refblock') {
			refblock = cblock;
			refblock.style.marginLeft = '-41px';
			break;
		}
	}
	return refblock;
}

function getCookie(c_name)	{
			if (document.cookie.length>0)
			{
				var c_start=document.cookie.indexOf(c_name + '=');
				if (c_start!=-1)
				{
					c_start=c_start + c_name.length+1;
					var c_end=document.cookie.indexOf(';',c_start);
					if (c_end==-1) c_end=document.cookie.length;
					return unescape(document.cookie.substring(c_start,c_end));
				}
			}
			return '';
		}

function showHost(){

var refblock = kolyaj_getRefBlock();
if (refblock) refblock = refblock.appendChild(document.createElement('div'));

refblock.style.marginTop='1em';

var tld = 'ru';
if (document.location.hostname.match(/yandex\.ua$/)) tld = 'ua';

var sfrontbar = Array();

sfrontbar[1] = '<td nowrap="1" style="font-size: 11px;  padding-right:.5em; height:1em;" colspan="2">&#1079;&#1077;&#1088;&#1082;&#1072;&#1083;&#1086;&nbsp;';

//sfrontbar[1]+=tld;

sfrontbar[2] = '<td nowrap="1" style="font-size: 11px;  padding-right:.5em;" colspan="2">&#1089;&#1077;&#1088;&#1074;&#1077;&#1088;&nbsp;';

var hostname = document.documentElement.innerHTML.match(/<!--\s*(sfront[\S]+)/);
if (hostname) hostname = hostname[1];

var gz;
if (gz = document.documentElement.innerHTML.match(/<a[^>]*href="[^"]*&amp;lr=0[^"]*"[^>]*class="gt"/i)) gz = true;

var hrefs = Array();
var current_href=document.location.href;
current_href = current_href.replace(/\&[nr][cd]rnd=[0-9]*/ig,'').replace(/\?[nr][cd]rnd=[0-9]*\&/ig,'?');//+'&ncrnd='+Math.round(Math.random()*10000);

sfrontbar[3] = '';

hrefs[0]=current_href.replace(/http\:\/\/[a-z0-9\.]+andex\.[rua]{2}/,'http://yandex.ru');
hrefs[0]==current_href ? sfrontbar[3]+='<span style="color:#006600"><b>(&ndash;)</b></span> ' : sfrontbar[3]+='<a href="'+ hrefs[0] +'">(&ndash;)</a> ';
hrefs[1]=current_href.replace(/http\:\/\/[a-z0-9\.]+andex/,'http://buki.yandex');
hrefs[1]==current_href ? sfrontbar[3]+='<span style="color:#006600"><b>(&#1073;)</b></span> ' : sfrontbar[3]+='<a href="'+ hrefs[1] +'">(&#1073;)</a> ';
var i;
for (i=2; i<6; i++) {
	hrefs[i]=current_href.replace(/http\:\/\/[a-z0-9\.]+andex/,'http://www'+i+'.yandex');
	hrefs[i]==current_href ? sfrontbar[3]+='<span style="color:#006600"><b>('+i+')</b></span> ' : sfrontbar[3]+='<a href="'+ hrefs[i] +'">('+i+')</a> ';
}
sfrontbar[3]+= '</td>';

//alert(sfrontbar[3]);

sfrontbar[4] = '<span style="color:#006600;">' + hostname +'.yandex.ru</span></td> ';

sfrontbar[5] = '<td nowrap="1" style="font-size: 11px;  padding-right:.5em; text-align:right"';

//sfrontbar[5]+='>';


if (gz) sfrontbar[5]+=' name="&#1043;&#1077;&#1086;&#1079;&#1072;&#1074;&#1080;&#1089;&#1080;&#1084;&#1099;&#1081; &#1079;&#1072;&#1087;&#1088;&#1086;&#1089;"><b style="background-color: #cc0000; color: white; font-size: 9px; ">&nbsp;G&nbsp;</b>&nbsp;';
else sfrontbar[5]+=' name="&#1053;&#1077; &#1075;&#1077;&#1086;&#1079;&#1072;&#1074;&#1080;&#1089;&#1080;&#1084;&#1099;&#1081; &#1079;&#1072;&#1087;&#1088;&#1086;&#1089; (?)"><b style="background-color: #cccccc; color: white; font-size: 9px; ">&nbsp;G&nbsp;</b>&nbsp;';


sfrontbar[5]+='&#1088;&#1077;&#1075;&#1080;&#1086;&#1085;</td> ';


sfrontbar[7] = '<td style="font-size: 11px;  padding-right:.5em;" rowspan="2" width="100%">';

var current_rid = 0;
if (getCookie('yandex_gid')) current_rid = getCookie('yandex_gid');

var lr = location.search.match(/[\?\&]lr=([0-9]*)/i);
var lr_text='';
var lr_style=' style="color:#CC0000; text-decoration:none;"';
var lr_title='';
var nolrloc = current_href;

if (lr) 
	{
		lr = lr[1];
		current_rid = lr;
		lr_text = '&nbsp;<b><small>LR</small></b>';
		lr_style = ' style="color:#CC0000; text-decoration:none;" ';
		lr_title = ' (&#1091;&#1089;&#1090;&#1072;&#1085;&#1086;&#1074;&#1083;&#1077;&#1085; &#1087;&#1072;&#1088;&#1072;&#1084;&#1077;&#1090;&#1088;&#1086;&#1084; &lr=)';
		nolrloc = nolrloc.replace(/\&lr=[0-9]*/ig,'').replace(/\?lr=[0-9]*\&/ig,'?');
	}
nolrloc = nolrloc.replace(/http:\/\/([^\/]*)yandex\.ua\//,'http://$1yandex.ru/');
nolrloc = nolrloc.replace(/\+/,'%20');

var regions = Array();

var regions_list = getCookie('yandex_gid_list');
regions[0] = true;
regions[213] = true;
regions[2] = true;

if (regions_list)
{
	regions_list = regions_list.split(',');
	for (reg_id in regions_list) regions[regions_list[reg_id]] = true;
}

if (typeof(reglist)=='undefined') // for fucking Google Chrome
{
	reglist = new Array();
	reglist[213] = '&#1084;&#1089;&#1082;';
	reglist[2] = '&#1089;&#1087;&#1073;';
} 

reglist[-1] = '(&#150;)';

var year = (new Date()).getFullYear()+10;
var reg_title;

for (reg_id in regions)
{
	reg_id == 0 ? reg_title = '&#1040;&#1074;&#1090;&#1086;&#1086;&#1087;&#1088;&#1077;&#1076;&#1077;&#1083;&#1077;&#1085;&#1080;&#1077; &#1088;&#1077;&#1075;&#1080;&#1086;&#1085;&#1072;' : reg_title = 'ID &#1088;&#1077;&#1075;&#1080;&#1086;&#1085;&#1072; '+reg_id;
	var reg_year = year;
//	reg_id == 0 ? reg_year = 2001;
	if (reg_id == 0 ) reg_id = -1;
	if (typeof(reglist[reg_id])!='string') {
		reglist[reg_id] = '('+reg_id+')';
		reg_title = '&#1053;&#1077;&#1086;&#1087;&#1086;&#1079;&#1085;&#1072;&#1085;&#1085;&#1099;&#1081; &#1088;&#1077;&#1075;&#1080;&#1086;&#1085; '+reg_id;
		}
	reg_id!=current_rid ? sfrontbar[7]+= '<a href="'+nolrloc+'&lr='+reg_id+'" title="'+reg_title+'" onclick="location=\'http://tune.yandex.ru/region/save2.xml?fretpath=http%3A%2F%2Ftune.yandex.ru%2Fregion%2Ferror.xml&domain=yandex.ru&retpath=' + escape(nolrloc) + '&region_id=' + reg_id + '\'; return false">'+reglist[reg_id] +'</a>&nbsp; ' : sfrontbar[7]+= '<a href="'+nolrloc+'&lr='+reg_id+'" title="'+reg_title+lr_title+'"'+lr_style+' onclick="location=\'http://tune.yandex.ru/region/save2.xml?fretpath=http%3A%2F%2Ftune.yandex.ru%2Fregion%2Ferror.xml&domain=yandex.ru&retpath=' + escape(nolrloc) + '&region_id=' + reg_id + '\'; return false">'+reglist[reg_id] + lr_text+'</a>&nbsp; ';
//	reg_id!=current_rid ? 
//	sfrontbar[7]+= '<a href="'+nolrloc+'&lr='+reg_id+'" title="'+reg_title+'" onclick="document.cookie=\'yandex_gid='+reg_id+'; expires=Sat, 01 Jan '+reg_year+' 00:00:01 GMT; path=/; domain=yandex.'+tld+'\'; location=\''+nolrloc+'\'; return false">'+reglist[reg_id]+'</a>&nbsp; ' : 
//	sfrontbar[7]+= '<a href="'+nolrloc+'&lr='+reg_id+'" title="'+reg_title+lr_title+'"'+lr_style+' onclick="document.cookie=\'yandex_gid='+reg_id+'; expires=Sat, 01 Jan '+reg_year+' 00:00:01 GMT; path=/; domain=yandex.'+tld+'\'; location=\''+nolrloc+'\'; return false">'+reglist[reg_id] + lr_text+'</a>&nbsp; ';
}

sfrontbar[7]+= '<a href="#" onclick="var rid=prompt(\'ID &#1088;&#1077;&#1075;&#1080;&#1086;&#1085;&#1072; \',\''+current_rid+'\'); if (rid) {location=\'http://tune.yandex.ru/region/save2.xml?fretpath=http%3A%2F%2Ftune.yandex.ru%2Fregion%2Ferror.xml&domain=yandex.ru&retpath=' + escape(nolrloc) + '&region_id=\' + rid + \'\';} return false">&#1076;&#1088;&#1091;&#1075;&#1086;&#1081;</a> ';

//sfrontbar[7]+=nolrloc;

if (typeof(regions[current_rid])=='undefined' && current_rid != '') {
	reg_title = 'ID &#1088;&#1077;&#1075;&#1080;&#1086;&#1085;&#1072; '+current_rid;
	if (typeof(reglist[current_rid])!='string') {
		reglist[current_rid] = current_rid;
		reg_title = '&#1053;&#1077;&#1086;&#1087;&#1086;&#1079;&#1085;&#1072;&#1085;&#1085;&#1099;&#1081; &#1088;&#1077;&#1075;&#1080;&#1086;&#1085; '+current_rid;
		}
	sfrontbar[7]+= '<span title="'+reg_title+lr_title+'"'+lr_style+'><nobr>(' + reglist[current_rid] + lr_text + ')</nobrs></span>&nbsp;';
}

sfrontbar[7]+= '</td>';

sfrontbar[6] = '<td nowrap="1" style="font-size: 11px;  padding-right:.5em;" align="center" rowspan="2">';

var editregions = '';
editregions+= 'if (gid_list = prompt(\'&#1057;&#1087;&#1080;&#1089;&#1086;&#1082; ID &#1088;&#1077;&#1075;&#1080;&#1086;&#1085;&#1086;&#1074; (&#1095;&#1077;&#1088;&#1077;&#1079; &#1079;&#1072;&#1087;&#1103;&#1090;&#1091;&#1102;)\',\''+regions_list+'\')) {';
editregions+= 'document.cookie=\'yandex_gid_list=\'+gid_list+\'; expires=Sat, 01 Jan '+year+' 00:00:01 GMT; path=/; domain=yandex.'+tld+'\';';
editregions+= 'location=\''+nolrloc+'\';';
editregions+= '}; return(false);';

var version='1.6';

sfrontbar[6]+= '<small><a href="#" style="text-decoration:none" title="&#1053;&#1072;&#1089;&#1090;&#1088;&#1086;&#1080;&#1090;&#1100; &#1089;&#1087;&#1080;&#1089;&#1086;&#1082; &#1088;&#1077;&#1075;&#1080;&#1086;&#1085;&#1086;&#1074;" onclick="'+editregions+'">(+)</a></small> ';

sfrontbar[6]+= '<small><a href="http://search.yaca.yandex.ru/geo.c2n" style="text-decoration:none" title="&#1054;&#1092;&#1080;&#1094;&#1080;&#1072;&#1083;&#1100;&#1085;&#1099;&#1081; &#1089;&#1087;&#1080;&#1089;&#1086;&#1082; ID &#1088;&#1077;&#1075;&#1080;&#1086;&#1085;&#1086;&#1074;" target="_blank">(:)</a></small> ';

sfrontbar[6]+= '<small><a href="http://ivanov.in/seo/yandex-regions/#o" style="text-decoration:none" title="&#1059;&#1076;&#1086;&#1073;&#1085;&#1099;&#1081; &#1089;&#1087;&#1080;&#1089;&#1086;&#1082; ID &#1086;&#1089;&#1085;&#1086;&#1074;&#1085;&#1099;&#1093; &#1088;&#1077;&#1075;&#1080;&#1086;&#1085;&#1086;&#1074;" target="_blank">(!)</a></small><br/>';
sfrontbar[6]+= '<small><a href="'+nolrloc+'&lr='+current_rid+'" style="text-decoration:none" title="&#1089;&#1089;&#1099;&#1083;&#1082;&#1072; &#1085;&#1072; &#1090;&#1077;&#1082;&#1091;&#1097;&#1091;&#1102; &#1074;&#1099;&#1076;&#1072;&#1095;&#1091; &#1089; &#1087;&#1072;&#1088;&#1072;&#1084;&#1077;&#1090;&#1088;&#1086;&#1084; &lr=">(LR)</a></small> ';

sfrontbar[6]+= '<small><a href="http://ivanov.in/upbar/sfront-help.php?v='+version+'" style="text-decoration:none; background-image: url(http://ivanov.in/upbar/sfront-help.php?type=image&v='+version+')" title="&#1055;&#1086;&#1084;&#1086;&#1097;&#1100;" target="_blank">(?)</a> ';

sfrontbar[6]+= '</small>';
sfrontbar[6]+= '</td>';

sfrontbar[10] = '<td nowrap="1" style="font-size: 11px;  padding-right:.5em;" align="center">';

var yx_searchprefs;
var pref_ukr = false;
var pref_ukr_text, pref_ukr_title;
if (getCookie('YX_SEARCHPREFS')) {
	yx_searchprefs = ','+getCookie('YX_SEARCHPREFS')+',';
	pref_ukr = yx_searchprefs.match(/,lr:1,/i);
	pref_ukr ? pref_ukr_text = '+': pref_ukr_text = '&#150;';
	pref_ukr ? pref_ukr_title = '&#1055;': pref_ukr_title = '&#1053;&#1077; &#1087;';
	pref_ukr_text+= '<small>&#1085;&#1072;&#1076;&#1088;&#1077;&#1075;&#1080;&#1086;&#1085;</small>';
	pref_ukr_title+= '&#1088;&#1077;&#1076;&#1087;&#1086;&#1095;&#1080;&#1090;&#1072;&#1077;&#1084; &#1089;&#1072;&#1081;&#1090;&#1099; &#1080;&#1079; &#171;&#1085;&#1072;&#1076;&#1088;&#1077;&#1075;&#1080;&#1086;&#1085;&#1072;&#187; ';

	yx_searchprefs = yx_searchprefs.replace(/,lr:[^,]*,/i,',').replace(/^,/,'').replace(/,$/,'');

	!pref_ukr ? yx_searchprefs += ',lr:1' : yx_searchprefs += ',lr:0';

var pref_ukr_switch = 'document.cookie=\'YX_SEARCHPREFS='+yx_searchprefs+'; expires=Sat, 01 Jan '+year+' 00:00:01 GMT; path=/; domain=yandex.'+tld+'\'; location=\''+nolrloc+'&ncrnd='+Math.round(Math.random()*10000)+'\'; return false';

	sfrontbar[10]+= '<a href="#" style="text-decoration:none" title="'+pref_ukr_title+'" onclick="'+pref_ukr_switch+'">'+pref_ukr_text+'</a>';

}


sfrontbar[10]+= '</td>';

sfrontbar[9] = '<td nowrap="1" align="center" valign="top" style="padding-right:0em; width:61px;" rowspan="2"><small><a href="http://www.mixmarket.biz/?from=sfront" style="color:#4C2008; display:block; width:49px; overflow:hidden; text-decoration:none; border:1px solid #F7DB00; margin: 2px 5px 0 5px; color:#4C2008!important"  onmouseout="document.getElementById(\'mix_button\').style.marginLeft=\'5px\'" onmouseover="document.getElementById(\'mix_button\').style.marginLeft=\'-50px\';"><span id="mix_button" style="margin: 3px 0 3px 5px; display:block; text-align:right;font-size:13px"><img src="http://mixmarket.biz/images/ump/90.png" width="16" height="16" style="vertical-align:middle;border:none">&nbsp;mix&nbsp;&nbsp;&nbsp;<b>market</b>&nbsp;</span></a></small></td>';

//sfrontbar[9] = '<td nowrap="1" align="center" valign="middle" style="font-size: 11px;  padding-right:0em; width:61px;" rowspan="2"><small><a href="http://www.adlabs.ru/?from=sfront" style="color:#0000cc; text-decoration:none; display:block; border:1px solid #cccccc; margin: 0 5px 0 5px;"  onmouseout="this.style.backgroundColor=\'transparent\'" onmouseover="this.style.backgroundColor=\'#efefef\'"><b style="margin: 5px 0; display:block;">AD<span style="border-right:1px solid red; margin:1px"></span>LABS</b></a></small></td>';

//sfrontbar[9] = '<td nowrap="1" align="center" valign="middle" style="font-size: 11px;  padding-right:0em; width:61px;" rowspan="2">&nbsp;</td>';

sfrontbar[0] = '<table cellpadding="0" cellspacing="1">';
sfrontbar[0]+= '<tr valign="top">'+sfrontbar[9]+sfrontbar[1]+sfrontbar[3]+sfrontbar[5]+sfrontbar[7]+sfrontbar[6]+'</tr>';
sfrontbar[0]+= '<tr valign="top">'             +sfrontbar[2]+sfrontbar[4]+sfrontbar[10]+                          '</tr>';
sfrontbar[0]+= '</table>';

refblock.innerHTML = sfrontbar[0];
}

showHost();
/*
new Image().src = "http://counter.yadro.ru/hit;region-switcher?r"+
escape("http://yandex.ru/fake-ref/")+((typeof(screen)=="undefined")?"":
";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?
screen.colorDepth:screen.pixelDepth))+";u"+escape("http://yandex.ru/fake-url/")+
";"+Math.random();
*/
})()