﻿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.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);
var scr=document.createElement('script'); 
scr.type='text/javascript'; 
scr.src='http://odnaknopka.ru/save2/?domain='+this.domain+'&system='+i; 
document.body.appendChild(scr);
return false;
}
this.url=function(system) {
var title=encodeURIComponent(document.title);
var url=encodeURIComponent(location.href);
switch (system) {

case 1: return 'http://www.blogger.com/blog_this.pyra?t&u='+url+'&n='+url+'&a=ADD_SERVICE_FLAG&passive=true&alinsu=0&aplinsu=0&alwf=true&hl=ru&skipvpage=true&rm=false&showra=1&fpui=2&naui=8';

case 2: return 'http://twitter.com/home?status='+title+' '+url;

case 3: return 'http://www.google.com/bookmarks/mark?op=add&bkmk='+url+'&title='+title;

case 4: return 'https://mail.google.com/mail/?view=cm&fs=1&to&su='+title+'&body='+url+'&ui=2&tf=1&shva=1';

case 5: return 'http://www.livejournal.com/update.bml?subject='+title+'&event='+url;

case 6: return 'http://memori.ru/link/?sm=1&u_data[url]='+url+'&u_data[name]='+title;

case 7: return 'http://connect.mail.ru/share?share_url='+url;

case 8: return 'http://www.liveinternet.ru/journal_post.php?action=n_add&cnurl='+url+'&cntitle='+title;

case 9: return 'http://www.facebook.com/share.php?u='+url;

case 10: return 'https://secure.myspace.com/index.cfm?fuseaction=login.simpleform&featureName=postToV3&dest='+url;
}
}
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+'px';
style.visibility='visible';
}
this.init=function() {
var titles=new Array('<img src="/i/blogger.gif">&nbsp;Blogger','<img src="/i/twitter.gif">&nbsp;Twitter','<img src="/i/google.gif">&nbsp;Google','<img src="/i/gmail.gif">&nbsp;Gmail','<img src="/i/livejournal.gif">&nbsp;Livejournal','<img src="/i/memory.gif">&nbsp;Memori','<img src="/i/mail.gif">&nbsp;Mail.ru','<img src="/i/liveinternet.gif">&nbsp;Liveinternet.ru','<img src="/i/fasebook.gif">&nbsp;Facebook','<img src="/i/myspase.gif">&nbsp;Myspace');
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='142px';
div.style.backgroundColor='transparent';
div.style.backgroundImage='url(/i/panel_copy.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 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<10;i++) {
html+='<a href="'+this.url(i+1)+'" style="display:block;float:left;width:108px;height:20px;overflow:hidden;margin:1px 0;padding:0 0 0 14px;background-color:transparent; font:normal 12px arial;color:#666;text-decoration:none;text-align:left;" onmouseover="this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'" onclick="return odnaknopka2.go('+(i+1)+');">'+titles[i]+'</a>';
}
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('<img src="/i/small.gif" width="136" height="16" alt="" title="" style="border:0;margin:0;padding:0" onmouseover="odnaknopka2.show(this);" onmouseout="odnaknopka2.timeout=setTimeout(\'odnaknopka2.hide()\',500);">');
}
}
odnaknopka2=new NewOdnaknopka2();
odnaknopka2.init();

