var NotisCss='#CEDCFA';
var NoticeStyle='margin:0;padding:0;width:130px;background:'+NotisCss+';float:left;text-align:right;color:black;font:normal 12px arial;line-height:20px';
var SiteUrl='www.optomvse.ru';
var SUrlToSite='<span style="'+NoticeStyle+'"><a href="http://'+SiteUrl+'/" style="font:normal 12px arial;line-height:20px;">ÎïòîìÂñ¸.Ðó</a>&nbsp;</span>';
var BankImg='http://'+SiteUrl+'/img/header/';

var Copy='ÎïòîìÂñ¸.Ðó'
function NewButton2() {
this.domain=location.href+'/';
this.domain=this.domain.substr(this.domain.indexOf('://')+3);
this.domain=this.domain.substr(0,this.domain.indexOf('/'));
this.location=false;
this.selection=function() {
	var sel;
	if (window.getSelection) sel=window.getSelection();
	else if (document.selection) sel=document.selection.createRange();
	else sel='';
	if (sel.text) sel=sel.text;
	return encodeURIComponent(sel);
}
this.redirect=function() {
	if (this.location) location.href=this.location;
	this.location=false;
}
this.go=function(i) {
	this.location=this.url(i);
	window.open(this.location,'button2');
	return false;
}
this.url=function(system) {
	var title=encodeURIComponent(document.title);
	var url=encodeURIComponent(location.href);
	switch (system) {
		case 1: return 'http://vkontakte.ru/share.php?url='+url;
		case 2: return 'http://www.facebook.com/sharer.php?u='+url;
		case 3: return 'http://twitter.com/home?status='+title+' '+url;
		case 4: return 'http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st._surl='+url;
		case 5: return 'http://connect.mail.ru/share?share_url='+url;
		case 6: return 'http://www.livejournal.com/update.bml?event='+url+'&subject='+title;
		case 7: return 'http://memori.ru/link/?sm=1&u_data[url]='+url+'&u_data[name]='+title;
		case 8: return 'http://bobrdobr.ru/addext.html?url='+url+'&title='+title;
		case 9: return 'http://www.google.com/bookmarks/mark?op=add&bkmk='+url+'&title='+title;
		case 10: return 'http://zakladki.yandex.ru/userarea/links/addfromfav.asp?bAddLink_x=1&lurl='+url+'&lname='+title;
		case 11: return 'http://www.mister-wong.ru/index.php?action=addurl&bm_url='+url+'&bm_description='+title;
		case 12: return 'http://del.icio.us/post?v=4&noui&jump=close&url='+url+'&title='+title;
	}
}
this.hide=function() {
	if (this.timeout) clearTimeout(this.timeout);
	document.getElementById('button2').style.visibility='hidden';
}
this.show=function(element) {
	if (this.timeout) clearTimeout(this.timeout);
	var left=0,top=0;
	var style=document.getElementById('button2').style;
	while (element) {
		left+=element.offsetLeft;
		top+=element.offsetTop;
		element=element.offsetParent;
	}
	style.left=left+'px';
	style.top=top+'px';
	style.visibility='visible';
}
this.init=function() {
	var titles=new Array(
	'&#1042; &#1050;&#1086;&#1085;&#1090;&#1072;&#1082;&#1090;&#1077;','Facebook','Twitter','&#1054;&#1076;&#1085;&#1086;&#1082;&#1083;&#1072;&#1089;&#1089;&#1085;&#1080;&#1082;&#1080;','&#1052;&#1086;&#1081; &#1052;&#1080;&#1088;','LiveJournal','Memori','&#1041;&#1086;&#1073;&#1088;&#1044;&#1086;&#1073;&#1088;','&#1047;&#1072;&#1082;&#1083;&#1072;&#1076;&#1082;&#1080; Google','&#1071;&#1085;&#1076;&#1077;&#1082;&#1089;.&#1047;&#1072;&#1082;&#1083;&#1072;&#1076;&#1082;&#1080;','Mister Wong','Delicious');
	if (!document.getElementById('button2')) {
		var div=document.createElement('div');
		div.id='button2';
		div.style.position='absolute';
		div.style.visibility='hidden';
		div.style.width='264px';
		div.style.height='150px';
		div.style.backgroundColor='transparent';
		div.style.backgroundImage='url('+BankImg+'backg.png)';
		div.style.border='0';
		div.style.margin='0';
		div.style.padding='0 1px 4px 1px';
		div.style.overflow='hidden';
		div.style.zIndex='1000';
		div.style.font='normal 12px arial';
		div.style.lineHeight='20px';
		div.style.color='#666';
		html='<a href="http://'+SiteUrl+'" onclick="window.open(\'http://'+SiteUrl+'\',\'button2\',\'scrollbars=yes,menubar=no,width=600,height=500,left='+(document.body.clientWidth/2-300)+',top='+(document.body.clientHeight/2-250)+',resizable=yes,toolbar=no,location=no,status=no\');return false;" style="display:block;float:left;width:258px;height:20px;overflow:hidden;margin:1px 0;padding:0;background-color:transparent;font:bold 11px arial;color:#666;text-decoration:none"></a>';
		for (var i=0;i<12;i++) {
			html+='<a href="'+this.url(i+1)+'" style="display:block;float:left;width:108px;height:16px;overflow:hidden;margin:1px 0;padding:0 0 0 24px;background-color:transparent;background:url('+BankImg+'backg.png) no-repeat -266px '+(-i*16)+'px;font:normal 12px arial;color:#666;text-decoration:none;text-align:left" onmouseover="this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'" onclick="return nb.go('+(i+1)+');">'+titles[i]+'</a>';
		}
		html+='<a href="http://'+SiteUrl+'" style="display:block;float:left;width:258px;height:16px;overflow:hidden;margin:1px 0;padding:0;background-color:transparent;font:bold 11px arial;color:#666;text-decoration:none;text-align:right">&copy;&nbsp;'+Copy+'</a>';
		//html+=SUrlToSite
		div.innerHTML=html;
		div.onmouseover=function() {if (nb.timeout) clearTimeout(nb.timeout)}
		div.onmouseout=function() {nb.timeout=setTimeout('nb.hide()',500)};
		document.body.insertBefore(div,document.body.firstChild);
	}
	document.write('<a href="http://'+SiteUrl+'" onclick="window.open(\'http://'+SiteUrl+'\',\'button2\',\'scrollbars=yes,menubar=no,width=600,height=500,left='+(document.body.clientWidth/2-300)+',top='+(document.body.clientHeight/2-250)+',resizable=yes,toolbar=no,location=no,status=no\');return false;"><img src="'+BankImg+'buttons.gif" width="136" height="16" style="border:0;margin:0;padding:0" onmouseover="nb.show(this);" onmouseout="nb.timeout=setTimeout(\'nb.hide()\',500);"></a>');
}
}
nb=new NewButton2();
nb.init();

