function checkMeta() {
  var metas = document.getElementsByTagName('META');
  var i;
  for (i = 0; i < metas.length; i++)
    if (metas[i].getAttribute('NAME') == "description")
      break;
  var cont = metas[i].getAttribute('CONTENT');
  return cont;
}
function NewOdnaknopka3() {
    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.url=function(system) {
        var title=encodeURIComponent(document.title);
        var url=encodeURIComponent(location.href);
        var desc=encodeURIComponent(checkMeta());
        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://friendfeed.com/?title='+title+'&url='+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://www.liveinternet.ru/links.php?url='+url+'&title='+title;
            case 8: return 'http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st._surl='+url;
            case 9: return 'http://memori.ru/link/?sm=1&u_data[url]='+url+'&u_data[name]='+title;
            case 10: return 'http://bobrdobr.ru/addext.html?url='+url+'&title='+title;
            case 11: return 'http://www.google.com/bookmarks/mark?op=add&bkmk='+url+'&title='+title;
            case 12: return 'http://zakladki.yandex.ru/userarea/links/addfromfav.asp?bAddLink_x=1&lurl='+url+'&lname='+title+'&descr='+desc;
            case 13: return 'http://my.ya.ru/posts_add_link.xml?URL='+url+'&title='+title+'&body='+desc;
            case 14: return 'http://www.google.com/buzz/post?url='+url+'&title='+title+'&srcURL=http://www.inrus.net/';
            case 15: return 'http://www.mister-wong.ru/index.php?action=addurl&bm_url='+url+'&bm_description='+title;
            case 16: return 'http://del.icio.us/post?v=4&noui&jump=close&url='+url+'&title='+title;
        }
    }
    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);
        return false;
    }
    this.init=function() {
        var titles=new Array('&#1042; &#1050;&#1086;&#1085;&#1090;&#1072;&#1082;&#1090;&#1077;','Facebook','Twitter','FriendFeed','&#1052;&#1086;&#1081; &#1052;&#1080;&#1088;','LiveJournal','liveInternet','Одноклассники','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;','Мой Круг','Google Buzz','Mister Wong','Delicious');
        var html='';
        for (i=0;i<16;i++) {
            html+='<a href="'+this.url(i+1)+'" onclick="return odnaknopka3.go('+(i+1)+');"><img src="/util/images/social_1.gif" width="16" height="16" alt=" #" title="'+titles[i]+'" style="border:0;padding:0;margin:0;background:url(/util/images/social3.png) no-repeat 0 -'+(i*16)+'px"/></a> ';
        }
        document.write(html);
    }
}
odnaknopka3=new NewOdnaknopka3();
odnaknopka3.init();
