function NewOdnaknopka2() {
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.wpurl=false;
this.wptitle=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);
//setTimeout('odnaknopka2.redirect()',2000);
window.open(this.location,'odnaknopka');
var scr=document.createElement('script');
scr.type='text/javascript';
scr.src='http://odnaknopka.ru/save2/?domain='+this.domain+'&system='+i;
document.body.appendChild(scr);
}
this.url=function(system) {
var url=this.wpurl;
var title=this.wptitle;
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/share?text='+title+'&url='+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 'https://www.blogger.com/blog-this.g?t&u='+url+'&n='+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('odnaknopka').style.visibility='hidden';
}
this.show=function(element) {
if (this.timeout) clearTimeout(this.timeout);
var left=0,top=0;
var style=document.getElementById('odnaknopka').style;
while (element) {
left+=element.offsetLeft;
top+=element.offsetTop;
element=element.offsetParent;
}
style.left=left+'px';
style.top=(top+16)+'px';
style.visibility='visible';
}
this.wp=function(wpurl,wptitle) {
this.wpurl=wpurl;
this.wptitle=wptitle;
}
this.init=function() {
var titles=new Array('В Контакте','Facebook','Twitter','Одноклассники','Мой Мир','LiveJournal','Memori','БобрДобр','Закладки Google','Blogger','Mister Wong','Delicious');
if (!document.getElementById('odnaknopka')) {
var div=document.createElement('div');
div.id='odnaknopka';
div.style.position='absolute';
div.style.visibility='hidden';
div.style.width='264px';
div.style.height='150px';
div.style.backgroundColor='transparent';
div.style.backgroundImage='url(http://odnaknopka.ru/images/panel.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='';
for (var i=0;i<12;i++) {
html+=''+titles[i]+'';
}
html+='© ОднаКнопка.ру';
div.innerHTML=html;
div.onmouseover=function() {if (odnaknopka2.timeout) clearTimeout(odnaknopka2.timeout)}
div.onmouseout=function() {odnaknopka2.timeout=setTimeout('odnaknopka2.hide()',500)};
document.body.insertBefore(div,document.body.firstChild);
}
document.write('');
}
}
odnaknopka2=new NewOdnaknopka2();
function okbm(url,title) {
odnaknopka2.wp(url,title);
odnaknopka2.init();
}
var js = document.createElement("script");
js.type = "text/javascript";
js.src = "//odnaknopka.ru/stat.js";
document.body.appendChild(js);