function IconsButton() {
	this.domain = location.href + '/';
	this.domain = this.domain.substr(this.domain.indexOf('://') + 3);
	this.domain = this.domain.substr(0, this.domain.indexOf('/'));

	this.title = encodeURIComponent(document.title);
	this.link_address = encodeURIComponent(location.href);

	metaTags = document.getElementsByTagName("meta");

	for (i = 0; i < metaTags.length; i++) {

		meta = metaTags[i];
		if (meta.getAttribute('NAME') == 'description') {
			this.description = encodeURIComponent(meta.getAttribute('CONTENT'));
		} else if (meta.getAttribute('NAME') == 'keywords') {
			this.keywords = encodeURIComponent(meta.getAttribute('CONTENT'));
		}
	}

	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 !sel.length||sel == '' ? this.description : encodeURIComponent(sel);
	}
	this.url = function(system) {
		switch (system) {
		case 1:
			return 'http://memori.ru/link/?sm=1&u_data[url]='
					+ this.link_address + '&u_data[name]=' + this.title;
		case 2:
			return 'http://bobrdobr.ru/addext.html?url='
					+ this.link_address + '&title=' + this.title;
		case 3:
			return 'http://www.google.com/bookmarks/mark?op=add&bkmk='
					+ this.link_address + '&title=' + this.title + '&labels='
					+ this.keywords + '&annotation=' + this.selection();
		case 4:
			return 'http://zakladki.yandex.ru/userarea/links/addfromfav.asp?bAddLink_x=1&lurl='
					+ this.link_address + '&lname=' + this.title;
		case 5:
			return 'http://twitter.com/home?status=' + this.title + ' '
					+ this.link_address;
		case 6:
			return 'http://del.icio.us/post?v=4&noui&jump=close&url='
					+ this.link_address + '&title=' + this.title;
		case 7:
			return 'http://text20.ru/add/?source=' + this.link_address
					+ '&title=' + this.title + '&text=' + this.selection();
		case 8:
			return 'http://news2.ru/add_story.php?url=' + this.link_address;
		case 9:
			return 'http://www.mister-wong.ru/index.php?action=addurl&bm_url='
					+ this.link_address + '&bm_description=' + this.title;
		case 10:
			return 'http://moemesto.ru/post.php?url=' + this.link_address
					+ '&title=' + this.title;
		case 11:
			return 'http://smi2.ru/add/?url=' + this.link_address
					+ '&precaption=' + this.title;
		case 12:
			return 'http://www.vaau.ru/submit/?action=step2&url=' + this.link_address;
		case 13:
			return 'http://myscoop.ru/add/?url=' + this.link_address
					+ '&title=' + this.title;
		case 14:
			return 'http://www.linkstore.ru/servlet/LinkStore?a=add&url='
					+ this.link_address + '&title=' + this.title + '&tags='
					+ this.keywords;
		case 15:
			return 'http://www.ruspace.ru/index.php?link=bookmark&action=bookmarkNew&bm=1&url='
					+ this.link_address + '&title=' + this.title;
		case 16:
			return 'http://www.100zakladok.ru/save/?bmurl=' + this.link_address
					+ '&bmtitle=' + this.title;
		}
	}
	this.init = function() {
		var titles = new Array(
				'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;',
				'Twitter',
				'del.icio.us',
				'&#1058;&#1077;&#1082;&#1089;&#1090; 2.0',
				'News2',
				'&#1052;&#1080;&#1089;&#1090;&#1077;&#1088; &#1042;&#1086;&#1085;&#1075;',
				'&#1052;&#1086;&#1105;&#1052;&#1077;&#1089;&#1090;&#1086;',
				'&#1057;&#1052;&#1048; 2',
				'&#1042;&#1072;&#1072;&#1091;!',
				'AddScoop',
				'LinkStore',
				'RuSpace',
				'&#1057;&#1090;&#1086; &#1047;&#1072;&#1082;&#1083;&#1072;&#1076;&#1086;&#1082;');
		var html = '';
		//html += '<a href="http://dobavit-zakladki.ru/"><img src="http://dobavit-zakladki.ru/blank.gif" width="16" height="16" alt=" #" title="&#1054;&#1076;&#1085;&#1072;&#1050;&#1085;&#1086;&#1087;&#1082;&#1072;" style="border:0;padding:0;margin:0 4px 0 0;background:url(http://dobavit-zakladki.ru/panel.png) no-repeat -270px -256px"/></a>';

		for (i = 0; i < titles.length; i++) {
			html += '<a target="_blank" href="'
					+ this.url(i + 1)
					+ '"><img src="http://dobavit-zakladki.ru/images/blank.gif" width="16" height="16" alt=" #" title="'
					+ titles[i]
					+ '" style="border:0;padding:0;margin:0 4px 0 0;background:url(http://dobavit-zakladki.ru/images/panel.png) no-repeat -270px -'
					+ (i * 16) + 'px"/></a>';
		}
		document.write(html);
	}
}

iconsbutton = new IconsButton();
iconsbutton.init();