function getmeta(what) {
	metaCollection = document.getElementsByTagName('meta');
	
	for (ii=0;ii<metaCollection.length;ii++) {
		nameAttribute = metaCollection[ii].name.search(what);
		
		if (nameAttribute!= -1) {
			return metaCollection[ii].content;
		}
	}
}

function Newwykop4() {
	var style = document.createElement('link');
	style.setAttribute('rel','stylesheet');
	style.setAttribute('type', 'text/css');
	style.setAttribute('href', 'http://s.tochka.net/links/css/bookmark.css');
	document.getElementsByTagName('head')[0].appendChild(style);

	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) window.open(this.location,'_blank');
	//	this.location=false;
	}
	
	var kopayurl = 'links.tochka.net';
	
	this.go=function(i) {
			
		this.location=this.get_url(i);
		setTimeout('wykop4.redirect()',1000);
		return false;
		
	}
	
	this.get_url=function(system) {
		var title=encodeURIComponent(document.title);
		var url=encodeURIComponent(location.href);
		switch (system) {
			case 1: return 'http://'+kopayurl+'/index.php?page=diggAdd&link='+decodeURI(url);
			case 2: return 'http://'+kopayurl+'/index.php?page=diggAdd&hidden_add=true&title='+title+'&link='+encodeURIComponent(location.href)+'&redir=bobrdobr';
			case 3: return 'http://'+kopayurl+'/index.php?page=diggAdd&hidden_add=true&title='+title+'&link='+encodeURIComponent(location.href)+'&redir=google';
			case 4: return 'http://'+kopayurl+'/index.php?page=diggAdd&hidden_add=true&title='+title+'&link='+encodeURIComponent(location.href)+'&redir=yandex';
			case 5: return 'http://'+kopayurl+'/index.php?page=diggAdd&hidden_add=true&title='+title+'&link='+encodeURIComponent(location.href)+'&redir=twitter';
			case 6: return 'http://'+kopayurl+'/index.php?page=diggAdd&hidden_add=true&title='+title+'&link='+encodeURIComponent(location.href)+'&redir=del';
			case 7: return 'http://'+kopayurl+'/index.php?page=diggAdd&hidden_add=true&title='+title+'&link='+encodeURIComponent(location.href)+'&redir=text20';
			case 8: return 'http://'+kopayurl+'/index.php?page=diggAdd&hidden_add=true&title='+title+'&link='+encodeURIComponent(location.href)+'&redir=news2';
			case 9: return 'http://'+kopayurl+'/index.php?page=diggAdd&hidden_add=true&title='+title+'&link='+encodeURIComponent(location.href)+'&redir=mister-wong';
			case 10: return 'http://'+kopayurl+'/index.php?page=diggAdd&hidden_add=true&title='+title+'&link='+encodeURIComponent(location.href)+'&redir=moemesto';
			case 11: return 'http://'+kopayurl+'/index.php?page=diggAdd&hidden_add=true&title='+title+'&link='+encodeURIComponent(location.href)+'&redir=smi2';
			case 12: return 'http://'+kopayurl+'/index.php?page=diggAdd&hidden_add=true&title='+title+'&link='+encodeURIComponent(location.href)+'&redir=vaau';
			case 13: return 'http://'+kopayurl+'/index.php?page=diggAdd&hidden_add=true&title='+title+'&link='+encodeURIComponent(location.href)+'&redir=myscoop';
			case 14: return 'http://'+kopayurl+'/index.php?page=diggAdd&hidden_add=true&title='+title+'&link='+encodeURIComponent(location.href)+'&redir=linkstore';
			case 15: return 'http://'+kopayurl+'/index.php?page=diggAdd&hidden_add=true&title='+title+'&link='+encodeURIComponent(location.href)+'&redir=ruspace';
			case 16: return 'http://'+kopayurl+'/index.php?page=diggAdd&hidden_add=true&title='+title+'&link='+encodeURIComponent(location.href)+'&redir=100zakladok';
			case 17: return 'http://'+kopayurl+'/index.php?page=diggAdd&hidden_add=true&title='+title+'&link='+encodeURIComponent(location.href)+'&redir=memori';
			case 18: return 'http://'+kopayurl+'/index.php?page=diggAdd&hidden_add=true&title='+title+'&link='+encodeURIComponent(location.href)+'&redir=digg';
		}
	}

	this.make_wyk=function() {
		document.write(
				'<a href="'+this.get_url(6)+'" target="_blank"><img src="http://s.tochka.net/links/img/bookmark/icon_delicious.gif" width="16" height="16" alt="" /></a>&nbsp;'+
				'<a href="'+this.get_url(5)+'" target="_blank"><img src="http://s.tochka.net/links/img/bookmark/icon_twitter.gif" width="16" height="16" alt="" /></a>&nbsp;'+
				'<a href="'+this.get_url(17)+'" target="_blank"><img src="http://s.tochka.net/links/img/bookmark/icon_memori.gif" width="16" height="16" alt="" /></a>&nbsp;'+
				'<a href="'+this.get_url(18)+'" target="_blank"><img src="http://s.tochka.net/links/img/bookmark/icon_digg.gif" width="16" height="16" alt="" /></a>&nbsp;'+
				'<a href="'+this.get_url(8)+'" target="_blank"><img src="http://s.tochka.net/links/img/bookmark/icon_news2.gif" width="16" height="16" alt="" /></a>&nbsp;'+
				'<a href="'+this.get_url(10)+'" target="_blank"><img src="http://s.tochka.net/links/img/bookmark/icon_myplace.gif" width="16" height="16" alt="" /></a>&nbsp;'+
				'<a href="'+this.get_url(11)+'" target="_blank"><img src="http://s.tochka.net/links/img/bookmark/icon_smi2.gif" width="16" height="16" alt="" /></a>&nbsp;'+
				'<a href="'+this.get_url(2)+'" target="_blank"><img src="http://s.tochka.net/links/img/bookmark/icon_bobrdobr.gif" width="16" height="16" alt="" /></a>&nbsp;'+
				'<a href="'+this.get_url(4)+'" target="_blank"><img src="http://s.tochka.net/links/img/bookmark/icon_yandex.gif" width="16" height="16" alt="" /></a>&nbsp;'+
				'<a href="'+this.get_url(3)+'" target="_blank"><img src="http://s.tochka.net/links/img/bookmark/icon_google.gif" width="16" height="16" alt="" /></a>&nbsp;'+
				'<a href="'+this.get_url(16)+'" target="_blank"><img src="http://s.tochka.net/links/img/bookmark/icon_100zakladok.gif" width="20" height="16" alt="" /></a>');
	}
}
wykop4=new Newwykop4();
wykop4.make_wyk();
